Skip to content

Commit

Permalink
Fix a bug where ! would trigger ChatGPT in Markdown documents
Browse files Browse the repository at this point in the history
  • Loading branch information
xyproto committed Feb 12, 2023
1 parent 8168c71 commit 3c1b219
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions v2/keyloop.go
Original file line number Diff line number Diff line change
Expand Up @@ -996,7 +996,7 @@ func Loop(tty *vt100.TTY, fnord FilenameOrData, lineNumber LineNumber, colNumber
shouldUseAI := false
if e.AtOrAfterEndOfLine() {
for _, triggerWord := range triggerWordsForAI {
if triggerWord == "!" && e.mode == mode.Markdown {
if e.mode == mode.Markdown && triggerWord == "!" {
continue
}
if strings.HasPrefix(trimmedLine, e.SingleLineCommentMarker()+" "+triggerWord+" ") {
Expand All @@ -1005,7 +1005,7 @@ func Loop(tty *vt100.TTY, fnord FilenameOrData, lineNumber LineNumber, colNumber
} else if strings.HasPrefix(trimmedLine, e.SingleLineCommentMarker()+triggerWord+" ") {
shouldUseAI = true
break
} else if e.SingleLineCommentMarker() != "!" && strings.HasPrefix(trimmedLine, "!") {
} else if e.mode != mode.Markdown && e.SingleLineCommentMarker() != "!" && strings.HasPrefix(trimmedLine, "!") {
shouldUseAI = true
break
}
Expand Down

0 comments on commit 3c1b219

Please sign in to comment.