aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-02-12 17:06:27 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-02-12 17:06:27 +0000
commit69a633221f12293bf11a6ac4b1783a77f5d91620 (patch)
tree480a298bf12dbea5e0a1f4917e826363be7a5b8e
parentrender: spelling (diff)
term: formfeed: set linefeed correctly when we're at last column with lcf=1
When cursor.lcf is set, that means the cursor column was *not* incremented when we printed the last character. Thus, we should *not* decrement the column before setting the linefeed bit.
-rw-r--r--terminal.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/terminal.c b/terminal.c
index 852d7fa4..cb52a416 100644
--- a/terminal.c
+++ b/terminal.c
@@ -1498,8 +1498,11 @@ term_scroll_reverse(struct terminal *term, int rows)
void
term_formfeed(struct terminal *term)
{
- if (term->cursor.point.col > 0)
- term->grid->cur_row->cells[term->cursor.point.col - 1].attrs.linefeed = 1;
+ int col = term->cursor.point.col;
+ if (!term->cursor.lcf)
+ col--;
+ if (col >= 0)
+ term->grid->cur_row->cells[col].attrs.linefeed = 1;
term_cursor_left(term, term->cursor.point.col);
}