From: sln Date: Fri, 25 May 2007 12:18:15 +0000 (+0000) Subject: Bug NPAL16035: Pb with the history list of salome (GUI) X-Git-Tag: T15881~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ec3b1baf5c369b9e60b3bcaf4c8fa40f8faa3642;p=modules%2Fgui.git Bug NPAL16035: Pb with the history list of salome (GUI) Case when two long commands are executed consequently fixed --- diff --git a/src/PythonConsole/PythonConsole_PyEditor.cxx b/src/PythonConsole/PythonConsole_PyEditor.cxx index 6de0f03c8..baa34cac9 100755 --- a/src/PythonConsole/PythonConsole_PyEditor.cxx +++ b/src/PythonConsole/PythonConsole_PyEditor.cxx @@ -812,13 +812,26 @@ void PythonConsole_PyEditor::scrollViewAfterHistoryUsing( const QString& command { if ( !command.isEmpty() ) { + if ( command == QString( BEGIN_HISTORY_PY ) ) + { + ensureCursorVisible(); + return; + } + int aCommandLength = QFontMetrics( currentFont() ).width( command ); int aVisibleWidth = visibleWidth(); - if ( aCommandLength < aVisibleWidth ) + QScrollBar* aBar = horizontalScrollBar(); + if ( aBar ) { - QScrollBar* aBar = horizontalScrollBar(); - if ( aBar ) + if ( aCommandLength <= aVisibleWidth ) aBar->setValue( aBar->minValue() ); + else if ( aVisibleWidth > 0 ) + { + double aRatio = aCommandLength / contentsWidth(); + double aPos = ( aBar->maxValue() - aBar->minValue() ) * aRatio; + aBar->setValue( (int)aPos ); + ensureCursorVisible(); + } } } }