From addaa40562c1329a0c9c81092aa22120e3e40cb2 Mon Sep 17 00:00:00 2001 From: David Herrmann Date: Tue, 29 May 2012 17:07:53 +0200 Subject: [PATCH] vte: add auto-wrap support VT510 manual says auto-wrap is disabled by default but most applications (including bash) expect it to be on, therefore we enable it by default. The console layer already supported it but the vte layer wasn't hooked up. Signed-off-by: David Herrmann --- src/console.c | 4 +--- src/console.h | 1 + src/vte.c | 3 +++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/console.c b/src/console.c index eefd572..d21f2ff 100644 --- a/src/console.c +++ b/src/console.c @@ -98,7 +98,6 @@ struct kmscon_console { /* console cells */ struct kmscon_buffer *cells; bool rel_addr; /* is relative addressing used? */ - bool auto_wrap; /* auto wrap on end of line? */ /* cursor */ unsigned int cursor_x; @@ -982,7 +981,6 @@ int kmscon_console_new(struct kmscon_console **out) memset(con, 0, sizeof(*con)); con->ref = 1; - con->auto_wrap = true; ret = kmscon_buffer_new(&con->cells, 0, 0); if (ret) @@ -1067,7 +1065,7 @@ void kmscon_console_write(struct kmscon_console *con, kmscon_symbol_t ch, last = con->cells->scroll_y + con->cells->mtop_y; if (con->cursor_x >= con->cells->size_x) { - if (con->auto_wrap) { + if (flags & KMSCON_CONSOLE_WRAP) { con->cursor_x = 0; con->cursor_y++; if (con->cursor_y >= last) { diff --git a/src/console.h b/src/console.h index 8528b8d..fe65eb9 100644 --- a/src/console.h +++ b/src/console.h @@ -45,6 +45,7 @@ struct kmscon_console; /* console objects */ #define KMSCON_CONSOLE_INSERT 0x01 +#define KMSCON_CONSOLE_WRAP 0x02 int kmscon_console_new(struct kmscon_console **out); void kmscon_console_ref(struct kmscon_console *con); diff --git a/src/vte.c b/src/vte.c index e132b46..314c8a4 100644 --- a/src/vte.c +++ b/src/vte.c @@ -269,6 +269,8 @@ static void write_console(struct kmscon_vte *vte, kmscon_symbol_t sym) flags = 0; if (vte->flags & FLAG_INSERT_REPLACE_MODE) flags |= KMSCON_CONSOLE_INSERT; + if (vte->flags & FLAG_AUTO_WRAP_MODE) + flags |= KMSCON_CONSOLE_WRAP; kmscon_console_write(vte->con, sym, &vte->cattr, flags); } @@ -288,6 +290,7 @@ void kmscon_vte_reset(struct kmscon_vte *vte) vte->flags |= FLAG_TEXT_CURSOR_MODE; vte->flags |= FLAG_AUTO_REPEAT_MODE; vte->flags |= FLAG_SEND_RECEIVE_MODE; + vte->flags |= FLAG_AUTO_WRAP_MODE; kmscon_utf8_mach_reset(vte->mach); vte->state = STATE_GROUND;