summaryrefslogtreecommitdiffstats
path: root/src/mouse.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-07-25 18:13:54 +0100
committerBram Moolenaar <Bram@vim.org>2022-07-25 18:13:54 +0100
commit7f9969c559b51446632ac7e8f76cde07e7d0078d (patch)
tree77868549433487dbadb8833a1b6a63d522adaa72 /src/mouse.c
parentb529cfbd04c02e31cfa88f2c8d88b5ff532d4f7d (diff)
patch 9.0.0067: cannot show virtual textv9.0.0067
Problem: Cannot show virtual text. Solution: Initial changes for virtual text support, using text properties.
Diffstat (limited to 'src/mouse.c')
-rw-r--r--src/mouse.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/mouse.c b/src/mouse.c
index 724b5df159..e92a73c033 100644
--- a/src/mouse.c
+++ b/src/mouse.c
@@ -3101,18 +3101,20 @@ mouse_find_win(int *rowp, int *colp, mouse_find_T popup UNUSED)
int
vcol2col(win_T *wp, linenr_T lnum, int vcol)
{
- // try to advance to the specified column
- int count = 0;
- char_u *ptr;
- char_u *line;
+ char_u *line;
+ chartabsize_T cts;
- line = ptr = ml_get_buf(wp->w_buffer, lnum, FALSE);
- while (count < vcol && *ptr != NUL)
+ // try to advance to the specified column
+ line = ml_get_buf(wp->w_buffer, lnum, FALSE);
+ init_chartabsize_arg(&cts, wp, lnum, 0, line, line);
+ while (cts.cts_vcol < vcol && *cts.cts_ptr != NUL)
{
- count += win_lbr_chartabsize(wp, line, ptr, count, NULL);
- MB_PTR_ADV(ptr);
+ cts.cts_vcol += win_lbr_chartabsize(&cts, NULL);
+ MB_PTR_ADV(cts.cts_ptr);
}
- return (int)(ptr - line);
+ clear_chartabsize_arg(&cts);
+
+ return (int)(cts.cts_ptr - line);
}
#endif