1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-20 07:28:00 +01:00

Push INSERT mode on top of PASS THROUGH mode when entering an input field, rather than clearing the mode stack.

This commit is contained in:
Kris Maglione
2010-11-17 19:18:19 -05:00
parent 7abe83ed8d
commit 5a618bee0e
5 changed files with 34 additions and 18 deletions

View File

@@ -115,9 +115,12 @@ install:
index($$0, "\nName=" profile "\n") { print; exit } \
!profile && /\nName=default\n/ { args["name=default"] = $$0 } \
!profile && /\nDefault=1/ { args["default=1"] = $$0 } \
END { if (args["default=1"]) print args["default=1"]; else print args["name=default"] }' |\
END { \
if (args["default=1"]) print args["default=1"]; \
else print args["name=default"] \
}' | \
awk -F= '{ args[$$1] = $$2 } \
END {\
END { \
if (args["IsRelative"]) print ENVIRON["dir"] "/" args["Path"]; \
else print args["Path"] \
}'); \

View File

@@ -85,7 +85,7 @@ const Buffer = Module("buffer", {
// get file size
const ACCESS_READ = Ci.nsICache.ACCESS_READ;
let cacheKey = doc.location.toString().replace(/#.*$/, "");
let cacheKey = doc.documentURI;
for (let proto in array.iterValues(["HTTP", "FTP"])) {
try {
@@ -249,13 +249,13 @@ const Buffer = Module("buffer", {
onSecurityChange.superapply(this, arguments);
// TODO: do something useful with STATE_SECURE_MED and STATE_SECURE_LOW
if (state & Ci.nsIWebProgressListener.STATE_IS_INSECURE)
statusline.setClass("insecure");
statusline.class = "insecure";
else if (state & Ci.nsIWebProgressListener.STATE_IS_BROKEN)
statusline.setClass("broken");
statusline.class = "broken";
else if (state & Ci.nsIWebProgressListener.STATE_IDENTITY_EV_TOPLEVEL)
statusline.setClass("extended");
statusline.class = "extended";
else if (state & Ci.nsIWebProgressListener.STATE_SECURE_HIGH)
statusline.setClass("secure");
statusline.class = "secure";
},
onStatusChange: function onStatusChange(webProgress, request, status, message) {
onStatusChange.superapply(this, arguments);
@@ -1108,8 +1108,10 @@ const Buffer = Module("buffer", {
return elem;
}
if (buffer.focusedFrame.getSelection().rangeCount)
var elem = find(buffer.focusedFrame.getSelection().getRangeAt(0).startContainer);
let sel = buffer.focusedFrame.getSelection();
if (sel && sel.rangeCount)
var elem = find(sel.getRangeAt(0).startContainer);
if (!(elem instanceof Element)) {
let doc = Buffer.findScrollableWindow().document;
elem = find(doc.body || doc.getElementsByTagName("body")[0] ||

View File

@@ -718,7 +718,9 @@ const Events = Module("events", {
if (elem instanceof HTMLInputElement && set.has(util.editableInputs, elem.type) ||
elem instanceof HTMLSelectElement ||
elem instanceof Window && Editor.getEditor(elem)) {
dactyl.mode = modes.INSERT;
if (!(modes.main & (modes.INSERT | modes.TEXT_EDIT | modes.VISUAL)))
modes.push(modes.INSERT);
if (hasHTMLDocument(win))
buffer.lastInputField = elem;
return;
@@ -735,13 +737,14 @@ const Events = Module("events", {
if (modes.main === modes.VISUAL && elem.selectionEnd == elem.selectionStart)
modes.pop();
if (options["insertmode"])
modes.set(modes.INSERT);
else {
modes.set(modes.TEXT_EDIT);
if (elem.selectionEnd - elem.selectionStart > 0)
modes.push(modes.VISUAL);
}
if (!(modes.main & (modes.INSERT | modes.TEXT_EDIT | modes.VISUAL)))
if (options["insertmode"])
modes.push(modes.INSERT);
else {
modes.push(modes.TEXT_EDIT);
if (elem.selectionEnd - elem.selectionStart > 0)
modes.push(modes.VISUAL);
}
if (hasHTMLDocument(win))
buffer.lastInputField = elem;

View File

@@ -172,6 +172,12 @@ const Modes = Module("modes", {
dactyl.triggerObserver("mode-add", mode);
},
dumpStack: function () {
util.dump("Mode stack:");
for (let [i, mode] in array.iterItems(this._modeStack))
util.dump(" " + i + ": " + mode);
},
getMode: function (name) this._modeMap[name],
getStack: function (idx) this._modeStack[this._modeStack.length - idx - 1] || this._modeStack[0],

View File

@@ -44,7 +44,8 @@ const StatusLine = Module("statusline", {
*
* @param {'extended'|'secure'|'broken'|'insecure'} type
*/
setClass: function setClass(type) {
set class(type) {
this._class = type;
const highlightGroup = {
extended: "StatusLineExtended",
secure: "StatusLineSecure",
@@ -54,6 +55,7 @@ const StatusLine = Module("statusline", {
highlight.highlightNode(this._statusLine, highlightGroup[type]);
},
get class() this._class,
// update all fields of the statusline
update: function update() {