Skip to content

Instantly share code, notes, and snippets.

@benesch
Created November 21, 2018 04:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benesch/48ac40e76179ec7f71c58c6360f9c391 to your computer and use it in GitHub Desktop.
Save benesch/48ac40e76179ec7f71c58c6360f9c391 to your computer and use it in GitHub Desktop.
diff --git a/src/terminal.c b/src/terminal.c
index 9c74fcd..cc0169e 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -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)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment