]> git.neil.brown.name Git - edlib.git/commitdiff
lib-renderline: change right: margin to measure +ve from left.
authorNeilBrown <neil@brown.name>
Sun, 20 Aug 2023 05:06:35 +0000 (15:06 +1000)
committerNeilBrown <neil@brown.name>
Sun, 20 Aug 2023 22:47:16 +0000 (08:47 +1000)
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 <neil@brown.name>
lib-renderline.c
tests.d/D-test-markup

index 7bad5e8abd181a62091eb4f2f6aab6c08ac282a5..62ebe1133fb6610ba31ca547b558e1b1fdc56be9 100644 (file)
@@ -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] >= ' ') {
index d199ca4e66d952cf661d2e4303064d017eada7fe..df74e1371467e11d9456b720db1a2c518623e966 100644 (file)
@@ -1,4 +1,4 @@
 <space-above:40,space-below:10,20,fg:blue,bg:yellow,center>This is my test file for markup</>
-<word-wrap,wrap-tail:,wrap-head:-),wrap-,right:300,left:70>Now is the time for all good men to come to the aid of the party</a>
+<word-wrap,wrap-tail:,wrap-head:-),wrap-,right:400,left:70>Now is the time for all good men to come to the aid of the party</a>
 
-<wrap-tail:,wrap-head:-),wrap-,right:300,left:70>Now is the time for all good men to come to the aid of the party</a>
+<wrap-tail:,wrap-head:-),wrap-,right:400,left:70>Now is the time for all good men to come to the aid of the party</a>