sources/interface.cpp

branch
experimental
changeset 38
80b26bc9707a
parent 34
3caf69e7350b
child 39
052393cf9016
equal deleted inserted replaced
37:083e493fa1fd 38:80b26bc9707a
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, const String& complete) -> void
949 {
950 String& input = mutable_current_input();
951
952 if (input.starts_with (part))
953 {
954 input.replace (0, part.length(), complete);
955 g_cursor = complete.length();
956 g_needInputRender = true;
957 }
958 }

mercurial