Salome HOME
PR: retour au tag V1_2_1_debug2 (pb dans la branche de merge V1_2c)
[modules/kernel.git] / src / SALOMEGUI / QAD_PyEditor.cxx
index 4dd3aa333701ef2d3f0601943dcab112beaeb1f1..58407f6a054a28425b0c21e8841b987d805ede98 100644 (file)
@@ -278,17 +278,9 @@ void QAD_PyEditor::keyPressEvent( QKeyEvent *e )
       }
     case Key_Up:
       {
-       // if Cntr+Key_Up event then move cursor up
+       // if Cntr+Key_Up event then scroll the commands stack up
        if (ctrlPressed) {
-         QMultiLineEdit::cursorUp( );
-        }
-       // if Shift+Key_Up event then move cursor up and select the text
-       else if ( shftPressed && curLine > 0 ){
-          setCursorPosition(curLine-1, curCol, true);
-       }
-       // scroll the commands stack up
-       else { 
-          QString histLine = _currentPrompt;
+         QString histLine = _currentPrompt;
          if (! _isInHistory)
            {
              _isInHistory = true;
@@ -305,21 +297,19 @@ void QAD_PyEditor::keyPressEvent( QKeyEvent *e )
          endLine = numLines() -1;
          setCursorPosition(endLine, lineLength(endLine));
        }
+       // if Shift+Key_Up event then move cursor up and select the text
+       else if ( shftPressed && curLine > 0 ){
+          setCursorPosition(curLine-1, curCol, true);
+       }
+       // move cursor up
+       else { QMultiLineEdit::keyPressEvent( e ); }
        break;
       }
     case Key_Down:
       {
-       // if Cntr+Key_Down event then move cursor down
+       // if Cntr+Key_Down event then scroll the commands stack down
        if (ctrlPressed) {
-         QMultiLineEdit::cursorDown( );
-       }
-       // if Shift+Key_Down event then move cursor down and select the text
-       else if ( shftPressed && curLine < endLine ) {
-          setCursorPosition(curLine+1, curCol, true);
-       }
-       // scroll the commands stack down
-       else {
-       QString histLine = _currentPrompt;
+         QString histLine = _currentPrompt;
          QString nextCommand = _interp->getNext();
          if (nextCommand.compare(TOP_HISTORY_PY) != 0)
            {
@@ -338,6 +328,13 @@ void QAD_PyEditor::keyPressEvent( QKeyEvent *e )
          endLine = numLines() -1;
          setCursorPosition(endLine, lineLength(endLine));
        }
+       // if Shift+Key_Down event then move cursor down and select the text
+       else if ( shftPressed && curLine < endLine ) {
+          setCursorPosition(curLine+1, curCol, true);
+       }
+       //move cursor down
+       else { QMultiLineEdit::keyPressEvent( e ); }
+
        break;
       }
     case Key_Left: