Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/tsm/libtsm-int.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ void screen_cell_init(struct tsm_screen *con, struct cell *cell);
void tsm_screen_set_opts(struct tsm_screen *scr, unsigned int opts);
void tsm_screen_reset_opts(struct tsm_screen *scr, unsigned int opts);
unsigned int tsm_screen_get_opts(struct tsm_screen *scr);
void tsm_screen_repeat_char(struct tsm_screen *con, unsigned int num);

static inline void screen_inc_age(struct tsm_screen *con)
{
Expand Down
30 changes: 30 additions & 0 deletions src/tsm/tsm-screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -1550,6 +1550,36 @@ void tsm_screen_insert_chars(struct tsm_screen *con, unsigned int num)
screen_cell_init(con, &cells[con->cursor_x + i]);
}

void tsm_screen_repeat_char(struct tsm_screen *con, unsigned int num)
{
struct cell *cells;
unsigned int max, i;

if (!con || !num || !con->size_y || !con->size_x)
return;

screen_inc_age(con);
/* TODO: more sophisticated ageing */
con->age = con->age_cnt;

if (con->cursor_x >= con->size_x)
con->cursor_x = con->size_x - 1;
if (con->cursor_y >= con->size_y)
con->cursor_y = con->size_y - 1;

if (!con->cursor_x)
return;

max = con->size_x - con->cursor_x;
if (num > max)
num = max;

cells = con->lines[con->cursor_y]->cells;
for (i = 0; i < num; i++)
cells[con->cursor_x + i] = cells[con->cursor_x - 1];
con->cursor_x += num;
}

SHL_EXPORT
void tsm_screen_delete_chars(struct tsm_screen *con, unsigned int num)
{
Expand Down
6 changes: 5 additions & 1 deletion src/tsm/tsm-vte.c
Original file line number Diff line number Diff line change
Expand Up @@ -2065,7 +2065,11 @@ static void do_csi(struct tsm_vte *vte, uint32_t data)
if (vte->csi_argv[0] == 18 || vte->csi_argv[0] == 19)
csi_report_window_size(vte);
else
llog_debug(vte, "unhandled CSI t sequence %c", data);
llog_debug(vte, "unhandled CSI t sequence %d", vte->csi_argv[0]);
break;
case 'b': /* Repeat last char */
num = vte->csi_argv[0];
tsm_screen_repeat_char(vte->con, num);
break;
default:
llog_debug(vte, "unhandled CSI sequence %c", data);
Expand Down
Loading