mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-22 06:08:02 +01:00
quick'n dirty block cursor, VERY BUGGY, stay in insert mode of textareas for now
This commit is contained in:
@@ -19,6 +19,11 @@
|
|||||||
|
|
||||||
function Editor() //{{{
|
function Editor() //{{{
|
||||||
{
|
{
|
||||||
|
function editor()
|
||||||
|
{
|
||||||
|
return window.document.commandDispatcher.focusedElement;
|
||||||
|
}
|
||||||
|
|
||||||
function getController()
|
function getController()
|
||||||
{
|
{
|
||||||
var el = window.document.commandDispatcher.focusedElement;
|
var el = window.document.commandDispatcher.focusedElement;
|
||||||
@@ -81,6 +86,9 @@ function Editor() //{{{
|
|||||||
{
|
{
|
||||||
controller.doCommand(cmd);
|
controller.doCommand(cmd);
|
||||||
did_command = true;
|
did_command = true;
|
||||||
|
|
||||||
|
if (vimperator.hasMode(vimperator.modes.TEXTAREA))
|
||||||
|
this.moveCaret();
|
||||||
}
|
}
|
||||||
catch(e)
|
catch(e)
|
||||||
{
|
{
|
||||||
@@ -93,6 +101,15 @@ function Editor() //{{{
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// very rudimentary testing code
|
||||||
|
this.moveCaret = function(pos)
|
||||||
|
{
|
||||||
|
if (!pos)
|
||||||
|
pos = editor().selectionStart - 1;
|
||||||
|
|
||||||
|
editor().setSelectionRange(pos, pos+1);
|
||||||
|
}
|
||||||
|
|
||||||
// cmd = y, d, c
|
// cmd = y, d, c
|
||||||
// motion = b, 0, gg, G, etc.
|
// motion = b, 0, gg, G, etc.
|
||||||
this.executeCommandWithMotion = function(cmd, motion)
|
this.executeCommandWithMotion = function(cmd, motion)
|
||||||
|
|||||||
Reference in New Issue
Block a user