diff --git a/v2/debug.go b/v2/debug.go index 5190f1b7..36e3d343 100644 --- a/v2/debug.go +++ b/v2/debug.go @@ -1055,7 +1055,7 @@ func (e *Editor) DrawInstructions(c *vt100.Canvas, repositionCursor bool) error func (e *Editor) usingGDBMightWork() bool { switch e.mode { - case mode.AIDL, mode.Amber, mode.Basic, mode.Bat, mode.Bazel, mode.Blank, mode.CMake, mode.CS, mode.Clojure, mode.Config, mode.Doc, mode.Email, mode.Erlang, mode.Git, mode.Gradle, mode.HIDL, mode.HTML, mode.JSON, mode.Java, mode.JavaScript, mode.Kotlin, mode.Lisp, mode.Log, mode.Lua, mode.M4, mode.Makefile, mode.ManPage, mode.Markdown, mode.Nroff, mode.Oak, mode.Perl, mode.PolicyLanguage, mode.Python, mode.SQL, mode.Scala, mode.Shell, mode.Teal, mode.Text, mode.TypeScript, mode.Vim, mode.XML: + case mode.AIDL, mode.Amber, mode.Basic, mode.Bat, mode.Bazel, mode.Blank, mode.CMake, mode.CS, mode.Clojure, mode.Config, mode.Doc, mode.Email, mode.Erlang, mode.Git, mode.Gradle, mode.HIDL, mode.HTML, mode.JSON, mode.Java, mode.JavaScript, mode.Kotlin, mode.Lisp, mode.Log, mode.Lua, mode.M4, mode.Make, mode.ManPage, mode.Markdown, mode.Nroff, mode.Oak, mode.Perl, mode.PolicyLanguage, mode.Python, mode.SQL, mode.Scala, mode.Shell, mode.Teal, mode.Text, mode.TypeScript, mode.Vim, mode.XML: // Nope return false case mode.Zig: diff --git a/v2/highlight.go b/v2/highlight.go index 97680b41..f8a03c56 100644 --- a/v2/highlight.go +++ b/v2/highlight.go @@ -126,7 +126,7 @@ func (e *Editor) WriteLines(c *vt100.Canvas, fromline, toline LineIndex, cx, cy escapeFunction := Escape unEscapeFunction := UnEscape - if e.mode == mode.Makefile || e.mode == mode.Shell { + if e.mode == mode.Make || e.mode == mode.Shell { escapeFunction = ShEscape unEscapeFunction = ShUnEscape } @@ -353,17 +353,17 @@ func (e *Editor) WriteLines(c *vt100.Canvas, fromline, toline LineIndex, cx, cy coloredString = unEscapeFunction(e.MultiLineString.Get(line)) case !q.multiLineComment && (strings.HasPrefix(trimmedLine, "#if") || strings.HasPrefix(trimmedLine, "#else") || strings.HasPrefix(trimmedLine, "#elseif") || strings.HasPrefix(trimmedLine, "#endif") || strings.HasPrefix(trimmedLine, "#define") || strings.HasPrefix(trimmedLine, "#pragma")): coloredString = unEscapeFunction(e.MultiLineString.Get(line)) - case e.mode != mode.Shell && e.mode != mode.Makefile && !strings.HasPrefix(trimmedLine, singleLineCommentMarker) && strings.HasSuffix(trimmedLine, "*/") && !strings.Contains(trimmedLine, "/*"): + case e.mode != mode.Shell && e.mode != mode.Make && !strings.HasPrefix(trimmedLine, singleLineCommentMarker) && strings.HasSuffix(trimmedLine, "*/") && !strings.Contains(trimmedLine, "/*"): coloredString = unEscapeFunction(e.MultiLineComment.Get(line)) case (e.mode == mode.StandardML || e.mode == mode.OCaml) && !strings.HasPrefix(trimmedLine, singleLineCommentMarker) && strings.HasSuffix(trimmedLine, "*)") && !strings.Contains(trimmedLine, "(*"): coloredString = unEscapeFunction(e.MultiLineComment.Get(line)) - case e.mode != mode.Shell && e.mode != mode.Makefile && !strings.HasPrefix(trimmedLine, singleLineCommentMarker) && strings.LastIndex(trimmedLine, "/*") > strings.LastIndex(trimmedLine, "*/"): + case e.mode != mode.Shell && e.mode != mode.Make && !strings.HasPrefix(trimmedLine, singleLineCommentMarker) && strings.LastIndex(trimmedLine, "/*") > strings.LastIndex(trimmedLine, "*/"): coloredString = unEscapeFunction(tout.DarkTags(string(textWithTags))) case (e.mode == mode.StandardML || e.mode == mode.OCaml) && !strings.HasPrefix(trimmedLine, singleLineCommentMarker) && strings.LastIndex(trimmedLine, "(*") > strings.LastIndex(trimmedLine, "*)"): coloredString = unEscapeFunction(tout.DarkTags(string(textWithTags))) case q.containsMultiLineComments: coloredString = unEscapeFunction(tout.DarkTags(string(textWithTags))) - case e.mode != mode.Shell && e.mode != mode.Makefile && !strings.HasPrefix(trimmedLine, singleLineCommentMarker) && (q.multiLineComment || q.stoppedMultiLineComment) && !strings.Contains(line, "\"/*") && !strings.Contains(line, "*/\"") && !strings.Contains(line, "\"(*") && !strings.Contains(line, "*)\"") && !strings.HasPrefix(trimmedLine, "#") && !strings.HasPrefix(trimmedLine, "//"): + case e.mode != mode.Shell && e.mode != mode.Make && !strings.HasPrefix(trimmedLine, singleLineCommentMarker) && (q.multiLineComment || q.stoppedMultiLineComment) && !strings.Contains(line, "\"/*") && !strings.Contains(line, "*/\"") && !strings.Contains(line, "\"(*") && !strings.Contains(line, "*)\"") && !strings.HasPrefix(trimmedLine, "#") && !strings.HasPrefix(trimmedLine, "//"): // In the middle of a multi-line comment coloredString = unEscapeFunction(e.MultiLineComment.Get(line)) case q.singleLineComment || q.stoppedMultiLineComment: diff --git a/v2/quotestate.go b/v2/quotestate.go index ae9a9d9a..68ec1f99 100644 --- a/v2/quotestate.go +++ b/v2/quotestate.go @@ -119,7 +119,7 @@ func (q *QuoteState) ProcessRune(r, prevRune, prevPrevRune rune) { } } case '*': // support multi-line comments - if q.mode != mode.Shell && q.mode != mode.Makefile && q.firstRuneInSingleLineCommentMarker != '#' && prevRune == '/' && (prevPrevRune == '\n' || prevPrevRune == ' ' || prevPrevRune == '\t') && q.None() { + if q.mode != mode.Shell && q.mode != mode.Make && q.firstRuneInSingleLineCommentMarker != '#' && prevRune == '/' && (prevPrevRune == '\n' || prevPrevRune == ' ' || prevPrevRune == '\t') && q.None() { // C-style q.multiLineComment = true q.startedMultiLineComment = true @@ -130,7 +130,7 @@ func (q *QuoteState) ProcessRune(r, prevRune, prevPrevRune rune) { q.startedMultiLineComment = true } case '-': // support for HTML-style and XML-style multi-line comments - if q.mode != mode.Shell && q.mode != mode.Makefile && prevRune == '!' && prevPrevRune == '<' && q.None() { + if q.mode != mode.Shell && q.mode != mode.Make && prevRune == '!' && prevPrevRune == '<' && q.None() { q.multiLineComment = true q.startedMultiLineComment = true } @@ -140,7 +140,7 @@ func (q *QuoteState) ProcessRune(r, prevRune, prevPrevRune rune) { switch { case len(q.singleLineCommentMarkerRunes) == 1: fallthrough - case q.mode != mode.Shell && q.mode != mode.Makefile && len(q.singleLineCommentMarkerRunes) > 1 && prevRune == q.firstRuneInSingleLineCommentMarker: + case q.mode != mode.Shell && q.mode != mode.Make && len(q.singleLineCommentMarkerRunes) > 1 && prevRune == q.firstRuneInSingleLineCommentMarker: q.singleLineComment = true q.startedMultiLineString = false q.stoppedMultiLineComment = false @@ -158,7 +158,7 @@ func (q *QuoteState) ProcessRune(r, prevRune, prevPrevRune rune) { // r == '/' fallthrough case '/': // support C-style multi-line comments - if q.mode != mode.Shell && q.mode != mode.Makefile && q.firstRuneInSingleLineCommentMarker != '#' && prevRune == '*' { + if q.mode != mode.Shell && q.mode != mode.Make && q.firstRuneInSingleLineCommentMarker != '#' && prevRune == '*' { q.stoppedMultiLineComment = true q.multiLineComment = false if q.startedMultiLineComment { diff --git a/v2/syntax.go b/v2/syntax.go index 032e9294..aab49823 100644 --- a/v2/syntax.go +++ b/v2/syntax.go @@ -150,7 +150,7 @@ func adjustSyntaxHighlightingKeywords(m mode.Mode) { // Only highlight some words, to make them stand out clearKeywords() addKeywords = []string{"db", "dd", "dw", "int", "resb", "resd", "resw", "section", "syscall"} - case mode.Makefile, mode.Shell: + case mode.Make, mode.Shell: addKeywords = []string{"--force", "-f", "checkout", "clean", "cmake", "configure", "dd", "do", "doas", "done", "endif", "exec", "fdisk", "for", "gdisk", "ifeq", "ifneq", "in", "make", "mv", "ninja", "rm", "rmdir", "setopt", "su", "sudo", "while"} delKeywords = []string{"#else", "#endif", "as", "build", "default", "double", "exec", "finally", "float", "fn", "generic", "get", "long", "new", "no", "package", "pass", "property", "require", "ret", "set", "super", "super", "template", "type", "var", "with"} if m == mode.Shell { // Only for shell scripts, not for Makefiles @@ -177,7 +177,7 @@ func adjustSyntaxHighlightingKeywords(m mode.Mode) { // comment for the current language mode the editor is in. func (e *Editor) SingleLineCommentMarker() string { switch e.mode { - case mode.Bazel, mode.CMake, mode.Config, mode.Crystal, mode.Makefile, mode.Nim, mode.PolicyLanguage, mode.Python, mode.Shell: + case mode.Bazel, mode.CMake, mode.Config, mode.Crystal, mode.Make, mode.Nim, mode.PolicyLanguage, mode.Python, mode.Shell: return "#" case mode.Assembly: return ";"