diff options
| author | Ron Yorston <rmy@pobox.com> | 2016-04-26 16:19:06 +0100 |
|---|---|---|
| committer | Ron Yorston <rmy@pobox.com> | 2016-04-26 16:19:06 +0100 |
| commit | b66e6daaddddd696a802349bbec1eb29add35b03 (patch) | |
| tree | 962f1a53eb2594b9f77f5d3af1fe9ad3dff4ee76 | |
| parent | ca947374282755978a257e50f3ab8cc35080a529 (diff) | |
| download | busybox-w32-b66e6daaddddd696a802349bbec1eb29add35b03.tar.gz busybox-w32-b66e6daaddddd696a802349bbec1eb29add35b03.tar.bz2 busybox-w32-b66e6daaddddd696a802349bbec1eb29add35b03.zip | |
libbb/lineedit: revert last two commits
We had a better idea.
| -rw-r--r-- | libbb/lineedit.c | 27 |
1 files changed, 1 insertions, 26 deletions
diff --git a/libbb/lineedit.c b/libbb/lineedit.c index 7cd6ff0ce..04361b509 100644 --- a/libbb/lineedit.c +++ b/libbb/lineedit.c | |||
| @@ -110,7 +110,7 @@ static bool BB_ispunct(CHAR_T c) { return ((unsigned)c < 256 && ispunct(c)); } | |||
| 110 | #define ESC "\033" | 110 | #define ESC "\033" |
| 111 | 111 | ||
| 112 | #define SEQ_CLEAR_TILL_END_OF_SCREEN ESC"[J" | 112 | #define SEQ_CLEAR_TILL_END_OF_SCREEN ESC"[J" |
| 113 | #define SEQ_CLEAR_TILL_END_OF_LINE ESC"[K" | 113 | //#define SEQ_CLEAR_TILL_END_OF_LINE ESC"[K" |
| 114 | 114 | ||
| 115 | 115 | ||
| 116 | enum { | 116 | enum { |
| @@ -568,7 +568,6 @@ static void input_backward(unsigned num) | |||
| 568 | } | 568 | } |
| 569 | 569 | ||
| 570 | /* draw prompt, editor line, and clear tail */ | 570 | /* draw prompt, editor line, and clear tail */ |
| 571 | #if !ENABLE_PLATFORM_MINGW32 | ||
| 572 | static void redraw(int y, int back_cursor) | 571 | static void redraw(int y, int back_cursor) |
| 573 | { | 572 | { |
| 574 | if (y > 0) /* up y lines */ | 573 | if (y > 0) /* up y lines */ |
| @@ -579,22 +578,6 @@ static void redraw(int y, int back_cursor) | |||
| 579 | printf(SEQ_CLEAR_TILL_END_OF_SCREEN); | 578 | printf(SEQ_CLEAR_TILL_END_OF_SCREEN); |
| 580 | input_backward(back_cursor); | 579 | input_backward(back_cursor); |
| 581 | } | 580 | } |
| 582 | #else | ||
| 583 | static void mingw_redraw(int y, int back_cursor, int clear_screen) | ||
| 584 | { | ||
| 585 | if (y > 0) /* up y lines */ | ||
| 586 | printf(ESC"[%uA", y); | ||
| 587 | bb_putchar('\r'); | ||
| 588 | put_prompt(); | ||
| 589 | put_till_end_and_adv_cursor(); | ||
| 590 | printf(clear_screen ? | ||
| 591 | SEQ_CLEAR_TILL_END_OF_SCREEN : SEQ_CLEAR_TILL_END_OF_LINE); | ||
| 592 | input_backward(back_cursor); | ||
| 593 | } | ||
| 594 | |||
| 595 | #define redraw(y, bc) mingw_redraw(y, bc, FALSE) | ||
| 596 | #define redraw_and_clear_screen(y, bc) mingw_redraw(y, bc, TRUE) | ||
| 597 | #endif | ||
| 598 | 581 | ||
| 599 | /* Delete the char in front of the cursor, optionally saving it | 582 | /* Delete the char in front of the cursor, optionally saving it |
| 600 | * for later putback */ | 583 | * for later putback */ |
| @@ -628,11 +611,7 @@ static void input_delete(int save) | |||
| 628 | command_len--; | 611 | command_len--; |
| 629 | put_till_end_and_adv_cursor(); | 612 | put_till_end_and_adv_cursor(); |
| 630 | /* Last char is still visible, erase it (and more) */ | 613 | /* Last char is still visible, erase it (and more) */ |
| 631 | #if !ENABLE_PLATFORM_MINGW32 | ||
| 632 | printf(SEQ_CLEAR_TILL_END_OF_SCREEN); | 614 | printf(SEQ_CLEAR_TILL_END_OF_SCREEN); |
| 633 | #else | ||
| 634 | printf(SEQ_CLEAR_TILL_END_OF_LINE); | ||
| 635 | #endif | ||
| 636 | input_backward(cursor - j); /* back to old pos cursor */ | 615 | input_backward(cursor - j); /* back to old pos cursor */ |
| 637 | } | 616 | } |
| 638 | 617 | ||
| @@ -2532,11 +2511,7 @@ int FAST_FUNC read_line_input(line_input_t *st, const char *prompt, char *comman | |||
| 2532 | vi_case(CTRL('L')|VI_CMDMODE_BIT:) | 2511 | vi_case(CTRL('L')|VI_CMDMODE_BIT:) |
| 2533 | /* Control-l -- clear screen */ | 2512 | /* Control-l -- clear screen */ |
| 2534 | printf(ESC"[H"); /* cursor to top,left */ | 2513 | printf(ESC"[H"); /* cursor to top,left */ |
| 2535 | #if !ENABLE_PLATFORM_MINGW32 | ||
| 2536 | redraw(0, command_len - cursor); | 2514 | redraw(0, command_len - cursor); |
| 2537 | #else | ||
| 2538 | redraw_and_clear_screen(0, command_len - cursor); | ||
| 2539 | #endif | ||
| 2540 | break; | 2515 | break; |
| 2541 | #if MAX_HISTORY > 0 | 2516 | #if MAX_HISTORY > 0 |
| 2542 | case CTRL('N'): | 2517 | case CTRL('N'): |
