1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-21 18:27:57 +01:00

- fixed hints display on zoom

- fixed n and N commands (don't use closures)
This commit is contained in:
Martin Stubenschrott
2007-04-20 13:33:34 +00:00
parent 48b9f413cd
commit 2244db0ecf
7 changed files with 115 additions and 66 deletions

View File

@@ -2,6 +2,8 @@
date: date:
* version 0.4 * version 0.4
* fixed saving of session * 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 * 'previewheight' setting to set the maximum size for the preview window
* showmode setting which shows the current mode in the command line (patch from Виктор Кожухаров) * showmode setting which shows the current mode in the command line (patch from Виктор Кожухаров)
* gh goes home :) gH in a new tab * gh goes home :) gH in a new tab

6
TODO
View File

@@ -4,19 +4,19 @@ Priority list:
BUGS: BUGS:
- switching tabs while HINT_MODE_ALWAYS is on does not redisplay hints in new tabs, but exits hint mode - 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 - flashing frame is not perfect
- The RSS feed button in the address bar no longer works. - The RSS feed button in the address bar no longer works.
- hints on digg.com are behind text
- autoupdate does not work - 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 - 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: FEATURES:
9 marks of a Location (also should work with directories), [m a-zA-Z] to set it, [' a-zA-Z] to go there 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 [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 mark bookmarks (with mA-Z maybe and use only lowercase marks for inbuffer marks?)
also support :mark and :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 <filename>) 8 downloading of links to filesystem (:save <filename>)
8 provide a buffer on the bottom where more than 1 line messages can be shown, preferrable 8 provide a buffer on the bottom where more than 1 line messages can be shown, preferrable
with color support (for things like :ls) with color support (for things like :ls)

View File

@@ -96,14 +96,14 @@ var g_commands = [/*{{{*/
["buffer", "b"], ["buffer", "b"],
"Go to buffer number n. Full completion works.", "Go to buffer number n. Full completion works.",
null, 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);} function (filter) {return get_buffer_completions(filter);}
], ],
[ [
["buffers", "files", "ls"], ["buffers", "files", "ls"],
"Shows a list of all buffers.", "Shows a list of all buffers.",
null, null,
function (args) {bushow("", false);}, function (args) {bufshow("", false);},
null null
], ],
[ [
@@ -386,14 +386,14 @@ var g_mappings = [/*{{{*/
["b"], ["b"],
"Open a prompt to switch buffers", "Open a prompt to switch buffers",
"Typing the corresponding number opens switches to this buffer", "Typing the corresponding number opens switches to this buffer",
function (args) { bushow("", true); openVimperatorBar('buffer '); } function (args) { bufshow("", true); openVimperatorBar('buffer '); }
], ],
/*[ [
["B"], ["B"],
"Toggle buffer list", "Toggle buffer list",
"Open the preview window with all currently opened tabs", "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"], ["d"],
"Delete current buffer (=tab)", "Delete current buffer (=tab)",
@@ -508,7 +508,7 @@ var g_mappings = [/*{{{*/
yankCurrentLocation yankCurrentLocation
], ],
[ [
["zi"], ["zi", "+"],
"Zoom in", "Zoom in",
"Zoom in current web page by 25%.<br>"+ "Zoom in current web page by 25%.<br>"+
"Currently no count supported.", "Currently no count supported.",
@@ -522,7 +522,7 @@ var g_mappings = [/*{{{*/
function(count) { zoom_in(4); } function(count) { zoom_in(4); }
], ],
[ [
["zo"], ["zo", "-"],
"Zoom out", "Zoom out",
"Zoom out current web page by 25%.<br>"+ "Zoom out current web page by 25%.<br>"+
"Currently no count supported.", "Currently no count supported.",
@@ -692,13 +692,15 @@ var g_mappings = [/*{{{*/
["n"], ["n"],
"Find next", "Find next",
"Repeat the last \"/\" 1 time (until count is supported).", "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"], ["N"],
"Find previous", "Find previous",
"Repeat the last \"/\" 1 time (until count is supported) in the opposite direction.", "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 */ /* vimperator managment */
@@ -1174,21 +1176,6 @@ function hsshow(filter, fullmode)
preview_window_show(); 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, advance on tab
* if index < 0, go one tab to the left * 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); 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 // scrolling ////////////////////////////////////////////////////// {{{1
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
@@ -1356,6 +1389,9 @@ function zoom_in(factor)
if (value > 500) value = 500; if (value > 500) value = 500;
zoomMgr.textZoom = value; zoomMgr.textZoom = value;
hah.reshowHints();
echo("Zoom value: " + value + "%"); echo("Zoom value: " + value + "%");
} }
} }
@@ -1386,6 +1422,9 @@ function zoom_to(value)
} }
zoomMgr.textZoom = value; zoomMgr.textZoom = value;
hah.reshowHints();
echo("Zoom value: " + value + "%"); echo("Zoom value: " + value + "%");
} }
@@ -1911,17 +1950,4 @@ function showMode()
echo("-- " + g_modemessages[g_current_mode] + " --"); 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: // vim: set fdm=marker sw=4 ts=4 et:

View File

@@ -265,7 +265,11 @@ function hit_a_hint()
function onResize(event) function onResize(event)
{ {
if(event)
doc = event.originalTarget; doc = event.originalTarget;
else
doc = window._content.document;
invalidateCoords(doc); invalidateCoords(doc);
startCoordLoader(doc); startCoordLoader(doc);
} }
@@ -441,6 +445,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 // this function 'click' an element, which also works
// for javascript links // for javascript links

View File

@@ -92,7 +92,7 @@ var g_settings = [/*{{{*/
function(value) { set_pref("focusedhintstyle", value); }, function(value) { set_pref("focusedhintstyle", value); },
function() { return get_pref("focusedhintstyle"); }, function() { return get_pref("focusedhintstyle"); },
"string", "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,
null null
], ],
@@ -136,7 +136,7 @@ var g_settings = [/*{{{*/
function(value) { set_pref("hintstyle", value); }, function(value) { set_pref("hintstyle", value); },
function() { return get_pref("hintstyle"); }, function() { return get_pref("hintstyle"); },
"string", "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,
null null
], ],

View File

@@ -11,7 +11,9 @@ beep commands.js /^function beep()$/;" f
bmadd commands.js /^function bmadd(str)$/;" f bmadd commands.js /^function bmadd(str)$/;" f
bmdel commands.js /^function bmdel(str)$/;" f bmdel commands.js /^function bmdel(str)$/;" f
bmshow commands.js /^function bmshow(filter, fullmode)$/;" f bmshow commands.js /^function bmshow(filter, fullmode)$/;" f
bushow commands.js /^function bushow(filter)$/;" 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 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_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_fill_list completion.js /^function completion_fill_list(startindex)\/*{{{*\/$/;" f
@@ -53,7 +55,7 @@ get_url_completions completion.js /^function get_url_completions(filter)\/*{{{*\
get_url_mark commands.js /^function get_url_mark(mark)$/;" f get_url_mark commands.js /^function get_url_mark(mark)$/;" f
goUp commands.js /^function goUp() \/\/ FIXME$/;" f goUp commands.js /^function goUp() \/\/ FIXME$/;" f
hasMode commands.js /^function hasMode(mode)$/;" 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 hit_a_hint hints.js /^function hit_a_hint()$/;" f
hsshow commands.js /^function hsshow(filter, fullmode)$/;" f hsshow commands.js /^function hsshow(filter, fullmode)$/;" f
init vimperator.js /^function init()$/;" f init vimperator.js /^function init()$/;" f
@@ -78,6 +80,7 @@ outputAddonsList commands.js /^function outputAddonsList(aTarget)$/;" f
parseBookmarkString bookmarks.js /^function parseBookmarkString(str, res)$/;" f parseBookmarkString bookmarks.js /^function parseBookmarkString(str, res)$/;" f
preview_window_fill completion.js /^function preview_window_fill(completions)$/;" 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_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 quit commands.js /^function quit(save_session)$/;" f
reload commands.js /^function reload(all_tabs)$/;" f reload commands.js /^function reload(all_tabs)$/;" f
removeHints hints.js /^ function removeHints(win)$/;" f removeHints hints.js /^ function removeHints(win)$/;" f
@@ -99,6 +102,7 @@ set_pref settings.js /^function set_pref(name, value)$/;" f
set_showtabline settings.js /^function set_showtabline(value)$/;" f set_showtabline settings.js /^function set_showtabline(value)$/;" f
set_url_mark commands.js /^function set_url_mark(mark, url)$/;" 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 showStatusbarMessage vimperator.js /^function showStatusbarMessage(msg, field)$/;" f
show_location_marks commands.js /^function show_location_marks(mark)$/;" f show_location_marks commands.js /^function show_location_marks(mark)$/;" f
show_url_marks commands.js /^function show_url_marks(mark)$/;" f show_url_marks commands.js /^function show_url_marks(mark)$/;" f

View File

@@ -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_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_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 // handles to our gui elements
var preview_window = null; var preview_window = null;
@@ -82,9 +83,9 @@ nsBrowserStatusHandler.prototype =
setOverLink : function(link, b) setOverLink : function(link, b)
{ {
if (link != "")
echo(link); echo(link);
else
if (link == "")
showMode(); showMode();
}, },