diff --git a/ChangeLog b/ChangeLog index 96b0cacf..7d964fd4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,9 @@
date: * version 0.4 + * fixed saving of session + * '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 * :open! bypasses cache * :buffer and :buffers support (patch from Lars Kindler) diff --git a/TODO b/TODO index 7e1676f7..8691bb16 100644 --- a/TODO +++ b/TODO @@ -51,4 +51,6 @@ 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 0bb304eb..e73865d8 100644 --- a/chrome/content/vimperator/commands.js +++ b/chrome/content/vimperator/commands.js @@ -1160,7 +1160,7 @@ function bmshow(filter, fullmode) { var items = get_bookmark_completions(filter); preview_window_fill(items); - preview_window.hidden = false; + preview_window_show(); } } function hsshow(filter, fullmode) @@ -1171,7 +1171,7 @@ function hsshow(filter, fullmode) { var items = get_history_completions(filter); preview_window_fill(items); - preview_window.hidden = false; + preview_window_show(); } } function bushow(filter, in_comp_window) @@ -1186,7 +1186,7 @@ function bushow(filter, in_comp_window) { var items = get_buffer_completions(filter); preview_window_fill(items); - preview_window.hidden = false; + preview_window_show(); } } @@ -1418,10 +1418,10 @@ function beep() // quit vimperator, no matter how many tabs/windows are open function quit(save_session) { - if (save_history) - set_firefox_pref("browser.sessionstore.resume_session_once", true); + if (save_session) + set_firefox_pref("browser.startup.page", 3); // start with saved session else - set_firefox_pref("browser.sessionstore.resume_session_once", false); + set_firefox_pref("browser.startup.page", 1); // start with default homepage session goQuitApplication(); } diff --git a/chrome/content/vimperator/completion.js b/chrome/content/vimperator/completion.js index dd515e99..d612f892 100644 --- a/chrome/content/vimperator/completion.js +++ b/chrome/content/vimperator/completion.js @@ -71,11 +71,8 @@ function completion_show_list()/*{{{*/ items = COMPLETION_MAXITEMS; if (items > 1) // FIXME { - //alert(completion_list.getRowCount().toString()); completion_list.setAttribute("rows", items.toString()); - //completion_list.rowCountChanged(0, items); completion_list.hidden = false; - //completion_list.selectedIndex = selected_index; } else completion_list.hidden = true; @@ -514,4 +511,16 @@ function preview_window_select(event) return false; } +function preview_window_show()/*{{{*/ +{ + var items = preview_window.getElementsByTagName("listitem").length; + var height = get_pref("previewheight"); + if (items > height) + items = height; + if (items < 3) + items = 3; + + preview_window.setAttribute("rows", items.toString()); + preview_window.hidden = false; +}/*}}}*/ // vim: set fdm=marker sw=4 ts=4 et: diff --git a/chrome/content/vimperator/settings.js b/chrome/content/vimperator/settings.js index 89398933..1c1cff6d 100644 --- a/chrome/content/vimperator/settings.js +++ b/chrome/content/vimperator/settings.js @@ -173,6 +173,17 @@ var g_settings = [/*{{{*/ true, null, null + ], + [ + ["previewheight", "pvh"], + "Default height for preview window", + "Value must be between 1 and 50. If the value is too high, completions may cover the command-line. Close the preview window with
:pclose.",
+ function(value) { set_pref("previewheight", value); },
+ function() { return get_pref("previewheight"); },
+ "number",
+ 10,
+ function (value) { if (value>=1 && value <=50) return true; else return false; },
+ null
],
[
["showmode", "smd"],
diff --git a/chrome/content/vimperator/vimperator.js b/chrome/content/vimperator/vimperator.js
index 09727c95..7fb502f6 100644
--- a/chrome/content/vimperator/vimperator.js
+++ b/chrome/content/vimperator/vimperator.js
@@ -272,7 +272,7 @@ function init()
setTimeout(function() { get_url_completions(""); } , 100);
// firefox preferences which we need to be changed to work well with vimperator
- set_firefox_pref("browser.sessionstore.resume_session_once", true);
+ set_firefox_pref("browser.startup.page", 3); // start with saved session
logMessage("Initialized");
}