-
Notifications
You must be signed in to change notification settings - Fork 263
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
Extra terminal cells styled after end of file #1176
Comments
Not sure if it's related, but if for example I set a different background color for a certain type of string in the theme file (say, lexers.STYLE_FUNCTION), the background color will overflow over the neighboring empty cells too. |
diff --git a/view.c b/view.c
index df7906b..6a723a4 100644
--- a/view.c
+++ b/view.c
@@ -1432,10 +1432,10 @@ void view_style(View *view, enum UiStyle style, size_t start, size_t end) {
col++;
do {
- while (pos <= end && col < width) {
+ while (pos < end && col < width) {
pos += line->cells[col].len;
view->ui->style_set(view->ui, &line->cells[col++], style);
}
col = 0;
- } while (pos <= end && (line = line->next));
+ } while (pos < end && (line = line->next));
} This works, the Otherwise we reach @acidrums4 could you see if this fixes your issue as well? EDIT: nvm, this breaks regular highlighting at the last character as well, in case there is more text after it , eg |
This might be a more reasonable fix: diff --git a/lua/vis-std.lua b/lua/vis-std.lua
index 8b5715b..1ccef0d 100644
--- a/lua/vis-std.lua
+++ b/lua/vis-std.lua
@@ -75,7 +75,7 @@ vis.events.subscribe(vis.events.WIN_HIGHLIGHT, function(win)
local data = win.file:content(viewport)
local token_styles = lexer._TOKENSTYLES
local tokens = lexer:lex(data, 1)
- local token_end = lex_start + (tokens[#tokens] or 1) - 1
+ local token_end = lex_start + ((tokens[#tokens] and tokens[#tokens] - 1) or 1) - 1
for i = #tokens - 1, 1, -2 do
local token_start = lex_start + (tokens[i-1] or 1) - 1 Not sure if I'm missing any edge case here |
Problem
For markdown files containing a hyperlink at the end (no newlines), the underlining style overflows over to the empty cells:
I've not investigated much but there might be an off by one error around this logic (as lua is one indexed):
vis/lua/vis-std.lua
Line 67 in 6f537f3
Seems similar to #1147
Steps to reproduce
No response
vis version (vis -v)
vis 95bf9f5-dirty +curses +lua +lpeg
Terminal name/version
foot 1.16.2
$TERM environment variable
foot
The text was updated successfully, but these errors were encountered: