mirror of
https://github.com/chylex/IntelliJ-IdeaVim.git
synced 2025-03-01 04:46:02 +01:00
Fix search with offset
This commit is contained in:
parent
860592291f
commit
ac69c0d9c6
src
main/java/com/maddyhome/idea/vim/group
test/java/org/jetbrains/plugins/ideavim/group
@ -288,15 +288,20 @@ public class SearchGroup extends VimSearchGroupBase implements PersistentStateCo
|
||||
|
||||
if (logger.isDebugEnabled()) logger.debug("pattern=" + pattern);
|
||||
|
||||
if (p.charAt() != type) {
|
||||
logger.debug("no offset");
|
||||
patternOffset = "";
|
||||
}
|
||||
else {
|
||||
if (p.charAt() == type) {
|
||||
p.inc();
|
||||
patternOffset = p.toString();
|
||||
if (logger.isDebugEnabled()) logger.debug("offset=" + patternOffset);
|
||||
}
|
||||
if (end.charAt(0) == type) {
|
||||
end.inc();
|
||||
patternOffset = end.toString();
|
||||
if (logger.isDebugEnabled()) logger.debug("Pattern contains offset " + patternOffset);
|
||||
}
|
||||
else {
|
||||
logger.debug("no offset");
|
||||
patternOffset = "";
|
||||
}
|
||||
}
|
||||
else if (command.length() == 1) {
|
||||
patternOffset = "";
|
||||
|
@ -194,6 +194,14 @@ class SearchGroupTest : VimTestCase() {
|
||||
assertOffset(6)
|
||||
}
|
||||
|
||||
fun `test search e-1 motion offset`() {
|
||||
doTest(
|
||||
"/two/e-1<Enter>",
|
||||
"${c}one two three",
|
||||
"one t${c}wo three",
|
||||
)
|
||||
}
|
||||
|
||||
// |/pattern/e|
|
||||
fun `test search e+2 motion offset`() {
|
||||
typeTextInFile(
|
||||
|
Loading…
Reference in New Issue
Block a user