@@ -67,6 +67,14 @@ local function get_uuid()
67
67
return uuid_extmark
68
68
end
69
69
70
+ local function get_relative_position ()
71
+ local col = vim .fn .virtcol (" $" )
72
+ local win_row = vim .fn .winline () - 1
73
+ local leftcol = vim .fn .winsaveview ().leftcol
74
+
75
+ return { row = win_row , col = col - leftcol }
76
+ end
77
+
70
78
function M .create_extmarks (opts , event , curline , virt_lines , offset , need_to_be_under , virt_prorioty )
71
79
local diag_overflow_last_line = false
72
80
local buf_lines_count = vim .api .nvim_buf_line_count (event .buf )
@@ -76,10 +84,7 @@ function M.create_extmarks(opts, event, curline, virt_lines, offset, need_to_be_
76
84
diag_overflow_last_line = true
77
85
end
78
86
79
- local win_col = vim .fn .virtcol ({
80
- curline + 1 ,
81
- " $" ,
82
- })
87
+ local win_col = get_relative_position ().col
83
88
84
89
if need_to_be_under then
85
90
win_col = 0
@@ -162,7 +167,7 @@ function M.create_extmarks(opts, event, curline, virt_lines, offset, need_to_be_
162
167
line_hl_group = " TinyInlineDiagnosticVirtualTextBg" ,
163
168
virt_text_pos = " eol" ,
164
169
virt_text = virt_lines [1 ],
165
- -- virt_text_win_col = win_col + offset ,
170
+ virt_text_win_col = win_col ,
166
171
priority = virt_prorioty ,
167
172
strict = false ,
168
173
})
0 commit comments