Skip to content
This repository has been archived by the owner on Sep 17, 2024. It is now read-only.

Commit

Permalink
use newlines instead of padded spaces when restoring multi-line histo…
Browse files Browse the repository at this point in the history
  • Loading branch information
benesch committed Nov 27, 2018
1 parent 9f5b04d commit 77f071b
Showing 1 changed file with 8 additions and 30 deletions.
38 changes: 8 additions & 30 deletions src/terminal.c
Original file line number Diff line number Diff line change
Expand Up @@ -509,36 +509,14 @@ terminal_move_to_line(EditLine *el, int where)
return;
}
if ((del = where - el->el_cursor.v) > 0) {
while (del > 0) {
if (EL_HAS_AUTO_MARGINS &&
el->el_display[el->el_cursor.v][0] != '\0') {
size_t h = (size_t)
(el->el_terminal.t_size.h - 1);
for (; h > 0 &&
el->el_display[el->el_cursor.v][h] ==
MB_FILL_CHAR;
h--)
continue;
/* move without newline */
terminal_move_to_char(el, (int)h);
terminal_overwrite(el, &el->el_display
[el->el_cursor.v][el->el_cursor.h],
(size_t)(el->el_terminal.t_size.h -
el->el_cursor.h));
/* updates Cursor */
del--;
} else {
if ((del > 1) && GoodStr(T_DO)) {
terminal_tputs(el, tgoto(Str(T_DO), del,
del), del);
del = 0;
} else {
for (; del > 0; del--)
terminal__putc(el, '\n');
/* because the \n will become \r\n */
el->el_cursor.h = 0;
}
}
if ((del > 1) && GoodStr(T_DO)) {
terminal_tputs(el, tgoto(Str(T_DO), del, del), del);
del = 0;
} else {
for (; del > 0; del--)
terminal__putc(el, '\n');
/* because the \n will become \r\n */
el->el_cursor.h = 0;
}
} else { /* del < 0 */
if (GoodStr(T_UP) && (-del > 1 || !GoodStr(T_up)))
Expand Down

0 comments on commit 77f071b

Please sign in to comment.