715 |
715 |
716 case KEY_BACKSPACE: |
716 case KEY_BACKSPACE: |
717 case '\b': |
717 case '\b': |
718 if (m_cursorPosition > 0) |
718 if (m_cursorPosition > 0) |
719 { |
719 { |
720 getEditableInput().remove_at(--m_cursorPosition); |
720 getEditableInput().removeAt(--m_cursorPosition); |
721 m_needInputRender = true; |
721 m_needInputRender = true; |
722 } |
722 } |
723 break; |
723 break; |
724 |
724 |
725 case KEY_DC: |
725 case KEY_DC: |
726 case 'D' - 'A' + 1: // readline ^D |
726 case 'D' - 'A' + 1: // readline ^D |
727 if (m_cursorPosition < getCurrentInput().length()) |
727 if (m_cursorPosition < getCurrentInput().length()) |
728 { |
728 { |
729 getEditableInput().remove_at(m_cursorPosition); |
729 getEditableInput().removeAt(m_cursorPosition); |
730 m_needInputRender = true; |
730 m_needInputRender = true; |
731 } |
731 } |
732 break; |
732 break; |
733 |
733 |
734 case KEY_PPAGE: |
734 case KEY_PPAGE: |
756 case 'W' - 'A' + 1: // readline ^W - delete from previous word bounary to current |
756 case 'W' - 'A' + 1: // readline ^W - delete from previous word bounary to current |
757 yank(findPreviousWord(), m_cursorPosition); |
757 yank(findPreviousWord(), m_cursorPosition); |
758 break; |
758 break; |
759 |
759 |
760 case 'Y' - 'A' + 1: // readline ^Y - paste previously deleted text |
760 case 'Y' - 'A' + 1: // readline ^Y - paste previously deleted text |
761 if (not m_pasteBuffer.is_empty()) |
761 if (not m_pasteBuffer.isEmpty()) |
762 { |
762 { |
763 getEditableInput().insert(m_cursorPosition, m_pasteBuffer); |
763 getEditableInput().insert(m_cursorPosition, m_pasteBuffer); |
764 m_cursorPosition += m_pasteBuffer.length(); |
764 m_cursorPosition += m_pasteBuffer.length(); |
765 m_needInputRender = true; |
765 m_needInputRender = true; |
766 } |
766 } |
804 |
804 |
805 setInputState(INPUTSTATE_PASSWORD); |
805 setInputState(INPUTSTATE_PASSWORD); |
806 break; |
806 break; |
807 |
807 |
808 case INPUTSTATE_PASSWORD: |
808 case INPUTSTATE_PASSWORD: |
809 if (m_inputState == INPUTSTATE_PASSWORD and not getCurrentInput().is_empty()) |
809 if (m_inputState == INPUTSTATE_PASSWORD and not getCurrentInput().isEmpty()) |
810 { |
810 { |
811 m_session.disconnect(); |
811 m_session.disconnect(); |
812 m_session.set_password(getCurrentInput()); |
812 m_session.set_password(getCurrentInput()); |
813 m_session.connect(m_remoteAddress); |
813 m_session.connect(m_remoteAddress); |
814 setInputState(INPUTSTATE_NORMAL); |
814 setInputState(INPUTSTATE_NORMAL); |
1032 // |
1032 // |
1033 void Interface::tabComplete(const String& part, String complete) |
1033 void Interface::tabComplete(const String& part, String complete) |
1034 { |
1034 { |
1035 String& input = getEditableInput(); |
1035 String& input = getEditableInput(); |
1036 |
1036 |
1037 if (input.starts_with(part)) |
1037 if (input.startsWith(part)) |
1038 { |
1038 { |
1039 if (input[part.length()] != ' ') |
1039 if (input[part.length()] != ' ') |
1040 complete += ' '; |
1040 complete += ' '; |
1041 |
1041 |
1042 input.replace(0, part.length(), complete); |
1042 input.replace(0, part.length(), complete); |