Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tabulators are not highlighted completely with 'linebreak' enabled #9500

Closed
wrtlprnft opened this issue Jan 10, 2022 · 4 comments
Closed

Tabulators are not highlighted completely with 'linebreak' enabled #9500

wrtlprnft opened this issue Jan 10, 2022 · 4 comments

Comments

@wrtlprnft
Copy link

Steps to reproduce

Run this shell command:

vim -Nu NONE -S <(cat <<'EOF'
	call matchadd('ErrorMsg', '\t', 5)
	set linebreak
	normal ix
	normal >>
EOF
)

Expected behaviour

I expect all columns that belong to the tab character to be highlighted, like this:

Screenshot_20220110_154450

This is the behavior of vim up to v8.2.3697.

Instead, only the first column gets highlighted:

Screenshot_20220110_154715

This is the behavor with v8.2.3698 (the fix for issue #9242) and v8.2.4051 (current master).

Version of Vim

8.2.4051

Environment

OS: Gentoo
$TERM: screen.xterm-256color (also happens with GTK GUI)

Logs and stack traces

No response

@chrisbra
Copy link
Member

Hm, I think we just need this one:

diff --git a/src/drawline.c b/src/drawline.c
index 8a042ed3e..1c7859acd 100644
--- a/src/drawline.c
+++ b/src/drawline.c
@@ -2043,7 +2043,7 @@ win_line(
                        if (n_extra < 0)
                            n_extra = 0;
                    }
-                   if (on_last_col)
+                   if (on_last_col && c != TAB)
                        // Do not continue search/match highlighting over the
                        // line break.
                        search_attr = 0;

@lacygoill I didn't fully understand your #9242 but I think this change shouldn't affect it.

@lacygoill
Copy link

@lacygoill I didn't fully understand your #9242 but I think this change shouldn't affect it.

I can confirm that the patch doesn't introduce a regression, and that it fixes the current issue:

diff --git a/src/drawline.c b/src/drawline.c
index 8a042ed3e..1c7859acd 100644
--- a/src/drawline.c
+++ b/src/drawline.c
@@ -2043,7 +2043,7 @@ win_line(
 			if (n_extra < 0)
 			    n_extra = 0;
 		    }
-		    if (on_last_col)
+		    if (on_last_col && c != TAB)
 			// Do not continue search/match highlighting over the
 			// line break.
 			search_attr = 0;

Thank you very much for the quick fix.

@wrtlprnft
Copy link
Author

I can confirm that this patch also fixes the actual issue/regression I have with my full vimrc. Thank you very much for the quick replies!

@chrisbra
Copy link
Member

okay I have created #9507 to address this

zeertzjq added a commit to zeertzjq/neovim that referenced this issue Nov 24, 2022
Problem:    Match highlighting of tab too short.
Solution:   Do not stop match highlighting if on a Tab. (Christian Brabandt,
            closes vim/vim#9507, closes vim/vim#9500)

vim/vim@0bbca54

Co-authored-by: Bram Moolenaar <Bram@vim.org>
Nero-F pushed a commit to Nero-F/neovim that referenced this issue Dec 16, 2022
Problem:    Match highlighting of tab too short.
Solution:   Do not stop match highlighting if on a Tab. (Christian Brabandt,
            closes vim/vim#9507, closes vim/vim#9500)

vim/vim@0bbca54

Co-authored-by: Bram Moolenaar <Bram@vim.org>
yesean pushed a commit to yesean/neovim that referenced this issue Mar 25, 2023
Problem:    Match highlighting of tab too short.
Solution:   Do not stop match highlighting if on a Tab. (Christian Brabandt,
            closes vim/vim#9507, closes vim/vim#9500)

vim/vim@0bbca54

Co-authored-by: Bram Moolenaar <Bram@vim.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants