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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user