Permalink
Browse files

Fix inclusivity of f/F/t/T motions.

  • Loading branch information...
1 parent 5bdc292 commit 3b3d30f3f1cf9ed5c095514a6505018b18648559 @georgebrock georgebrock committed Dec 11, 2012
Showing with 18 additions and 3 deletions.
  1. +2 −2 js/normal_mode/line_search.js
  2. +16 −1 tests/acceptance/change.js
@@ -17,7 +17,7 @@
}
});
- untilForwards = CR.captureExclusive(function (vim, count, chr, repeat) {
+ untilForwards = CR.captureInclusive(function (vim, count, chr, repeat) {
if (vim.currentLine().charAt(vim.cursor.col + 1) === chr) {
if (repeat && count === 1) {
count += 1;
@@ -30,7 +30,7 @@
}
});
- findBackwards = CR.captureInclusive(function (vim, count, chr) {
+ findBackwards = CR.captureExclusive(function (vim, count, chr) {
var found, position;
found = -1;
View
@@ -166,14 +166,16 @@ describe("The change operator c", function () {
});
});
- describe("with the f command", function () {
+ describe("with the f and F searches", function () {
beforeEach(function () {
reset("Lots of Os on one row");
});
it("changes up to and including the match", function () {
pressKeys("cft" + "Bag" + ESC);
expect(currentText()).toBe("Bags of Os on one row");
+ pressKeys("ecFB" + "Stack" + ESC);
+ expect(currentText()).toBe("Stacks of Os on one row");
});
it("accepts numerical multipliers", function () {
@@ -192,6 +194,19 @@ describe("The change operator c", function () {
});
});
+ describe("with t and T searches", function () {
+ beforeEach(function () {
+ reset("Hello world");
+ });
+
+ it("changes up to the searched character", function () {
+ pressKeys("ctw" + "Under" + ESC);
+ expect(currentText()).toBe("Underworld");
+ pressKeys("$c2Tr" + "groun" + ESC);
+ expect(currentText()).toBe("Underground");
+ });
+ });
+
describe("with line motions", function () {
beforeEach(function () {
reset("First\nSecond\nThird\nFourth");

0 comments on commit 3b3d30f

Please sign in to comment.