mirror of
https://github.com/chylex/IntelliJ-IdeaVim.git
synced 2025-03-06 09:32:50 +01:00
Merge pull request #127 from vedran/master
Support end-of-line multi line percent match in visual mode
This commit is contained in:
commit
7bccc2fbdb
src/com/maddyhome/idea/vim/helper
test/org/jetbrains/plugins/ideavim/action
@ -239,6 +239,13 @@ public class SearchHelper {
|
||||
|
||||
int line = caret.getLogicalPosition().line;
|
||||
int end = EditorHelper.getLineEndOffset(editor, line, true);
|
||||
|
||||
// To handle the case where visual mode allows the user to go past the end of the line,
|
||||
// which will prevent loc from finding a pairable character below
|
||||
if(pos > 0 && pos == end) {
|
||||
pos = end - 1;
|
||||
}
|
||||
|
||||
CharSequence chars = editor.getDocument().getCharsSequence();
|
||||
int loc = -1;
|
||||
// Search the remainder of the current line for one of the candidate characters
|
||||
|
@ -791,6 +791,22 @@ public class MotionActionTest extends VimTestCase {
|
||||
assertOffset(3);
|
||||
}
|
||||
|
||||
// |%|
|
||||
public void testPercentVisualModeMatchMultiLineEndOfLine() {
|
||||
typeTextInFile(parseKeys("v$%"),
|
||||
"foo(\n" +
|
||||
")");
|
||||
assertOffset(5);
|
||||
}
|
||||
|
||||
// |%|
|
||||
public void testPercentVisualModeMatchFromStartMultiLineEndOfLine() {
|
||||
typeTextInFile(parseKeys("v$%"),
|
||||
"(\n" +
|
||||
")");
|
||||
assertOffset(2);
|
||||
}
|
||||
|
||||
// |%|
|
||||
public void testPercentMatchParensInString() {
|
||||
typeTextInFile(parseKeys("%"),
|
||||
|
Loading…
Reference in New Issue
Block a user