sources/interface.cpp

changeset 55
79e5460a8a56
parent 54
e20e306c886d
child 58
d175243ad169
equal deleted inserted replaced
54:e20e306c886d 55:79e5460a8a56
627 } 627 }
628 628
629 // ------------------------------------------------------------------------------------------------- 629 // -------------------------------------------------------------------------------------------------
630 // 630 //
631 static FUNCTION 631 static FUNCTION
632 interface_yank_and_delete (int a, int b) -> void 632 yank (int a, int b) -> void
633 { 633 {
634 if (a >= b) 634 if (a >= b)
635 return; 635 return;
636 636
637 if (g_cursor > a and g_cursor <= b) 637 if (g_cursor > a and g_cursor <= b)
779 break; 779 break;
780 780
781 case 'U' - 'A' + 1: // readline ^U - delete from start to cursor 781 case 'U' - 'A' + 1: // readline ^U - delete from start to cursor
782 if (g_cursor > 0) 782 if (g_cursor > 0)
783 { 783 {
784 interface_yank_and_delete (0, g_cursor); 784 yank (0, g_cursor);
785 g_cursor = 0; 785 g_cursor = 0;
786 } 786 }
787 break; 787 break;
788 788
789 case 'K' - 'A' + 1: // readline ^K - delete from cursor to end 789 case 'K' - 'A' + 1: // readline ^K - delete from cursor to end
790 interface_yank_and_delete (g_cursor, mutable_current_input().length()); 790 yank (g_cursor, mutable_current_input().length());
791 break; 791 break;
792 792
793 case 'W' - 'A' + 1: // readline ^W - delete from previous word bounary to current 793 case 'W' - 'A' + 1: // readline ^W - delete from previous word bounary to current
794 interface_yank_and_delete (interface_find_previous_word(), g_cursor); 794 yank (interface_find_previous_word(), g_cursor);
795 break; 795 break;
796 796
797 case 'Y' - 'A' + 1: // readline ^Y - paste previously deleted text 797 case 'Y' - 'A' + 1: // readline ^Y - paste previously deleted text
798 if (not g_pasteBuffer.is_empty()) 798 if (not g_pasteBuffer.is_empty())
799 { 799 {
875 break; 875 break;
876 876
877 case 'd': 877 case 'd':
878 case 'D': 878 case 'D':
879 // readline alt-d - delete from here till next word boundary 879 // readline alt-d - delete from here till next word boundary
880 interface_yank_and_delete (g_cursor, interface_find_next_word()); 880 yank (g_cursor, interface_find_next_word());
881 break; 881 break;
882 } 882 }
883 } 883 }
884 else 884 else
885 { 885 {

mercurial