1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-07 14:24:17 +01:00

a little better block cursor, broke i and a however a little

This commit is contained in:
Martin Stubenschrott
2007-09-08 15:21:11 +00:00
parent 91490f9bd5
commit 3c2abc2785
3 changed files with 37 additions and 11 deletions

View File

@@ -101,13 +101,39 @@ function Editor() //{{{
return true;
}
this.startNormal = function()
{
vimperator.setMode(vimperator.modes.TEXTAREA);
this.moveCaret();
}
this.startVisual = function()
{
vimperator.setMode(vimperator.modes.VISUAL, vimperator.modes.TEXTAREA);
}
this.startInsert = function()
{
vimperator.setMode(vimperator.modes.INSERT, vimperator.modes.TEXTAREA);
this.moveCaret();
}
this.stopInsert = function()
{
vimperator.setMode(vimperator.modes.TEXTAREA);
this.moveCaret();
}
// very rudimentary testing code
this.moveCaret = function(pos)
{
if (!pos)
pos = editor().selectionStart - 1;
editor().setSelectionRange(pos, pos+1);
if (!vimperator.hasMode(vimperator.modes.INSERT))
editor().setSelectionRange(pos, pos+1);
else if (!vimperator.hasMode(vimperator.modes.VISUAL))
editor().setSelectionRange(pos, pos);
}
// cmd = y, d, c