mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-11-04 13:29:51 -05:00
Update tail pointer correctly so scrolling works.
This commit is contained in:
parent
f04e838d4a
commit
b29415ee6d
1 changed files with 9 additions and 1 deletions
10
terminal.c
10
terminal.c
|
|
@ -55,7 +55,7 @@ struct terminal {
|
||||||
struct wl_display *display;
|
struct wl_display *display;
|
||||||
int resize_scheduled;
|
int resize_scheduled;
|
||||||
char *data;
|
char *data;
|
||||||
int width, height, tail, row, column;
|
int width, height, tail, row, column, total_rows;
|
||||||
int fd, master;
|
int fd, master;
|
||||||
struct buffer *buffer;
|
struct buffer *buffer;
|
||||||
GIOChannel *channel;
|
GIOChannel *channel;
|
||||||
|
|
@ -149,9 +149,17 @@ terminal_data(struct terminal *terminal, const char *data, size_t length)
|
||||||
break;
|
break;
|
||||||
case '\n':
|
case '\n':
|
||||||
terminal->row++;
|
terminal->row++;
|
||||||
|
terminal->total_rows++;
|
||||||
terminal->column = 0;
|
terminal->column = 0;
|
||||||
if (terminal->row == terminal->height)
|
if (terminal->row == terminal->height)
|
||||||
terminal->row = 0;
|
terminal->row = 0;
|
||||||
|
if (terminal->row == terminal->tail && terminal->total_rows > 0) {
|
||||||
|
memset(&terminal->data[terminal->row * (terminal->width + 1)],
|
||||||
|
0, terminal->width);
|
||||||
|
terminal->tail++;
|
||||||
|
}
|
||||||
|
if (terminal->tail == terminal->height)
|
||||||
|
terminal->tail = 0;
|
||||||
break;
|
break;
|
||||||
case '\t':
|
case '\t':
|
||||||
memset(&row[terminal->column], ' ', -terminal->column & 7);
|
memset(&row[terminal->column], ' ', -terminal->column & 7);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue