]> git.neil.brown.name Git - edlib.git/commitdiff
renderline: calculate curs_width even when only a prefix is displayed.
authorNeilBrown <neil@brown.name>
Thu, 27 Jul 2023 06:23:00 +0000 (16:23 +1000)
committerNeilBrown <neil@brown.name>
Thu, 27 Jul 2023 06:23:00 +0000 (16:23 +1000)
Also make sure that the size we shift is always at least 1 - else it
loops forever.

Signed-off-by: NeilBrown <neil@brown.name>
DOC/TODO.md
lib-renderline.c
render-lines.c

index 0485dbc63f3c75e8c89f481225aebef730c1a478..b19aa83d57c4b60a4b3d6f16e72300a447cf07cb 100644 (file)
@@ -9,6 +9,8 @@ the file.
 
 ### Triage
 
+- [ ] factor our list-sort code.
+- [X] when cx-b and default doc name is v.long, shift gets confused
 - [ ] How to run shell command in "44" window??
 - [X] In c-mode, if ) is at end of line then highlighting it causes the
       line to wrap
index 73903e2a3a6dac54b2f108dec3fa5617421e40e4..b863d34d98dddf1a7a6028c72af60a8745d0b303 100644 (file)
@@ -728,6 +728,11 @@ DEF_CMD(renderline)
        else
                shift_left = 0;
 
+       mwidth = 0;
+       update_line_height_attr(p, focus, &line_height, &ascent, &mwidth,
+                               "", "M", scale);
+       rd->curs_width = mwidth;
+
        if (prefix) {
                const char *s = prefix + strlen(prefix);
                update_line_height_attr(p, focus, &line_height, &ascent, NULL,
@@ -755,8 +760,6 @@ DEF_CMD(renderline)
        buf_init(&attr);
        buf_append(&attr, ',');
 
-       rd->curs_width = 0;
-
        /* If findxy was requested, ci->x and ci->y tells us
         * what to look for, and we return index into line where this
         * co-ordinate was reached.
index 57f04f5c7f7f784956bb5d059c20d5169673b393..94072672bd2bddf025aa17d758b2309d742a5aec 100644 (file)
@@ -628,7 +628,7 @@ static void find_lines(struct mark *pm safe, struct pane *p safe,
 
                curs_width = pane_attr_get_int(
                        start->mdata, "curs_width", 1);
-               if (curs_width < 0)
+               if (curs_width <= 0)
                        curs_width = 1;
                while (!rl->do_wrap && !rl->shift_locked &&
                       hp->cx + curs_width >= p->w) {