forked from qt-creator/qt-creator
fakevim: Display visual block selection correctly
Change-Id: Id33544265c0266e0a43a811b5a00aa94dfcc4f37 Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
@@ -2056,10 +2056,18 @@ void FakeVimHandler::Private::exportSelection()
|
||||
m_oldInternalAnchor = anc;
|
||||
|
||||
if (isVisualMode()) {
|
||||
if (pos >= anc)
|
||||
setAnchorAndPosition(anc, pos + 1);
|
||||
else
|
||||
bool visualBlockInverted;
|
||||
if (m_visualMode == VisualBlockMode) {
|
||||
const int col1 = anc - document()->findBlock(anc).position();
|
||||
const int col2 = pos - document()->findBlock(pos).position();
|
||||
visualBlockInverted = col1 > col2;
|
||||
} else {
|
||||
visualBlockInverted = anc > pos;
|
||||
}
|
||||
if (visualBlockInverted)
|
||||
setAnchorAndPosition(anc + 1, pos);
|
||||
else
|
||||
setAnchorAndPosition(anc, pos + 1);
|
||||
|
||||
if (m_visualMode == VisualBlockMode) {
|
||||
emit q->requestSetBlockSelection(false);
|
||||
|
||||
Reference in New Issue
Block a user