sources/interface.cpp

branch
experimental
changeset 41
9ab869656b9e
parent 40
cf85b5f77541
child 71
4f7c2c944637
equal deleted inserted replaced
40:cf85b5f77541 41:9ab869656b9e
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
722 case '\n': 735 case '\n':
723 case KEY_ENTER: 736 case KEY_ENTER:
724 switch (g_inputState) 737 switch (g_inputState)
725 { 738 {
726 case INPUTSTATE_CONFIRM_DISCONNECTION: 739 case INPUTSTATE_CONFIRM_DISCONNECTION:
766 case 'N' - 'A' + 1: // ^N 779 case 'N' - 'A' + 1: // ^N
767 if (g_inputState == INPUTSTATE_NORMAL) 780 if (g_inputState == INPUTSTATE_NORMAL)
768 safe_disconnect ([]() {set_input_state (INPUTSTATE_ADDRESS);}); 781 safe_disconnect ([]() {set_input_state (INPUTSTATE_ADDRESS);});
769 break; 782 break;
770 } 783 }
784
785 render();
771 } 786 }
772 787
773 // ------------------------------------------------------------------------------------------------- 788 // -------------------------------------------------------------------------------------------------
774 // 789 //
775 FUNCTION 790 FUNCTION
924 if (length() % cols != 0) 939 if (length() % cols != 0)
925 rows++; 940 rows++;
926 941
927 return max (rows, 1); 942 return max (rows, 1);
928 } 943 }
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