diff options
| author | 2015-11-10 15:36:36 +0100 | |
|---|---|---|
| committer | 2015-11-10 15:36:36 +0100 | |
| commit | 21bd02fdc6c369c2ff382052522f385d6ba34a2f (patch) | |
| tree | 063d07d24cabeed7b4a6cda0e066c859095b5362 /src | |
| parent | Change the who command help doc title to lowercase. (diff) | |
| download | KVIrc-21bd02fdc6c369c2ff382052522f385d6ba34a2f.tar.gz KVIrc-21bd02fdc6c369c2ff382052522f385d6ba34a2f.tar.bz2 KVIrc-21bd02fdc6c369c2ff382052522f385d6ba34a2f.zip | |
Fix all quirks found in KviInputEditor related to cursor positioning after deselecting text.
Fixes #1738.
Diffstat (limited to 'src')
| -rw-r--r-- | src/kvirc/ui/KviInputEditor.cpp | 37 |
1 files changed, 26 insertions, 11 deletions
diff --git a/src/kvirc/ui/KviInputEditor.cpp b/src/kvirc/ui/KviInputEditor.cpp index c22a1668e..fd7c14e05 100644 --- a/src/kvirc/ui/KviInputEditor.cpp +++ b/src/kvirc/ui/KviInputEditor.cpp @@ -1720,7 +1720,10 @@ void KviInputEditor::focusOutEvent(QFocusEvent *) void KviInputEditor::internalCursorRight(bool bShift) { - if(m_iCursorPosition >= ((int)(m_szTextBuffer.length()))) return; + if(m_iCursorPosition >= ((int)(m_szTextBuffer.length()))) { + selectOneChar(-1); + return; + } moveRightFirstVisibleCharToShowCursor(); //Grow the selection if needed if(bShift) @@ -1731,13 +1734,22 @@ void KviInputEditor::internalCursorRight(bool bShift) else if(m_iSelectionBegin == m_iCursorPosition)m_iSelectionBegin++; else selectOneChar(m_iCursorPosition); } else selectOneChar(m_iCursorPosition); - } else selectOneChar(-1); - m_iCursorPosition++; + m_iCursorPosition++; + } else { + if((m_iSelectionBegin > -1) && (m_iSelectionEnd > -1)) + m_iCursorPosition = m_iSelectionEnd + 1; + else + m_iCursorPosition++; + selectOneChar(-1); + } } void KviInputEditor::internalCursorLeft(bool bShift) { - if(m_iCursorPosition <= 0) return; + if(m_iCursorPosition <= 0) { + selectOneChar(-1); + return; + } if(bShift) { @@ -1749,9 +1761,15 @@ void KviInputEditor::internalCursorLeft(bool bShift) m_iSelectionEnd--; else selectOneChar(m_iCursorPosition - 1); } else selectOneChar(m_iCursorPosition - 1); - } else selectOneChar(-1); + m_iCursorPosition--; + } else { + if((m_iSelectionBegin > -1) && (m_iSelectionEnd > -1)) + m_iCursorPosition = m_iSelectionBegin; + else + m_iCursorPosition--; + selectOneChar(-1); + } - m_iCursorPosition--; if(m_iFirstVisibleChar > m_iCursorPosition) m_iFirstVisibleChar--; } @@ -2567,11 +2585,8 @@ void KviInputEditor::previousChar() void KviInputEditor::nextChar() { - if(m_iCursorPosition < ((int)(m_szTextBuffer.length()))) - { - internalCursorRight(false); - repaintWithCursorOn(); - } + internalCursorRight(false); + repaintWithCursorOn(); } void KviInputEditor::previousCharSelection() |
