From: NeilBrown Date: Sun, 20 Aug 2023 05:06:35 +0000 (+1000) Subject: lib-renderline: change right: margin to measure +ve from left. X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;h=1a8e4d7fb2e52289e408971af856b7135436dc9c;p=edlib.git 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 --- 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