aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--render.c5
-rw-r--r--terminal.c8
-rw-r--r--terminal.h4
-rw-r--r--vt.c4
4 files changed, 17 insertions, 4 deletions
diff --git a/render.c b/render.c
index de81adc7..2fb4d6cf 100644
--- a/render.c
+++ b/render.c
@@ -1055,7 +1055,10 @@ reflow(struct terminal *term, struct row **new_grid, int new_cols, int new_rows,
* *entire* old line was empty.
*/
- if (empty_count < old_cols && old_row->cells[old_cols - 1].wc == 0) {
+ if (empty_count < old_cols &&
+ (old_row->cells[old_cols - 1].wc == 0 ||
+ old_row->cells[old_cols - 1].attrs.linefeed))
+ {
new_col_idx = 0;
new_row_idx = (new_row_idx + 1) & (new_rows - 1);
diff --git a/terminal.c b/terminal.c
index a07b1912..5c9f0b8b 100644
--- a/terminal.c
+++ b/terminal.c
@@ -1495,6 +1495,14 @@ 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;
+ term_cursor_left(term, term->cursor.point.col);
+}
+
+void
term_linefeed(struct terminal *term)
{
if (term->cursor.point.row == term->scroll_region.end - 1)
diff --git a/terminal.h b/terminal.h
index b4ce1212..449a1329 100644
--- a/terminal.h
+++ b/terminal.h
@@ -42,7 +42,8 @@ struct attributes {
uint32_t have_fg:1;
uint32_t have_bg:1;
uint32_t selected:2;
- uint32_t reserved:3;
+ uint32_t linefeed:1;
+ uint32_t reserved:2;
uint32_t bg:24;
};
static_assert(sizeof(struct attributes) == 8, "bad size");
@@ -403,6 +404,7 @@ void term_scroll_partial(
void term_scroll_reverse_partial(
struct terminal *term, struct scroll_region region, int rows);
+void term_formfeed(struct terminal *term);
void term_linefeed(struct terminal *term);
void term_reverse_index(struct terminal *term);
diff --git a/vt.c b/vt.c
index 06445e4c..3cdd5b24 100644
--- a/vt.c
+++ b/vt.c
@@ -128,7 +128,7 @@ action_execute(struct terminal *term, uint8_t c)
case '\r':
/* FF - form feed */
- term_cursor_left(term, term->cursor.point.col);
+ term_formfeed(term);
break;
case '\b':
@@ -361,8 +361,8 @@ action_esc_dispatch(struct terminal *term, uint8_t final)
break;
case 'E':
+ term_formfeed(term);
term_linefeed(term);
- term_cursor_left(term, term->cursor.point.col);
break;
case 'H':