From 5059e07cd7139057e9d88836061eec89b16605a9 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Thu, 27 Jul 2023 16:23:00 +1000 Subject: [PATCH] renderline: calculate curs_width even when only a prefix is displayed. Also make sure that the size we shift is always at least 1 - else it loops forever. Signed-off-by: NeilBrown --- DOC/TODO.md | 2 ++ lib-renderline.c | 7 +++++-- render-lines.c | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/DOC/TODO.md b/DOC/TODO.md index 0485dbc6..b19aa83d 100644 --- a/DOC/TODO.md +++ b/DOC/TODO.md @@ -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 diff --git a/lib-renderline.c b/lib-renderline.c index 73903e2a..b863d34d 100644 --- a/lib-renderline.c +++ b/lib-renderline.c @@ -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. diff --git a/render-lines.c b/render-lines.c index 57f04f5c..94072672 100644 --- a/render-lines.c +++ b/render-lines.c @@ -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) { -- 2.39.5