From 1a8e4d7fb2e52289e408971af856b7135436dc9c Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Sun, 20 Aug 2023 15:06:35 +1000 Subject: [PATCH] lib-renderline: change right: margin to measure +ve from left. now right-margin works like left and tabs. +ve is from left edge, -ve is for right edge. 0 is different. It is right-edge for right margin, and left-edge for others. Signed-off-by: NeilBrown --- lib-renderline.c | 3 ++- tests.d/D-test-markup | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib-renderline.c b/lib-renderline.c index 7bad5e8a..62ebe113 100644 --- a/lib-renderline.c +++ b/lib-renderline.c @@ -563,7 +563,8 @@ static int measure_line(struct pane *p safe, struct pane *focus safe, int offset rd->tail_length = cr.x; left_margin = calc_pos(rd->left_margin, p->w, rd->curs_width); - right_margin = p->w - calc_pos(rd->right_margin, p->w, rd->curs_width); + /* 0 means right edge for right_margin, and left edge for all others */ + right_margin = p->w - calc_pos(-rd->right_margin, p->w, rd->curs_width); for (ri = rd->content; ri; ri = ri->next) { if ((unsigned char)rd->line[ri->start] >= ' ') { diff --git a/tests.d/D-test-markup b/tests.d/D-test-markup index d199ca4e..df74e137 100644 --- a/tests.d/D-test-markup +++ b/tests.d/D-test-markup @@ -1,4 +1,4 @@ This is my test file for markup -Now is the time for all good men to come to the aid of the party +Now is the time for all good men to come to the aid of the party -Now is the time for all good men to come to the aid of the party +Now is the time for all good men to come to the aid of the party -- 2.39.5