Skip to content

Commit

Permalink
emulation: Disregard bce only when autowrapping to the new line
Browse files Browse the repository at this point in the history
Apply bce (background color erase) on a line that newly appears due to an
explicit escape sequence, but not when the text overflows to the next line.

This improves the fix from commit 18171bc
and fixes the le editor.

https://bugzilla.gnome.org/show_bug.cgi?id=754596#c15
  • Loading branch information
egmontkob committed Apr 23, 2017
1 parent 8e670e3 commit a26a60b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
13 changes: 7 additions & 6 deletions src/vte.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2773,7 +2773,7 @@ VteTerminalPrivate::cleanup_fragments(long start,

/* Cursor down, with scrolling. */
void
VteTerminalPrivate::cursor_down()
VteTerminalPrivate::cursor_down(bool explicit_sequence)
{
long start, end;

Expand Down Expand Up @@ -2822,13 +2822,14 @@ VteTerminalPrivate::cursor_down()
update_insert_delta();
}

/* Match xterm and fill the new row when scrolling. */
#if 0 /* Disable for now: see bug 754596. */
if (m_fill_defaults.attr.back != VTE_DEFAULT_BG) {
/* Handle bce (background color erase), however, diverge from xterm:
* only fill the new row with the background color if scrolling
* happens due to an explicit escape sequence, not due to autowrapping.
* See bug 754596 for details. */
if (explicit_sequence && m_fill_defaults.attr.back != VTE_DEFAULT_BG) {
VteRowData *rowdata = ensure_row();
_vte_row_data_fill (rowdata, &m_fill_defaults, m_column_count);
}
#endif
} else {
/* Otherwise, just move the cursor down. */
m_screen->cursor.row++;
Expand Down Expand Up @@ -2965,7 +2966,7 @@ VteTerminalPrivate::insert_char(gunichar c,
/* Mark this line as soft-wrapped. */
row = ensure_row();
row->attr.soft_wrapped = 1;
cursor_down();
cursor_down(false);
} else {
/* Don't wrap, stay at the rightmost column. */
col = m_screen->cursor.col =
Expand Down
2 changes: 1 addition & 1 deletion src/vteinternal.hh
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ public:
void cleanup_fragments(long start,
long end);

void cursor_down();
void cursor_down(bool explicit_sequence);
void drop_scrollback();

void restore_cursor(VteScreen *screen__);
Expand Down
4 changes: 2 additions & 2 deletions src/vteseq.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1661,7 +1661,7 @@ static void
vte_sequence_handler_next_line (VteTerminalPrivate *that, GValueArray *params)
{
that->set_cursor_column(0);
that->cursor_down();
that->cursor_down(true);
}

/* No-op. */
Expand Down Expand Up @@ -1818,7 +1818,7 @@ vte_sequence_handler_line_feed (VteTerminalPrivate *that, GValueArray *params)
{
that->ensure_cursor_is_onscreen();

that->cursor_down();
that->cursor_down(true);
}

/* Cursor up 1 line, with scrolling. */
Expand Down

0 comments on commit a26a60b

Please sign in to comment.