sources/interface.cpp

branch
experimental
changeset 40
cf85b5f77541
parent 39
052393cf9016
child 41
9ab869656b9e
equal deleted inserted replaced
39:052393cf9016 40:cf85b5f77541
717 case KEY_NPAGE: 717 case KEY_NPAGE:
718 g_outputScroll -= min (g_pageSize, LINES / 2); 718 g_outputScroll -= min (g_pageSize, LINES / 2);
719 g_needOutputRender = true; 719 g_needOutputRender = true;
720 break; 720 break;
721 721
722 case '\t':
723 {
724 int space = current_input().find (" ");
725
726 if (g_inputState == INPUTSTATE_NORMAL
727 and g_cursor > 0
728 and (space == -1 or space >= g_cursor))
729 {
730 RCONSession::get_session()->request_tab_complete (current_input().mid (0, g_cursor));
731 }
732 }
733 break;
734
735 case '\n': 722 case '\n':
736 case KEY_ENTER: 723 case KEY_ENTER:
737 switch (g_inputState) 724 switch (g_inputState)
738 { 725 {
739 case INPUTSTATE_CONFIRM_DISCONNECTION: 726 case INPUTSTATE_CONFIRM_DISCONNECTION:
779 case 'N' - 'A' + 1: // ^N 766 case 'N' - 'A' + 1: // ^N
780 if (g_inputState == INPUTSTATE_NORMAL) 767 if (g_inputState == INPUTSTATE_NORMAL)
781 safe_disconnect ([]() {set_input_state (INPUTSTATE_ADDRESS);}); 768 safe_disconnect ([]() {set_input_state (INPUTSTATE_ADDRESS);});
782 break; 769 break;
783 } 770 }
784
785 render();
786 } 771 }
787 772
788 // ------------------------------------------------------------------------------------------------- 773 // -------------------------------------------------------------------------------------------------
789 // 774 //
790 FUNCTION 775 FUNCTION
939 if (length() % cols != 0) 924 if (length() % cols != 0)
940 rows++; 925 rows++;
941 926
942 return max (rows, 1); 927 return max (rows, 1);
943 } 928 }
944
945 // -------------------------------------------------------------------------------------------------
946 //
947 FUNCTION
948 Interface::tab_complete (const String& part, String complete) -> void
949 {
950 String& input = mutable_current_input();
951
952 if (input.starts_with (part))
953 {
954 if (input[part.length()] != ' ')
955 complete += ' ';
956
957 input.replace (0, part.length(), complete);
958 g_cursor = complete.length();
959 g_needInputRender = true;
960 }
961 }

mercurial