From abeafde55f9356242c4f74a19adf67ef841c36fb Mon Sep 17 00:00:00 2001 From: Martin Stubenschrott Date: Sun, 29 Apr 2007 03:35:34 +0000 Subject: [PATCH] changed ":help open" to ":help :open" --- chrome/content/vimperator/commands.js | 2 +- chrome/content/vimperator/completion.js | 33 ++++++++---- chrome/content/vimperator/help.js | 67 ++++++++++++------------- chrome/content/vimperator/tags | 24 +++++---- chrome/content/vimperator/vimperator.js | 1 - 5 files changed, 73 insertions(+), 54 deletions(-) diff --git a/chrome/content/vimperator/commands.js b/chrome/content/vimperator/commands.js index cf6e11cc..64013f19 100644 --- a/chrome/content/vimperator/commands.js +++ b/chrome/content/vimperator/commands.js @@ -700,7 +700,7 @@ var g_mappings = [/*{{{*/ ["h", ""], ["{count}h", "{count}"], "Scroll document to the left", - "Count is supported: 10h will move 10 times as much to the left.", + "Count is supported: 10h will move 10 times as much to the left.
"+ "If the document cannot scroll more, a beep is emmited (unless 'beep' is turned off).", function(count) { scrollBufferRelative(-1, 0); } ], diff --git a/chrome/content/vimperator/completion.js b/chrome/content/vimperator/completion.js index dd505ace..464a9255 100644 --- a/chrome/content/vimperator/completion.js +++ b/chrome/content/vimperator/completion.js @@ -260,23 +260,23 @@ function build_longest_starting_substring(list, filter)/*{{{*/ var filter_length = filter.length; for (var i = 0; i < list.length; i++) { - for (var j = 0; j < list[i][0].length; j++) + for (var j = 0; j < list[i][COMMANDS].length; j++) { if (list[i][0][j].indexOf(filter) != 0) continue; if (g_substrings.length == 0) { - var length = list[i][0][j].length; + var length = list[i][COMMANDS][j].length; for (var k = filter_length; k <= length; k++) - g_substrings.push(list[i][0][j].substring(0, k)); + g_substrings.push(list[i][COMMANDS][j].substring(0, k)); } else { g_substrings = g_substrings.filter(function($_) { - return list[i][0][j].indexOf($_) == 0; + return list[i][COMMANDS][j].indexOf($_) == 0; }); } - filtered.push([list[i][0][j], list[i][1]]); + filtered.push([list[i][COMMANDS][j], list[i][SHORTHELP]]); break; } } @@ -478,12 +478,27 @@ function get_help_completions(filter)/*{{{*/ { var help_array = []; g_substrings = []; - help_array = help_array.concat(g_commands); - help_array = help_array.concat(get_settings_completions(filter, true)); - help_array = help_array.concat(g_mappings); + help_array = help_array.concat(g_commands.map(function($_) { + return [ + $_[COMMANDS].map(function($_) { return ":" + $_; }), + $_[SHORTHELP] + ]; + })); + settings = get_settings_completions(filter, true); + help_array = help_array.concat(settings.map(function($_) { + return [ + $_[COMMANDS].map(function($_) { return "'" + $_ + "'"; }), + $_[1] + ]; + })); + help_array = help_array.concat(g_mappings.map(function($_) { + return [ $_[COMMANDS], $_[SHORTHELP] ]; + })); + if (!filter) return help_array.map(function($_) { - return [$_[COMMANDS][0], $_[SHORTHELP]]; + return [$_[COMMANDS][0], $_[1]]; // unfiltered, use the first command }); + return build_longest_common_substring(help_array, filter); }/*}}}*/ diff --git a/chrome/content/vimperator/help.js b/chrome/content/vimperator/help.js index a058951e..0dec1e2a 100644 --- a/chrome/content/vimperator/help.js +++ b/chrome/content/vimperator/help.js @@ -38,35 +38,6 @@ function help(section, easter) var doc = window.content.document; - var header = '

Vimperator

' + - '

First there was a Navigator, then there was an Explorer.
'+ - 'Later it was time for a Konqueror. Now it\'s time for an Imperator, the VIMperator :)

'; - - var introduction = '

Introduction

' + - '

Vimperator is a free browser add-on for Firefox, which makes it look and behave like the Vim text editor.
' + - 'It has similar key bindings, and you could call it a modal webbrowser, as key bindings differ according to which mode you are in.

' + - - '

Warning: To provide the most authentic Vim experience, the Firefox menubar and toolbar were hidden.
'+ - 'If you really need them, type: :set guioptions=mT to get it back.
' + - 'If you don\'t like Vimperator at all, you can uninstall it by typing :addons and remove/disable it.
' + - 'If you like it, but can\'t remember the shortcuts, press F1 or :help to get this help window back.

' + - - '

Since Vimperator\'s GUI is embedded into a toolbar, it may look too 3D-like with the default theme.
'+ - 'For best experience, I therefore recommend the Whitehart theme.

' + - - '

Vimperator was written by Martin Stubenschrott. If you appreciate my work on Vimperator, you can either
'+ - 'send me greetings, patches or make a donation: ' + - - '

' + - '' + - '' + - - '' + - '' + - '
' + - - 'Of course as a believer in free open source software, only make a donation if you really like Vimperator, and the money doesn\'t hurt - otherwise just use it, recommend it and like it :)

' - // xxx: for firebug: :js Firebug.toggleBar(true) /* commands = array where help information is located @@ -124,7 +95,7 @@ function help(section, easter) var cmd_name = commands[i][COMMANDS][j]; cmd_name = cmd_name.replace(//g, ">"); - ret += "" +beg+ cmd_name +end+ '
'; + ret += '' +beg+ cmd_name +end+ '
'; } ret += ''; @@ -157,6 +128,35 @@ function help(section, easter) return ret; } + var header = '

Vimperator

' + + '

First there was a Navigator, then there was an Explorer.
'+ + 'Later it was time for a Konqueror. Now it\'s time for an Imperator, the VIMperator :)

'; + + var introduction = '

Introduction

' + + '

Vimperator is a free browser add-on for Firefox, which makes it look and behave like the Vim text editor.
' + + 'It has similar key bindings, and you could call it a modal webbrowser, as key bindings differ according to which mode you are in.

' + + + '

Warning: To provide the most authentic Vim experience, the Firefox menubar and toolbar were hidden.
'+ + 'If you really need them, type: :set guioptions=mT to get it back.
' + + 'If you don\'t like Vimperator at all, you can uninstall it by typing :addons and remove/disable it.
' + + 'If you like it, but can\'t remember the shortcuts, press F1 or :help to get this help window back.

' + + + '

Since Vimperator\'s GUI is embedded into a toolbar, it may look too 3D-like with the default theme.
'+ + 'For best experience, I therefore recommend the Whitehart theme.

' + + + '

Vimperator was written by Martin Stubenschrott. If you appreciate my work on Vimperator, you can either
'+ + 'send me greetings, patches or make a donation: ' + + + '

' + + '' + + '' + + + '' + + '' + + '
' + + + 'Of course as a believer in free open source software, only make a donation if you really like Vimperator, and the money doesn\'t hurt - otherwise just use it, recommend it and like it :)

' + var mappings = '

Mappings

'+ '

The denotion of modifier keys is like in Vim, so C- means the Control key, M- the Meta key, A- the Alt key and S- the Shift key.

'+ '

' @@ -181,15 +181,14 @@ function help(section, easter) var fulldoc = 'Vimperator help' + // XXX: stylesheet broken here? Have to add it in the vimperator.xul file ''+ - '
' + // should change that to: white-space: pre-wrap; once CSS3 hits firefox
+        '
' + // should change that to: white-space: pre-wrap; once CSS3 hits firefox header + introduction + mappings + commands + settings + - '' + '
' -// fulldoc = 'Vimperator help

hallo

'; doc.open(); doc.write(fulldoc); @@ -222,7 +221,7 @@ function help(section, easter) } var pos = cumulativeOffset(element); // horizontal offset is annyoing, set it to 0 (use pos[0] if you want horizontal offset) - window.content.scrollTo(0, pos[1]); + window.content.scrollTo(0, pos[1] - 50); // 50 pixel context lines } } diff --git a/chrome/content/vimperator/tags b/chrome/content/vimperator/tags index cbdf3361..76fd25db 100644 --- a/chrome/content/vimperator/tags +++ b/chrome/content/vimperator/tags @@ -14,12 +14,15 @@ bmdel commands.js /^function bmdel(str)$/;" f bmshow commands.js /^function bmshow(filter, fullmode)$/;" f buffer_preview_toggle commands.js /^function buffer_preview_toggle()$/;" f buffer_preview_update commands.js /^function buffer_preview_update(event)$/;" f +buffer_switch commands.js /^function buffer_switch(string)$/;" f bufshow commands.js /^function bufshow(filter, in_comp_window)$/;" f +build_longest_common_substring completion.js /^function build_longest_common_substring(list, filter)\/*{{{*\/$/;" f +build_longest_starting_substring completion.js /^function build_longest_starting_substring(list, filter)\/*{{{*\/$/;" 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 -completion_select_previous_item completion.js /^function completion_select_previous_item()\/*{{{*\/$/;" f +completion_select_next_item completion.js /^function completion_select_next_item(has_list, has_full, has_longest)\/*{{{*\/$/;" f +completion_select_previous_item completion.js /^function completion_select_previous_item(has_list, has_full, has_longest)\/*{{{*\/$/;" f completion_show_list completion.js /^function completion_show_list()\/*{{{*\/$/;" f copyToClipboard commands.js /^function copyToClipboard(str)$/;" f createCursorPositionString vimperator.js /^function createCursorPositionString()$/;" f @@ -32,7 +35,7 @@ echo commands.js /^function echo(msg)$/;" f echoerr commands.js /^function echoerr(msg)$/;" f execute commands.js /^function execute(string)$/;" f execute_command commands.js /^function execute_command(count, cmd, special, args, modifiers) \/\/ {{{$/;" f -filter_url_array completion.js /^function filter_url_array(urls, filter, use_regex)\/*{{{*\/$/;" f +filter_url_array completion.js /^function filter_url_array(urls, filter)\/*{{{*\/$/;" f focusContent vimperator.js /^function focusContent(clear_command_line, clear_statusline)$/;" f focusNextFrame commands.js /^function focusNextFrame()$/;" f fopen file.js /^function fopen (path, mode, perms, tmp)$/;" f @@ -49,19 +52,21 @@ getLinkNodes vimperator.js /^function getLinkNodes(doc)$/;" f getPageLinkNodes vimperator.js /^function getPageLinkNodes()$/;" f getProperty bookmarks.js /^function getProperty( aInput, aArc, DS )$/;" f get_bookmark_completions completion.js /^function get_bookmark_completions(filter)\/*{{{*\/$/;" f -get_buffer_completions completion.js /^function get_buffer_completions(filter)$/;" f +get_buffer_completions completion.js /^function get_buffer_completions(filter)\/*{{{*\/$/;" f get_command commands.js /^function get_command(cmd) \/\/ {{{$/;" f get_command_completions completion.js /^function get_command_completions(filter)\/*{{{*\/$/;" f get_file_completions completion.js /^function get_file_completions(filter)\/*{{{*\/$/;" f get_firefox_pref settings.js /^function get_firefox_pref(name, default_value)$/;" f -get_help_completions completion.js /^function get_help_completions(filter)$/;" f +get_help_completions completion.js /^function get_help_completions(filter)\/*{{{*\/$/;" f get_history_completions completion.js /^function get_history_completions(filter)\/*{{{*\/$/;" f +get_longest_substring completion.js /^function get_longest_substring()\/*{{{*\/$/;" f get_pref settings.js /^function get_pref(name, forced_default)$/;" f get_search_completions completion.js /^function get_search_completions(filter)\/*{{{*\/$/;" f -get_setting settings.js /^function get_setting(cmd)$/;" f -get_settings_completions completion.js /^function get_settings_completions(filter)\/*{{{*\/$/;" f +get_setting settings.js /^function get_setting(cmd)\/*{{{*\/$/;" f +get_settings_completions completion.js /^function get_settings_completions(filter, unfiltered)\/*{{{*\/$/;" f get_url_completions completion.js /^function get_url_completions(filter)\/*{{{*\/$/;" f get_url_mark commands.js /^function get_url_mark(mark)$/;" f +goUp commands.js /^function goUp(count)$/;" f hasMode commands.js /^function hasMode(mode)$/;" f help help.js /^function help(section, easter)$/;" f historyGoToBeginning commands.js /^function historyGoToBeginning()$/;" f @@ -71,6 +76,7 @@ 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 +isDirectory commands.js /^function isDirectory(url)$/;" f isFormElemFocused vimperator.js /^function isFormElemFocused()$/;" f keyToString vimperator.js /^function keyToString(event)$/;" f load_history completion.js /^function load_history()$/;" f @@ -91,8 +97,8 @@ openURLsInNewTab commands.js /^function openURLsInNewTab(str, activate)$/;" f openVimperatorBar vimperator.js /^function openVimperatorBar(str)$/;" f 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_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 diff --git a/chrome/content/vimperator/vimperator.js b/chrome/content/vimperator/vimperator.js index 838bf90a..e51df2cc 100644 --- a/chrome/content/vimperator/vimperator.js +++ b/chrome/content/vimperator/vimperator.js @@ -771,7 +771,6 @@ function onEscape() if (!hasMode(MODE_ESCAPE_ONE_KEY)) { setCurrentMode(MODE_NORMAL); - // BrowserStop(); -> moved to hah.disableHahMode(); focusContent(true, true); }