diff --git a/TODO b/TODO index 41d82d50..ecaef7fb 100644 --- a/TODO +++ b/TODO @@ -12,7 +12,6 @@ BUGS: id="hah_hints"> near the end of it.. kinda annoying dpb| 09:11:50 dpb :: and this happens only when saving the complete webpage, saving only the html works just fine.. -- key closes :addons and other XUL windows - add window resize support to hints FEATURES: @@ -25,7 +24,6 @@ FEATURES: 7 provide a buffer on the bottom where more than 1 line messages can be shown, preferrable with color support (for things like :echo line1\nline2) 7 whereever possible: get rid of dialogs and ask console-like dialog questions or write error prompts directly on the webpage or with :echo() -7 Ctrl-6/Ctrl-^ -> jump to the previously active tab 7 3d should delete 3 tabs 6 downloading of links to filesystem (:save ) 6 autocommands (BrowserStart, BrowserQuit, TabClose, TabOpen, TabChanged, PageLoaded, any more?) @@ -49,7 +47,6 @@ FEATURES: RANDOM IDEAS: * numbered tabs -* make hints work with usermode * https://addons.mozilla.org/en-US/firefox/addon/4125 - use vim to edit text fields * Would it be possible to add a setting "maxcompletionsshown" and "maxpreviewwindowheight" or something like this? diff --git a/chrome/content/vimperator/commands.js b/chrome/content/vimperator/commands.js index f31bc9d2..3289a5c9 100644 --- a/chrome/content/vimperator/commands.js +++ b/chrome/content/vimperator/commands.js @@ -1366,7 +1366,8 @@ function updateBufferList() function scrollBufferRelative(right, down) { - var win = document.commandDispatcher.focusedWindow; + //var win = window.document.commandDispatcher.focusedWindow; + var win = window.content; if (vimperator.input.count < 1) vimperator.input.count = 1; @@ -1395,7 +1396,8 @@ function scrollBufferRelative(right, down) /* both values are given in percent, -1 means no change */ function scrollBufferAbsolute(horizontal, vertical) { - var win = document.commandDispatcher.focusedWindow; + //var win = document.commandDispatcher.focusedWindow; + var win = window.content; var horiz, vert; if (horizontal < 0) diff --git a/chrome/content/vimperator/ui.js b/chrome/content/vimperator/ui.js index 53e69e38..78d1896b 100644 --- a/chrome/content/vimperator/ui.js +++ b/chrome/content/vimperator/ui.js @@ -230,12 +230,26 @@ function CommandLine() //{{{ this.input = function(str) { // TODO: unfinished, need to find out how/if we can block the execution of code - // to make this code synchronous + // to make this code synchronous or at least use a callback setPrompt(""); setMessageStyle(); setCommand(str); return "not implemented"; - } + }; + + // reads a multi line input and returns the string once the last line matches + // param until_regex + this.readMultiline = function(until_regex, callback_func) + { + // save the mode, because we need to restore it on blur() +// [old_mode, old_extended_mode] = vimperator.getMode(); +// vimperator.setMode(vimperator.modes.COMMAND_LINE, vimperator.modes.READ_MULTLINE, true); + + multiline_widget.collapsed = false; + multiline_widget.contentDocument.body.innerHTML = ""; + multiline_widget.contentDocument.designMode = "on"; + multiline_widget.contentWindow.focus(); // FIXME: does not work + }; this.clear = function() { @@ -244,7 +258,6 @@ function CommandLine() //{{{ setNormalStyle(); }; - this.onEvent = function(event) { var command = this.getCommand(); diff --git a/chrome/content/vimperator/vimperator.js b/chrome/content/vimperator/vimperator.js index f9a11ed2..dbbbc89b 100644 --- a/chrome/content/vimperator/vimperator.js +++ b/chrome/content/vimperator/vimperator.js @@ -164,13 +164,14 @@ function Vimperator() //{{{ COMMAND_LINE: 1 << 4, // extended modes EX: 1 << 10, - SEARCH_FORWARD: 1 << 11, - SEARCH_BACKWARD: 1 << 12, - ESCAPE_ONE_KEY: 1 << 13, - ESCAPE_ALL_KEYS: 1 << 14, - QUICK_HINT: 1 << 15, - EXTENDED_HINT: 1 << 16, - ALWAYS_HINT: 1 << 17 + READ_MULTLINE: 1 << 11, + SEARCH_FORWARD: 1 << 12, + SEARCH_BACKWARD: 1 << 13, + ESCAPE_ONE_KEY: 1 << 14, + ESCAPE_ALL_KEYS: 1 << 15, + QUICK_HINT: 1 << 16, + EXTENDED_HINT: 1 << 17, + ALWAYS_HINT: 1 << 18 } var mode_messages = {}; mode_messages[this.modes.NORMAL] = ""; @@ -386,12 +387,12 @@ function Events() //{{{ // page is loaded in a background tab getBrowser().addEventListener("load", onPageLoad, true); - // called when the window is scrolled. - window.onscroll = function (event) + // called when the active document is scrolled + getBrowser().addEventListener("scroll", function (event) { vimperator.statusline.updateBufferPosition(); vimperator.setMode(); // trick to reshow the mode in the command line - }; + }, null); window.document.addEventListener("DOMTitleChanged", function(event) { @@ -460,13 +461,15 @@ function Events() //{{{ this.onKeyPress = function(event) { - if (event.type != "keypress") - return false; - +// alert(event) +// if (event.type != "keypress") +// return false; +// vimperator.logObject(event); var key = event.toString() - //alert(key); - if (key == null) + if (!key) return false; +// event.stopPropagation(); +// event.preventDefault(); // sometimes the non-content area has focus, making our keys not work // if (event.target.id == "main-window") // alert("focusContent();"); @@ -1064,19 +1067,21 @@ function Tabs() //{{{ /////////////////////////////////////////////////////////////////////{{{ function isFormElemFocused() { - var elt = document.commandDispatcher.focusedElement; + var elt = window.document.commandDispatcher.focusedElement; if (elt == null) return false; - var tagname = elt.localName.toLowerCase(); - var type = elt.type.toLowerCase(); + try { // sometimes the elt doesn't have .localName + var tagname = elt.localName.toLowerCase(); + var type = elt.type.toLowerCase(); - if ( (tagname == "input" && (type != "image")) || - tagname == "textarea" || -// tagName == "SELECT" || -// tagName == "BUTTON" || - tagname == "isindex") // isindex is a deprecated one-line input box - return true; + if ( (tagname == "input" && (type != "image")) || + tagname == "textarea" || + // tagName == "SELECT" || + // tagName == "BUTTON" || + tagname == "isindex") // isindex is a deprecated one-line input box + return true; + } catch(e) {}; return false; } diff --git a/chrome/content/vimperator/vimperator.xul b/chrome/content/vimperator/vimperator.xul index 59a6ba20..9da6d63b 100644 --- a/chrome/content/vimperator/vimperator.xul +++ b/chrome/content/vimperator/vimperator.xul @@ -101,7 +101,7 @@ the terms of any one of the MPL, the GPL or the LGPL. onblur="vimperator.commandline.onEvent(event);" style="font-family: monospace; -moz-user-focus:ignore;"/> -