terminal: Tab should not output spaces, just move cursor
Emacs uses tab and backspace to move the cursor as well as the regular cursor movement escape codes. When it's less bytes than the escape code, emacs will use a tab or tab + backspace to move the cursor forward. The effect is that as you're moving around in the buffer, emacs will (seemingly) randomly insert spaces and overwrite what's in the terminal. Making tab just move the cursor as it should fixes this.
This commit is contained in:
@@ -1763,12 +1763,6 @@ handle_sgr(struct terminal *terminal, int code)
|
|||||||
static int
|
static int
|
||||||
handle_special_char(struct terminal *terminal, char c)
|
handle_special_char(struct terminal *terminal, char c)
|
||||||
{
|
{
|
||||||
union utf8_char *row;
|
|
||||||
struct attr *attr_row;
|
|
||||||
|
|
||||||
row = terminal_get_row(terminal, terminal->row);
|
|
||||||
attr_row = terminal_get_attr_row(terminal, terminal->row);
|
|
||||||
|
|
||||||
switch(c) {
|
switch(c) {
|
||||||
case '\r':
|
case '\r':
|
||||||
terminal->column = 0;
|
terminal->column = 0;
|
||||||
@@ -1791,9 +1785,6 @@ handle_special_char(struct terminal *terminal, char c)
|
|||||||
while (terminal->column < terminal->width) {
|
while (terminal->column < terminal->width) {
|
||||||
if (terminal->mode & MODE_IRM)
|
if (terminal->mode & MODE_IRM)
|
||||||
terminal_shift_line(terminal, +1);
|
terminal_shift_line(terminal, +1);
|
||||||
row[terminal->column].byte[0] = ' ';
|
|
||||||
row[terminal->column].byte[1] = '\0';
|
|
||||||
attr_row[terminal->column] = terminal->curr_attr;
|
|
||||||
terminal->column++;
|
terminal->column++;
|
||||||
if (terminal->tab_ruler[terminal->column]) break;
|
if (terminal->tab_ruler[terminal->column]) break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user