@@ -540,11 +540,17 @@ function Chat:highlight_message_content(lines, start_line)
540540 local header_text = {}
541541 if code_lang then
542542 table.insert (header_text , { " LANGUAGE: " .. string.upper (code_lang ) .. " " , " ChatGPTCodeLang" })
543- table.insert (header_text , { " ────────────────── " , " ChatGPTCodeBlockHeader" })
543+ table.insert (
544+ header_text ,
545+ { " ────────────────── " , " ChatGPTCodeBlockHeader" }
546+ )
544547 table.insert (header_text , { " [y] copy" , " Comment" })
545548 else
546549 table.insert (header_text , { " CODE " , " ChatGPTCodeLang" })
547- table.insert (header_text , { " ────────────────── " , " ChatGPTCodeBlockHeader" })
550+ table.insert (
551+ header_text ,
552+ { " ────────────────── " , " ChatGPTCodeBlockHeader" }
553+ )
548554 table.insert (header_text , { " [y] copy" , " Comment" })
549555 end
550556 vim .api .nvim_buf_set_extmark (bufnr , Config .namespace_id , line_num , 0 , {
@@ -614,7 +620,9 @@ function Chat:highlight_message_content(lines, start_line)
614620 local col = 1
615621 while true do
616622 local s , e = line :find (" `[^`]+`" , col )
617- if not s then break end
623+ if not s then
624+ break
625+ end
618626 vim .api .nvim_buf_add_highlight (bufnr , Config .namespace_id , " ChatGPTInlineCode" , line_num , s - 1 , e )
619627 col = e + 1
620628 end
@@ -623,7 +631,9 @@ function Chat:highlight_message_content(lines, start_line)
623631 col = 1
624632 while true do
625633 local s , e = line :find (" %*%*[^%*]+%*%*" , col )
626- if not s then break end
634+ if not s then
635+ break
636+ end
627637 vim .api .nvim_buf_add_highlight (bufnr , Config .namespace_id , " ChatGPTBold" , line_num , s - 1 , e )
628638 col = e + 1
629639 end
@@ -632,7 +642,9 @@ function Chat:highlight_message_content(lines, start_line)
632642 col = 1
633643 while true do
634644 local s , e = line :find (" %*[^%*]+%*" , col )
635- if not s then break end
645+ if not s then
646+ break
647+ end
636648 -- Skip if it's actually bold (**)
637649 if line :sub (s , s + 1 ) ~= " **" and (s == 1 or line :sub (s - 1 , s - 1 ) ~= " *" ) then
638650 vim .api .nvim_buf_add_highlight (bufnr , Config .namespace_id , " ChatGPTItalic" , line_num , s - 1 , e )
@@ -644,7 +656,9 @@ function Chat:highlight_message_content(lines, start_line)
644656 col = 1
645657 while true do
646658 local s , e = line :find (" https?://[^%s%)%]]+" , col )
647- if not s then break end
659+ if not s then
660+ break
661+ end
648662 vim .api .nvim_buf_add_highlight (bufnr , Config .namespace_id , " ChatGPTLink" , line_num , s - 1 , e )
649663 col = e + 1
650664 end
@@ -663,7 +677,9 @@ function Chat:highlight_message_content(lines, start_line)
663677 col = 1
664678 while true do
665679 local s , e = line :find (" ~~[^~]+~~" , col )
666- if not s then break end
680+ if not s then
681+ break
682+ end
667683 vim .api .nvim_buf_add_highlight (bufnr , Config .namespace_id , " ChatGPTStrikethrough" , line_num , s - 1 , e )
668684 col = e + 1
669685 end
@@ -672,7 +688,9 @@ function Chat:highlight_message_content(lines, start_line)
672688 col = 1
673689 while true do
674690 local s , e = line :find (" %[[^%]]+%]%([^%)]+%)" , col )
675- if not s then break end
691+ if not s then
692+ break
693+ end
676694 -- Find the split between text and url
677695 local text_end = line :find (" %]%(" , s )
678696 if text_end then
0 commit comments