Skip to content

Lines starting with -- are not highlighted when called by git commit -v #3693

Closed
@sshilovsky

Description

@sshilovsky

Summary

When a line starting with - is removed from a source file, the corresponding diff line starts with double -.

It's not highlighted in the editor.

Reproduction Steps

$ cd $(mktemp -d)
$ git init
$ echo "-1" > a
$ git add a
$ git commit a -m1
$ truncate --size 0 a
$ GIT_EDITOR=$(which hx) git commit a -v

The following content is opened:


# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# On branch main
# Changes to be committed:
#	modified:   a
#
# ------------------------ >8 ------------------------
# Do not modify or remove the line above.
# Everything below it will be ignored.
diff --git a/a b/a
index 3a2e3f4..e69de29 100644
--- a/a
+++ b/a
@@ -1 +0,0 @@
--1

The last line (--1) designates a removed line, and should be highlighted (usually with red font), but it's not. It doesn't have to be the last line for this to happen.

Helix log

~/.cache/helix/helix.log
2022-09-05T02:07:10.096 helix_view::editor [ERROR] Failed to initialize the LSP for `git.commitmsg` { LSP not defined }

Platform

Linux

Terminal Emulator

alacritty 0.10.1 ()

Helix Version

helix 22.08 (ee94031)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions