Skip to content

Commit ccdaab6

Browse files
committed
Merge pull request #142 from vimperator/text-area-f-t
Make TEXTAREA mode more vim-like.
2 parents dfa8685 + 9d40bf0 commit ccdaab6

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

common/content/editor.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,11 @@ const Editor = Module("editor", {
679679

680680
mappings.add([modes.INSERT],
681681
["<C-t>"], "Edit text field in Vi mode",
682-
function () { liberator.mode = modes.TEXTAREA; });
682+
function () {
683+
let edtr = Editor.getEditor();
684+
edtr.setSelectionRange(edtr.selectionStart - 1, edtr.selectionStart - 1);
685+
liberator.mode = modes.TEXTAREA;
686+
});
683687

684688
mappings.add([modes.INSERT],
685689
["<Space>", "<Return>"], "Expand insert mode abbreviation",
@@ -812,7 +816,7 @@ const Editor = Module("editor", {
812816
function (count, arg) {
813817
let pos = editor.findCharForward(arg, count);
814818
if (pos >= 0)
815-
editor.moveToPosition(pos, true, liberator.mode == modes.VISUAL);
819+
editor.moveToPosition(pos - 1, true, liberator.mode == modes.VISUAL);
816820
},
817821
{ arg: true, count: true });
818822

@@ -830,7 +834,7 @@ const Editor = Module("editor", {
830834
function (count, arg) {
831835
let pos = editor.findCharForward(arg, count);
832836
if (pos >= 0)
833-
editor.moveToPosition(pos - 1, true, liberator.mode == modes.VISUAL);
837+
editor.moveToPosition(pos - 2, true, liberator.mode == modes.VISUAL);
834838
},
835839
{ arg: true, count: true });
836840

0 commit comments

Comments
 (0)