diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2025-06-08 11:09:30 -0500 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2025-06-08 15:35:07 -0500 |
| commit | 59ce465f6d51f1d3b8ae18a3346264006e99aab5 (patch) | |
| tree | ebabd52d1adece59d9521b040ca844f13b0190d9 /init.lua | |
| parent | cef8b428cff4cfb3fa07f30eab644cba1540b4b2 (diff) | |
| download | vis-lspc-59ce465f6d51f1d3b8ae18a3346264006e99aab5.tar.gz vis-lspc-59ce465f6d51f1d3b8ae18a3346264006e99aab5.zip | |
fix the line number detection with tabs
If a line includes tabs add the visually added space for each tab stop
to the line length in order to detect a wrapped line.
Diffstat (limited to 'init.lua')
| -rw-r--r-- | init.lua | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -566,9 +566,14 @@ local function file_lineno_to_viewport_lineno(win, file_lineno) local view_lineno = 0 for n = win.viewport.lines.start, file_lineno do view_lineno = view_lineno + 1 - -- Wrapped line this shifts our displayed line down - if #win.file.lines[n] > win.viewport.width then - view_lineno = view_lineno + math.floor(#win.file.lines[n] / win.viewport.width) + -- Wrapped lines shift our displayed line down + local line_len = #win.file.lines[n] + if not win.options.expandtab then + line_len = util.visual_chars_in_line(win, win.file.lines[n], line_len) + end + + if line_len >= win.viewport.width then + view_lineno = view_lineno + math.floor(line_len / win.viewport.width) end end return view_lineno |
