+ break;
+ }
+ case Key_Home:
+ // <Home> key: process as follows:
+ // - without <Ctrl>, <Shift> modifiers: move cursor to the beginning of the current line without selection
+ // - with <Ctrl> modifier key pressed: move cursor to the very first symbol without selection
+ // - with <Shift> modifier key pressed: move cursor to the beginning of the current line with selection
+ // - with <Ctrl>+<Shift> modifier keys pressed: move cursor to the very first symbol with selection
+ {
+ if ( ctrlPressed ) {
+ moveCursor( QTextEdit::MoveHome, shftPressed );
+ }
+ else {
+ if ( isCommand( text( curLine ) ) ) {
+ int ps1, ps2, cs1, cs2;
+ bool hasSelection = hasSelectedText();
+ if ( hasSelection )
+ getSelection( &ps1, &cs1, &ps2, &cs2 );
+ removeSelection();
+ horizontalScrollBar()->setValue( horizontalScrollBar()->minValue() );
+ if ( curCol > PROMPT_SIZE && shftPressed )
+ setSelection( curLine, PROMPT_SIZE, curLine, ( hasSelection && ps1 == ps2 && ps1 == curLine && cs2 > PROMPT_SIZE ) ? cs2 : curCol );
+ setCursorPosition( curLine, PROMPT_SIZE );
+ }
+ else {
+ moveCursor( QTextEdit::MoveLineStart, shftPressed );
+ }
+ }
+ break;
+ }
+ case Key_End:
+ // <End> key: process as follows:
+ // - without <Ctrl>, <Shift> modifiers: move cursor to the end of the current line without selection
+ // - with <Ctrl> modifier key pressed: move cursor to the very last symbol without selection
+ // - with <Shift> modifier key pressed: move cursor to the end of the current line with selection
+ // - with <Ctrl>+<Shift> modifier keys pressed: move cursor to the very last symbol with selection
+ {
+ if ( ctrlPressed ) {
+ moveCursor( QTextEdit::MoveEnd, shftPressed );