655 else if (g_inputState == INPUTSTATE_ADDRESS) |
655 else if (g_inputState == INPUTSTATE_ADDRESS) |
656 set_input_state (INPUTSTATE_NORMAL); |
656 set_input_state (INPUTSTATE_NORMAL); |
657 break; |
657 break; |
658 |
658 |
659 case KEY_LEFT: |
659 case KEY_LEFT: |
|
660 case 'B' - 'A' + 1: // readline ^B |
660 if (g_cursor > 0) |
661 if (g_cursor > 0) |
661 { |
662 { |
662 g_cursor--; |
663 g_cursor--; |
663 g_needInputRender = true; |
664 g_needInputRender = true; |
664 } |
665 } |
665 break; |
666 break; |
666 |
667 |
667 case KEY_RIGHT: |
668 case KEY_RIGHT: |
|
669 case 'F' - 'A' + 1: // readline ^F |
668 if (g_cursor < current_input().length()) |
670 if (g_cursor < current_input().length()) |
669 { |
671 { |
670 g_cursor++; |
672 g_cursor++; |
671 g_needInputRender = true; |
673 g_needInputRender = true; |
672 } |
674 } |
676 case KEY_UP: |
678 case KEY_UP: |
677 move_input_cursor (ch == KEY_DOWN ? -1 : 1); |
679 move_input_cursor (ch == KEY_DOWN ? -1 : 1); |
678 break; |
680 break; |
679 |
681 |
680 case KEY_HOME: |
682 case KEY_HOME: |
|
683 case 'A' - 'A' + 1: // readline ^A |
681 if (g_cursor != 0) |
684 if (g_cursor != 0) |
682 { |
685 { |
683 g_cursor = 0; |
686 g_cursor = 0; |
684 g_needInputRender = true; |
687 g_needInputRender = true; |
685 } |
688 } |
686 break; |
689 break; |
687 |
690 |
688 case KEY_END: |
691 case KEY_END: |
|
692 case 'E' - 'A' + 1: // readline ^E |
689 if (g_cursor != current_input().length()) |
693 if (g_cursor != current_input().length()) |
690 { |
694 { |
691 g_cursor = current_input().length(); |
695 g_cursor = current_input().length(); |
692 g_needInputRender = true; |
696 g_needInputRender = true; |
693 } |
697 } |
715 break; |
720 break; |
716 |
721 |
717 case KEY_NPAGE: |
722 case KEY_NPAGE: |
718 g_outputScroll -= min (g_pageSize, LINES / 2); |
723 g_outputScroll -= min (g_pageSize, LINES / 2); |
719 g_needOutputRender = true; |
724 g_needOutputRender = true; |
|
725 break; |
|
726 |
|
727 case 'U' - 'A' + 1: // readline ^U - delete from start to cursor |
|
728 if (g_cursor > 0) |
|
729 { |
|
730 mutable_current_input().remove (0, g_cursor); |
|
731 g_cursor = 0; |
|
732 g_needInputRender = true; |
|
733 } |
|
734 break; |
|
735 |
|
736 case 'K' - 'A' + 1: // readline ^K - delete from cursor to end |
|
737 if (g_cursor < current_input().length()) |
|
738 { |
|
739 String& input = mutable_current_input(); |
|
740 input.remove (g_cursor, input.length() - g_cursor); |
|
741 g_needInputRender = true; |
|
742 } |
720 break; |
743 break; |
721 |
744 |
722 case '\n': |
745 case '\n': |
723 case KEY_ENTER: |
746 case KEY_ENTER: |
724 switch (g_inputState) |
747 switch (g_inputState) |