Browse Source

vim-mode: fix % behovior in d/c command

Le Tan 8 years ago
parent
commit
2bdad19253
1 changed files with 9 additions and 1 deletions
  1. 9 1
      src/utils/vvim.cpp

+ 9 - 1
src/utils/vvim.cpp

@@ -3346,13 +3346,21 @@ handle_target:
                 second = tmp;
             }
 
-            --second;
+            if (!(checkMode(VimMode::Normal) && p_moveMode == QTextCursor::KeepAnchor)) {
+                --second;
+            }
 
             int target = first;
             if (first == pairPosition) {
                 target = second;
             }
 
+            if (anchor > target
+                && !p_cursor.atEnd()
+                && !useLeftSideOfCursor(p_cursor)) {
+                ++anchor;
+            }
+
             p_cursor.setPosition(anchor);
             p_cursor.setPosition(target, p_moveMode);