diff --git a/ChangeLog b/ChangeLog index 7d964fd4..692ab265 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,8 @@ date: * version 0.4 * fixed saving of session + * fixed hints display when zooming in/out of a web page + * changed hintsize to 12px by default * 'previewheight' setting to set the maximum size for the preview window * showmode setting which shows the current mode in the command line (patch from Виктор Кожухаров) * gh goes home :) gH in a new tab diff --git a/TODO b/TODO index 8691bb16..2ea0a993 100644 --- a/TODO +++ b/TODO @@ -4,19 +4,19 @@ Priority list: BUGS: - switching tabs while HINT_MODE_ALWAYS is on does not redisplay hints in new tabs, but exits hint mode -- hints are not placed correctly when zoom is used - flashing frame is not perfect - The RSS feed button in the address bar no longer works. -- hints on digg.com are behind text - autoupdate does not work - multiple windows to not work at all, so :q will close the whole browser session, even when there are other windows which has tabs +- :o google c++ -> searches for c (need to escape the + in the url) +- reload/stop buttons don't update enabled state FEATURES: 9 marks of a Location (also should work with directories), [m a-zA-Z] to set it, [' a-zA-Z] to go there [m 0-9] marks a buffer instead [' 0-9] goes there also mark bookmarks (with mA-Z maybe and use only lowercase marks for inbuffer marks?) also support :mark and :marks -8 :cd .. -> Up one directory, :cd goes to top location, [Backspace] command shortcut, use count (:3cd goes 3 levels up) +8 :open .. -> Up one directory, :cd goes to top location, [Backspace] command shortcut, use count (:3cd goes 3 levels up) 8 downloading of links to filesystem (:save ) 8 provide a buffer on the bottom where more than 1 line messages can be shown, preferrable with color support (for things like :ls) diff --git a/chrome/content/vimperator/commands.js b/chrome/content/vimperator/commands.js index e73865d8..101926e6 100644 --- a/chrome/content/vimperator/commands.js +++ b/chrome/content/vimperator/commands.js @@ -96,14 +96,14 @@ var g_commands = [/*{{{*/ ["buffer", "b"], "Go to buffer number n. Full completion works.", null, - function (args) { tab_go(args.split(":")[0]); preview_window.hidden = true; }, + function (args) { tab_go(args.split(":")[0]); }, function (filter) {return get_buffer_completions(filter);} ], [ ["buffers", "files", "ls"], "Shows a list of all buffers.", null, - function (args) {bushow("", false);}, + function (args) {bufshow("", false);}, null ], [ @@ -386,14 +386,14 @@ var g_mappings = [/*{{{*/ ["b"], "Open a prompt to switch buffers", "Typing the corresponding number opens switches to this buffer", - function (args) { bushow("", true); openVimperatorBar('buffer '); } + function (args) { bufshow("", true); openVimperatorBar('buffer '); } ], - /*[ + [ ["B"], "Toggle buffer list", "Open the preview window with all currently opened tabs", - function (args) { preview_window.hidden == true ? bushow("", false) : preview_window.hidden = true; } - ],*/ + buffer_preview_toggle, + ], [ ["d"], "Delete current buffer (=tab)", @@ -508,7 +508,7 @@ var g_mappings = [/*{{{*/ yankCurrentLocation ], [ - ["zi"], + ["zi", "+"], "Zoom in", "Zoom in current web page by 25%.
"+ "Currently no count supported.", @@ -522,7 +522,7 @@ var g_mappings = [/*{{{*/ function(count) { zoom_in(4); } ], [ - ["zo"], + ["zo", "-"], "Zoom out", "Zoom out current web page by 25%.
"+ "Currently no count supported.", @@ -692,13 +692,15 @@ var g_mappings = [/*{{{*/ ["n"], "Find next", "Repeat the last \"/\" 1 time (until count is supported).", - gFindBar.onFindAgainCmd // this does not work, why?: goDoCommand('cmd_findAgain'); } + // don't use a closure for this, is just DoesNotWork (TM) + function(count) { gFindBar.onFindAgainCmd(); } // this does not work, why?: goDoCommand('cmd_findAgain'); } ], [ ["N"], "Find previous", "Repeat the last \"/\" 1 time (until count is supported) in the opposite direction.", - gFindBar.onFindPreviousCmd // this does not work, why?: goDoCommand('cmd_findPrevious'); } + // don't use a closure for this, is just DoesNotWork (TM) + function(count) { gFindBar.onFindPreviousCmd(); } // this does not work, why?: goDoCommand('cmd_findPrevious'); } ], /* vimperator managment */ @@ -1174,21 +1176,6 @@ function hsshow(filter, fullmode) preview_window_show(); } } -function bushow(filter, in_comp_window) -{ - if (in_comp_window) // fill the completion list - { - g_completions = get_buffer_completions(filter); - completion_fill_list(0); - completion_show_list(); - } - else // in the preview window - { - var items = get_buffer_completions(filter); - preview_window_fill(items); - preview_window_show(); - } -} //////////////////////////////////////////////////////////////////////// @@ -1238,7 +1225,7 @@ function show_location_marks(mark) } //////////////////////////////////////////////////////////////////////// -// tab related functions ////////////////////////////////////////// {{{1 +// tab/buffer related functions /////////////////////////////////// {{{1 //////////////////////////////////////////////////////////////////////// /* if index = 0, advance on tab * if index < 0, go one tab to the left @@ -1277,6 +1264,52 @@ function tab_remove(count, focus_left_tab, quit_on_last_tab) getBrowser().removeTab(tab); } +function bufshow(filter, in_comp_window) +{ + if (in_comp_window) // fill the completion list + { + g_completions = get_buffer_completions(filter); + completion_fill_list(0); + completion_show_list(); + } + else // in the preview window + { + var items = get_buffer_completions(filter); + preview_window_fill(items); + preview_window_show(); + } +} + +//toggles the buffer preview window +function buffer_preview_toggle() +{ + if(g_bufshow == true) + { + preview_window.hidden = true; + g_bufshow = false; + } + else + { + bufshow("", false); + g_bufshow = true; + } +} + +//updates the buffer preview in place +function buffer_preview_update(event) +{ + if(g_bufshow == true) + bufshow("",false); +} + +// adds listeners to buffer actions. +var container = getBrowser().tabContainer; +container.addEventListener("TabOpen", buffer_preview_update, false); +container.addEventListener("TabSelect", buffer_preview_update, false); +container.addEventListener("TabMove", buffer_preview_update, false); +container.addEventListener("TabClose", buffer_preview_update, false); + + //////////////////////////////////////////////////////////////////////// // scrolling ////////////////////////////////////////////////////// {{{1 //////////////////////////////////////////////////////////////////////// @@ -1356,6 +1389,9 @@ function zoom_in(factor) if (value > 500) value = 500; zoomMgr.textZoom = value; + + hah.reshowHints(); + echo("Zoom value: " + value + "%"); } } @@ -1386,6 +1422,9 @@ function zoom_to(value) } zoomMgr.textZoom = value; + + hah.reshowHints(); + echo("Zoom value: " + value + "%"); } @@ -1911,17 +1950,4 @@ function showMode() echo("-- " + g_modemessages[g_current_mode] + " --"); } -// function keycodeToName(keyCode) { -// for (keyName in KeyboardEvent.prototype) { -// if (keyName.substr(0,7) == 'DOM_VK_' && KeyboardEvent.prototype[keyName] == keyCode) { -// // turn 'DOM_VK_KEY_NAME' into 'Key Name' -// parts = keyName.substr(7).split('_'); // strip off DOM_VK_ and split into words -// for (var i = 0; i < parts.length; i++) -// parts[i] = parts[i][0] + parts[i].substr(1).toLowerCase(); -// return parts.join(' '); -// } -// } -// return 0; -// } - // vim: set fdm=marker sw=4 ts=4 et: diff --git a/chrome/content/vimperator/hints.js b/chrome/content/vimperator/hints.js index e6fcd86c..e09a5514 100644 --- a/chrome/content/vimperator/hints.js +++ b/chrome/content/vimperator/hints.js @@ -265,7 +265,11 @@ function hit_a_hint() function onResize(event) { - doc = event.originalTarget; + if(event) + doc = event.originalTarget; + else + doc = window._content.document; + invalidateCoords(doc); startCoordLoader(doc); } @@ -440,6 +444,18 @@ function hit_a_hint() } }; + + this.reshowHints = function() + { + onResize(null); + + if (isHahModeEnabled) + { + removeHints(); + createHints(); + showHints(null, 0); + } + }; // this function 'click' an element, which also works diff --git a/chrome/content/vimperator/settings.js b/chrome/content/vimperator/settings.js index 1c1cff6d..5af96cb2 100644 --- a/chrome/content/vimperator/settings.js +++ b/chrome/content/vimperator/settings.js @@ -92,7 +92,7 @@ var g_settings = [/*{{{*/ function(value) { set_pref("focusedhintstyle", value); }, function() { return get_pref("focusedhintstyle"); }, "string", - "z-index:5000;font-family:monospace;font-size:12;color:ButtonText;background-color:ButtonShadow;border-color:ButtonShadow;border-width:1px;border-style:solid;padding:0px 1px 0px 1px;position:absolute;", + "z-index:5000;font-family:monospace;font-size:12px;color:ButtonText;background-color:ButtonShadow;border-color:ButtonShadow;border-width:1px;border-style:solid;padding:0px 1px 0px 1px;position:absolute;", null, null ], @@ -136,7 +136,7 @@ var g_settings = [/*{{{*/ function(value) { set_pref("hintstyle", value); }, function() { return get_pref("hintstyle"); }, "string", - "z-index:5000;font-family:monospace;font-size:12;color:black;background-color:yellow;border-color:ButtonShadow;border-width:0px;border-style:solid;padding:0px 1px 0px 1px;position:absolute;", + "z-index:5000;font-family:monospace;font-size:12px;color:black;background-color:yellow;border-color:ButtonShadow;border-width:0px;border-style:solid;padding:0px 1px 0px 1px;position:absolute;", null, null ], diff --git a/chrome/content/vimperator/tags b/chrome/content/vimperator/tags index 77f8d702..b08b4891 100644 --- a/chrome/content/vimperator/tags +++ b/chrome/content/vimperator/tags @@ -11,8 +11,10 @@ beep commands.js /^function beep()$/;" f bmadd commands.js /^function bmadd(str)$/;" f bmdel commands.js /^function bmdel(str)$/;" f bmshow commands.js /^function bmshow(filter, fullmode)$/;" f -bushow commands.js /^function bushow(filter)$/;" f -changeHintFocus hints.js /^ function changeHintFocus(linkNumString, oldLinkNumString)$/;" f +buffer_preview_toggle commands.js /^function buffer_preview_toggle()$/;" f +buffer_preview_update commands.js /^function buffer_preview_update(event)$/;" f +bufshow commands.js /^function bufshow(filter, in_comp_window)$/;" f +changeHintFocus hints.js /^ function changeHintFocus(linkNumString, oldLinkNumString)$/;" f completion_add_to_list completion.js /^function completion_add_to_list(completion_item, at_beginning)\/*{{{*\/$/;" f completion_fill_list completion.js /^function completion_fill_list(startindex)\/*{{{*\/$/;" f completion_select_next_item completion.js /^function completion_select_next_item()\/*{{{*\/$/;" f @@ -20,7 +22,7 @@ completion_select_previous_item completion.js /^function completion_select_previ completion_show_list completion.js /^function completion_show_list()\/*{{{*\/$/;" f copyToClipboard commands.js /^function copyToClipboard(str)$/;" f createCursorPositionString vimperator.js /^function createCursorPositionString()$/;" f -createHints hints.js /^ function createHints(win)$/;" f +createHints hints.js /^ function createHints(win)$/;" f createProgressBar vimperator.js /^function createProgressBar(aProgress)$/;" f deleteBookmark bookmarks.js /^function deleteBookmark(url)$/;" f del_url_mark commands.js /^function del_url_mark(mark)$/;" f @@ -30,12 +32,12 @@ execute_command commands.js /^function execute_command(count, cmd, special, args filter_url_array completion.js /^function filter_url_array(urls, filter, use_regex)\/*{{{*\/$/;" f focusContent vimperator.js /^function focusContent(clear_command_line, clear_statusline)$/;" f focusNextFrame commands.js /^function focusNextFrame()$/;" f -formatHint hints.js /^ function formatHint(hintNum)$/;" f -genElemCoords hints.js /^ function genElemCoords(elem)$/;" f -genHintContainer hints.js /^ function genHintContainer(doc)$/;" f +formatHint hints.js /^ function formatHint(hintNum)$/;" f +genElemCoords hints.js /^ function genElemCoords(elem)$/;" f +genHintContainer hints.js /^ function genHintContainer(doc)$/;" f getCurrentLinkLocation commands.js /^function getCurrentLinkLocation()$/;" f getCurrentLocation commands.js /^function getCurrentLocation()$/;" f -getHintById hints.js /^ function getHintById(id, win)$/;" f +getHintById hints.js /^ function getHintById(id, win)$/;" f getLinkNodes vimperator.js /^function getLinkNodes(doc)$/;" f getPageLinkNodes vimperator.js /^function getPageLinkNodes()$/;" f getProperty bookmarks.js /^function getProperty( aInput, aArc, DS )$/;" f @@ -53,23 +55,23 @@ get_url_completions completion.js /^function get_url_completions(filter)\/*{{{*\ get_url_mark commands.js /^function get_url_mark(mark)$/;" f goUp commands.js /^function goUp() \/\/ FIXME$/;" f hasMode commands.js /^function hasMode(mode)$/;" f -help commands.js /^function help(section)$/;" f +help commands.js /^function help(section, easter)$/;" f hit_a_hint hints.js /^function hit_a_hint()$/;" f hsshow commands.js /^function hsshow(filter, fullmode)$/;" f init vimperator.js /^function init()$/;" f -initDoc hints.js /^ function initDoc(event)$/;" f -invalidateCoords hints.js /^ function invalidateCoords(doc)$/;" f +initDoc hints.js /^ function initDoc(event)$/;" f +invalidateCoords hints.js /^ function invalidateCoords(doc)$/;" f isFormElemFocused vimperator.js /^function isFormElemFocused()$/;" f keyToString vimperator.js /^function keyToString(event)$/;" f load_history completion.js /^function load_history()$/;" f logMessage vimperator.js /^function logMessage(msg)$/;" f -makeHelpString commands.js /^ function makeHelpString(commands, color, beg, end, func)$/;" f -makeSettingsHelpString commands.js /^ function makeSettingsHelpString(command)$/;" f +makeHelpString commands.js /^ function makeHelpString(commands, color, beg, end, func)$/;" f +makeSettingsHelpString commands.js /^ function makeSettingsHelpString(command)$/;" f nsBrowserStatusHandler vimperator.js /^function nsBrowserStatusHandler() \/*{{{*\/$/;" f onCommandBarInput vimperator.js /^function onCommandBarInput(event)$/;" f onCommandBarKeypress vimperator.js /^function onCommandBarKeypress(evt)\/*{{{*\/$/;" f onEscape vimperator.js /^function onEscape()$/;" f -onResize hints.js /^ function onResize(event)$/;" f +onResize hints.js /^ function onResize(event)$/;" f onVimperatorKeypress vimperator.js /^function onVimperatorKeypress(event)\/*{{{*\/$/;" f openURLs commands.js /^function openURLs(str)$/;" f openURLsInNewTab commands.js /^function openURLsInNewTab(str, activate)$/;" f @@ -78,9 +80,10 @@ outputAddonsList commands.js /^function outputAddonsList(aTarget)$/;" f parseBookmarkString bookmarks.js /^function parseBookmarkString(str, res)$/;" f preview_window_fill completion.js /^function preview_window_fill(completions)$/;" f preview_window_select completion.js /^function preview_window_select(event)$/;" f +preview_window_show completion.js /^function preview_window_show()\/*{{{*\/$/;" f quit commands.js /^function quit(save_session)$/;" f reload commands.js /^function reload(all_tabs)$/;" f -removeHints hints.js /^ function removeHints(win)$/;" f +removeHints hints.js /^ function removeHints(win)$/;" f removeMode commands.js /^function removeMode(mode)$/;" f restart commands.js /^function restart()$/;" f save_history completion.js /^function save_history()$/;" f @@ -89,8 +92,8 @@ scrollBufferRelative commands.js /^function scrollBufferRelative(right, down)$/; selectInput commands.js /^function selectInput()$/;" f set commands.js /^function set(args, special)$/;" f setCurrentMode commands.js /^function setCurrentMode(mode)$/;" f -setHintStyle hints.js /^ function setHintStyle(hintElem, styleString)$/;" f -setMouseOverElement hints.js /^ function setMouseOverElement(elem)$/;" f +setHintStyle hints.js /^ function setHintStyle(hintElem, styleString)$/;" f +setMouseOverElement hints.js /^ function setMouseOverElement(elem)$/;" f setStatusbarColor vimperator.js /^function setStatusbarColor(color)$/;" f set_firefox_pref settings.js /^function set_firefox_pref(name, value)$/;" f set_guioptions settings.js /^function set_guioptions(value)$/;" f @@ -98,12 +101,13 @@ set_location_mark commands.js /^function set_location_mark(mark)$/;" f set_pref settings.js /^function set_pref(name, value)$/;" f set_showtabline settings.js /^function set_showtabline(value)$/;" f set_url_mark commands.js /^function set_url_mark(mark, url)$/;" f -showHints hints.js /^ function showHints(win, off)$/;" f +showHints hints.js /^ function showHints(win, off)$/;" f +showMode commands.js /^function showMode()$/;" f showStatusbarMessage vimperator.js /^function showStatusbarMessage(msg, field)$/;" f show_location_marks commands.js /^function show_location_marks(mark)$/;" f show_url_marks commands.js /^function show_url_marks(mark)$/;" f source commands.js /^function source(filename)$/;" f -startCoordLoader hints.js /^ function startCoordLoader(doc)$/;" f +startCoordLoader hints.js /^ function startCoordLoader(doc)$/;" f stepInHistory commands.js /^function stepInHistory(steps)$/;" f stringToURLs commands.js /^function stringToURLs(str)$/;" f tab_go commands.js /^function tab_go(index)$/;" f diff --git a/chrome/content/vimperator/vimperator.js b/chrome/content/vimperator/vimperator.js index 7fb502f6..afe4da42 100644 --- a/chrome/content/vimperator/vimperator.js +++ b/chrome/content/vimperator/vimperator.js @@ -43,6 +43,7 @@ var popup_allowed_events; // need to change and reset this firefox pref var g_inputbuffer = ""; // here we store partial commands (e.g. 'g' if you want to type 'gg') var g_count = -1; // the parsed integer of g_inputbuffer, or -1 if no count was given +var g_bufshow = false; // keeps track if the preview window shows current buffers ('B') // handles to our gui elements var preview_window = null; @@ -82,9 +83,9 @@ nsBrowserStatusHandler.prototype = setOverLink : function(link, b) { - if (link != "") - echo(link); - else + echo(link); + + if (link == "") showMode(); },