File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -760,6 +760,29 @@ static void onEscapedInput(EmbeddedCli *cli, char c) {
760760 impl -> cursorPos ++ ;
761761 writeToOutput (cli , escSeqCursorLeft );
762762 }
763+
764+ // Home
765+ if (c == 'H' || (c == '~' && (impl -> lastChar == '1' || impl -> lastChar == '7' ))) {
766+ if (impl -> cursorPos < impl -> cmdSize ) {
767+ moveCursor (cli , impl -> cmdSize - impl -> cursorPos , CURSOR_DIRECTION_BACKWARD );
768+ impl -> cursorPos = impl -> cmdSize ;
769+ }
770+ }
771+ // End
772+ if (c == 'F' || (c == '~' && (impl -> lastChar == '4' || impl -> lastChar == '8' ))) {
773+ if (impl -> cursorPos > 0 ) {
774+ moveCursor (cli , impl -> cursorPos , CURSOR_DIRECTION_FORWARD );
775+ impl -> cursorPos = 0 ;
776+ }
777+ }
778+ // Delete
779+ if (c == '~' && impl -> lastChar == '3' && impl -> cursorPos > 0 ) {
780+ size_t insertPos = strlen (impl -> cmdBuffer ) - impl -> cursorPos ;
781+ memmove (& impl -> cmdBuffer [insertPos ], & impl -> cmdBuffer [insertPos + 1 ], impl -> cursorPos );
782+ -- impl -> cmdSize ;
783+ -- impl -> cursorPos ;
784+ writeToOutput (cli , escSeqDeleteChar );
785+ }
763786 }
764787}
765788
You can’t perform that action at this time.
0 commit comments