mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-04-15 20:03:32 +02:00
start of a caret mode
This commit is contained in:
1
NEWS
1
NEWS
@@ -1,6 +1,7 @@
|
|||||||
<pre>
|
<pre>
|
||||||
2007-xx-xx:
|
2007-xx-xx:
|
||||||
* version 0.6
|
* version 0.6
|
||||||
|
* initial start of caret mode. Start with 'i', stop with <Esc>
|
||||||
* vimperator trys to stay in command mode after loading pages instead of having a text field focused
|
* vimperator trys to stay in command mode after loading pages instead of having a text field focused
|
||||||
* added a visual bell and replaced 'beep' with 'visualbell'
|
* added a visual bell and replaced 'beep' with 'visualbell'
|
||||||
* added vimperator logo (can be seen in the addons manager)
|
* added vimperator logo (can be seen in the addons manager)
|
||||||
|
|||||||
@@ -382,6 +382,10 @@ function Events() //{{{
|
|||||||
{
|
{
|
||||||
if (!vimperator.hasMode(vimperator.modes.ESCAPE_ONE_KEY))
|
if (!vimperator.hasMode(vimperator.modes.ESCAPE_ONE_KEY))
|
||||||
{
|
{
|
||||||
|
// setting this option will trigger an observer which will care about all other details
|
||||||
|
if (vimperator.hasMode(vimperator.modes.CARET))
|
||||||
|
Options.setFirefoxPref("accessibility.browsewithcaret", false);
|
||||||
|
|
||||||
vimperator.setMode(vimperator.modes.NORMAL);
|
vimperator.setMode(vimperator.modes.NORMAL);
|
||||||
vimperator.commandline.clear();
|
vimperator.commandline.clear();
|
||||||
vimperator.hints.disableHahMode();
|
vimperator.hints.disableHahMode();
|
||||||
@@ -711,6 +715,41 @@ function Events() //{{{
|
|||||||
.getInterface(Components.interfaces.nsIXULWindow)
|
.getInterface(Components.interfaces.nsIXULWindow)
|
||||||
.XULBrowserWindow = window.XULBrowserWindow;
|
.XULBrowserWindow = window.XULBrowserWindow;
|
||||||
getBrowser().addProgressListener(this.progressListener, Components.interfaces.nsIWebProgress.NOTIFY_ALL);
|
getBrowser().addProgressListener(this.progressListener, Components.interfaces.nsIWebProgress.NOTIFY_ALL);
|
||||||
|
|
||||||
|
|
||||||
|
this.prefObserver =
|
||||||
|
{
|
||||||
|
register: function()
|
||||||
|
{
|
||||||
|
var prefService = Components.classes["@mozilla.org/preferences-service;1"]
|
||||||
|
.getService(Components.interfaces.nsIPrefService);
|
||||||
|
this._branch = prefService.getBranch(""); // better way to monitor all changes?
|
||||||
|
this._branch.QueryInterface(Components.interfaces.nsIPrefBranch2);
|
||||||
|
this._branch.addObserver("", this, false);
|
||||||
|
},
|
||||||
|
|
||||||
|
unregister: function()
|
||||||
|
{
|
||||||
|
if(!this._branch) return;
|
||||||
|
this._branch.removeObserver("", this);
|
||||||
|
},
|
||||||
|
|
||||||
|
observe: function(aSubject, aTopic, aData)
|
||||||
|
{
|
||||||
|
if(aTopic != "nsPref:changed") return;
|
||||||
|
// aSubject is the nsIPrefBranch we're observing (after appropriate QI)
|
||||||
|
// aData is the name of the pref that's been changed (relative to aSubject)
|
||||||
|
switch (aData)
|
||||||
|
{
|
||||||
|
case "accessibility.browsewithcaret":
|
||||||
|
var value = Options.getFirefoxPref("accessibility.browsewithcaret", false);
|
||||||
|
vimperator.setMode(value ? vimperator.modes.CARET : vimperator.modes.NORMAL, null);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.prefObserver.register();
|
||||||
|
|
||||||
//}}}
|
//}}}
|
||||||
} //}}}
|
} //}}}
|
||||||
|
|
||||||
|
|||||||
@@ -309,6 +309,18 @@ function Mappings() //{{{
|
|||||||
help: "In command line mode, you can perform extended commands, which may require arguments."
|
help: "In command line mode, you can perform extended commands, which may require arguments."
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
addDefaultMap(new Map(vimperator.modes.NORMAL, ["i"],
|
||||||
|
function()
|
||||||
|
{
|
||||||
|
Options.setFirefoxPref("accessibility.browsewithcaret", true);
|
||||||
|
vimperator.setMode(vimperator.modes.CARET, null);
|
||||||
|
},
|
||||||
|
{
|
||||||
|
short_help: "Start caret mode",
|
||||||
|
help: "This mode resembles the vim normal mode where you see a text cursor and can move around. " +
|
||||||
|
"NOTE: Movement keys are not really working for the moment."
|
||||||
|
}
|
||||||
|
));
|
||||||
addDefaultMap(new Map(vimperator.modes.NORMAL, ["I"],
|
addDefaultMap(new Map(vimperator.modes.NORMAL, ["I"],
|
||||||
function() { vimperator.addMode(null, vimperator.modes.ESCAPE_ALL_KEYS); },
|
function() { vimperator.addMode(null, vimperator.modes.ESCAPE_ALL_KEYS); },
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ const vimperator = (function() //{{{
|
|||||||
VISUAL: 1 << 2,
|
VISUAL: 1 << 2,
|
||||||
HINTS: 1 << 3,
|
HINTS: 1 << 3,
|
||||||
COMMAND_LINE: 1 << 4,
|
COMMAND_LINE: 1 << 4,
|
||||||
|
CARET: 1 << 5, // text cursor is visible
|
||||||
// extended modes
|
// extended modes
|
||||||
EX: 1 << 10,
|
EX: 1 << 10,
|
||||||
READ_MULTILINE: 1 << 11,
|
READ_MULTILINE: 1 << 11,
|
||||||
@@ -58,6 +59,7 @@ const vimperator = (function() //{{{
|
|||||||
mode_messages[modes.INSERT] = "INSERT";
|
mode_messages[modes.INSERT] = "INSERT";
|
||||||
mode_messages[modes.VISUAL] = "VISUAL";
|
mode_messages[modes.VISUAL] = "VISUAL";
|
||||||
mode_messages[modes.HINTS] = "HINTS";
|
mode_messages[modes.HINTS] = "HINTS";
|
||||||
|
mode_messages[modes.CARET] = "CARET"; // XXX: not a perfect name
|
||||||
mode_messages[modes.ESCAPE_ONE_KEY] = "escape one key";
|
mode_messages[modes.ESCAPE_ONE_KEY] = "escape one key";
|
||||||
mode_messages[modes.ESCAPE_ALL_KEYS] = "escape all keys";
|
mode_messages[modes.ESCAPE_ALL_KEYS] = "escape all keys";
|
||||||
mode_messages[modes.ESCAPE_ONE_KEY | modes.ESCAPE_ALL_KEYS] = "pass one key";
|
mode_messages[modes.ESCAPE_ONE_KEY | modes.ESCAPE_ALL_KEYS] = "pass one key";
|
||||||
@@ -92,13 +94,10 @@ const vimperator = (function() //{{{
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (str_mode && str_extended)
|
if (str_extended)
|
||||||
str_extended = " (" + str_extended + ")";
|
str_extended = " (" + str_extended + ")";
|
||||||
else
|
else
|
||||||
{
|
str_extended = "";
|
||||||
str_extended = "(" + str_extended + ")";
|
|
||||||
str_mode = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
vimperator.echo("-- " + str_mode + str_extended + " --");
|
vimperator.echo("-- " + str_mode + str_extended + " --");
|
||||||
}
|
}
|
||||||
@@ -293,7 +292,10 @@ const vimperator = (function() //{{{
|
|||||||
|
|
||||||
popup.height = box.height;
|
popup.height = box.height;
|
||||||
popup.width = box.width;
|
popup.width = box.width;
|
||||||
popup.showPopup(win, box.screenX, box.screenY, "popup");
|
////popup.showPopup(win, box.screenX, box.screenY, "popup");
|
||||||
|
//popup.showPopup(win, -1, -1, "popup", "topleft", "topleft");
|
||||||
|
|
||||||
|
popup.openPopup(win, "overlap", 0, 0, false, false)
|
||||||
|
|
||||||
setTimeout(function() { popup.hidePopup(); }, 50);
|
setTimeout(function() { popup.hidePopup(); }, 50);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -117,9 +117,12 @@ the terms of any one of the MPL, the GPL or the LGPL.
|
|||||||
<!-- other keys are handled inside vimperator.js event loop -->
|
<!-- other keys are handled inside vimperator.js event loop -->
|
||||||
</keyset>
|
</keyset>
|
||||||
|
|
||||||
|
<!--
|
||||||
<popupset id="vimperator-popupset">
|
<popupset id="vimperator-popupset">
|
||||||
<popup id="vimperator-visualbell"/>
|
<popup id="vimperator-visualbell"/>
|
||||||
</popupset>
|
</popupset>
|
||||||
|
-->
|
||||||
|
<panel id="vimperator-visualbell"/>
|
||||||
|
|
||||||
</window>
|
</window>
|
||||||
</overlay>
|
</overlay>
|
||||||
|
|||||||
Reference in New Issue
Block a user