From d01cd475b51965ee19e408ea57f9242d76e23201 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh <orgad.shaneh@audiocodes.com> Date: Thu, 20 Dec 2012 22:21:52 +0200 Subject: [PATCH] BinEditor: update correct lines when selection becomes empty... and when selecting multiple lines at once Place the cursor somewhere in the middle, shift+down, shift+up Change-Id: Iacfab3c16f30c21116f47c65e4a6977597393de2 Reviewed-by: hjk <qthjk@ovi.com> --- src/plugins/bineditor/bineditor.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/plugins/bineditor/bineditor.cpp b/src/plugins/bineditor/bineditor.cpp index 1f16fab7b88..2695bf0c903 100644 --- a/src/plugins/bineditor/bineditor.cpp +++ b/src/plugins/bineditor/bineditor.cpp @@ -940,19 +940,18 @@ void BinEditor::setCursorPosition(int pos, MoveMode moveMode) pos = qMin(m_size-1, qMax(0, pos)); int oldCursorPosition = m_cursorPosition; - bool hasSelection = m_anchorPosition != m_cursorPosition; + bool hadSelection = hasSelection(); m_lowNibble = false; - if (!hasSelection) + if (!hadSelection) updateLines(); m_cursorPosition = pos; if (moveMode == MoveAnchor) { - if (hasSelection) + if (hadSelection) updateLines(m_anchorPosition, oldCursorPosition); m_anchorPosition = m_cursorPosition; } - hasSelection = m_anchorPosition != m_cursorPosition; - updateLines(hasSelection ? oldCursorPosition : m_cursorPosition, m_cursorPosition); + updateLines(hadSelection || hasSelection() ? oldCursorPosition : m_cursorPosition, m_cursorPosition); ensureCursorVisible(); emit cursorPositionChanged(m_cursorPosition); } -- GitLab