diff --git a/krusader/KViewer/lister.h b/krusader/KViewer/lister.h --- a/krusader/KViewer/lister.h +++ b/krusader/KViewer/lister.h @@ -119,6 +119,7 @@ void slotActionTriggered(int action); void slotCursorPositionChanged(); void blinkCursor(); + void stopCursorBlinking(); void zoomIn(int range = 1); void zoomOut(int range = 1); @@ -150,7 +151,7 @@ int _skippedLines; bool _inSliderOp; - bool _inCursorUpdate; + bool _enableCursorBlinking = true; bool _hexMode; bool _cursorState = false; diff --git a/krusader/KViewer/lister.cpp b/krusader/KViewer/lister.cpp --- a/krusader/KViewer/lister.cpp +++ b/krusader/KViewer/lister.cpp @@ -80,7 +80,7 @@ #define CACHE_SIZE 100000 ListerTextArea::ListerTextArea(Lister *lister, QWidget *parent) : KTextEdit(parent), _lister(lister), - _sizeX(-1), _sizeY(-1), _cursorAnchorPos(-1), _inSliderOp(false), _inCursorUpdate(false), _hexMode(false) + _sizeX(-1), _sizeY(-1), _cursorAnchorPos(-1), _inSliderOp(false), _hexMode(false) { connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(slotCursorPositionChanged())); _tabWidth = 4; @@ -99,13 +99,20 @@ void ListerTextArea::blinkCursor() { - if (_inCursorUpdate) { + if (!_enableCursorBlinking) { return; } _cursorState = !_cursorState; setCursorWidth(_cursorState ? 2 : 0); } +void ListerTextArea::stopCursorBlinking() +{ + _enableCursorBlinking = false; + _cursorState = false; + setCursorWidth(0); +} + void ListerTextArea::reset() { _screenStartPos = 0; @@ -277,11 +284,10 @@ void ListerTextArea::setCursorPosition(int x, int y, int anchorX, int anchorY) { - _inCursorUpdate = true; + stopCursorBlinking(); + if (x == -1 || y < 0) { - setCursorWidth(0); if (anchorY == -1) { - _inCursorUpdate = false; return; } @@ -327,7 +333,7 @@ for (int j = 0; j < x; j++) moveCursor(QTextCursor::Right, mode); - _inCursorUpdate = false; + _enableCursorBlinking = true; } qint64 ListerTextArea::getCursorPosition(bool &isfirst) @@ -374,7 +380,7 @@ void ListerTextArea::slotCursorPositionChanged() { - if (_inCursorUpdate) + if (!_enableCursorBlinking) return; int cursorX, cursorY; getCursorPosition(cursorX, cursorY); @@ -754,6 +760,8 @@ return; } + stopCursorBlinking(); + if (delta > 0) { e->accept(); while (delta > 0) {