From 18b1bec16c630a2f1d4071f9aeb355dd40f6f5da Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Tue, 21 Aug 2007 21:54:43 +0000 Subject: [PATCH 001/224] merge HEAD From 3f6e7e87662b34bc542d08b7a25f289e3f88412b Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Thu, 23 Aug 2007 13:38:14 +0000 Subject: [PATCH 002/224] use 0.5 for the version strings --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 9d42e5a2..52984f12 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ TOP = $(shell pwd) -VERSION = 0.6 +VERSION = 0.5 OS = $(shell uname -s) BUILD_DATE = $(shell date "+%Y/%m/%d %H:%M:%S") From 1c8373041a063d53174eb8ccbc39d9456ee5c5b1 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Thu, 23 Aug 2007 14:07:25 +0000 Subject: [PATCH 003/224] allow ~/_vimperatorrc as the RC file and ~/vimperator/plugin as the plugin directory on Windows --- chrome/content/vimperator/vimperator.js | 112 ++++++++++++++++-------- 1 file changed, 77 insertions(+), 35 deletions(-) diff --git a/chrome/content/vimperator/vimperator.js b/chrome/content/vimperator/vimperator.js index 07248c01..d0e6019a 100644 --- a/chrome/content/vimperator/vimperator.js +++ b/chrome/content/vimperator/vimperator.js @@ -32,9 +32,6 @@ const vimperator = (function() //{{{ ////////////////////// PRIVATE SECTION ///////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////{{{ - const RC_FILE = "~/.vimperatorrc"; - const PLUGIN_DIR = "~/.vimperator/plugin"; - var modes = { // main modes NONE: 0, @@ -118,11 +115,8 @@ const vimperator = (function() //{{{ var home = environment_service.get("HOME"); if (WINDOWS && !home) - { - home = environment_service.get("USERPROFILE"); - if (!home) - home = environment_service.get("HOMEDRIVE") + environment_service.get("HOMEPATH"); - } + home = environment_service.get("USERPROFILE") || + environment_service.get("HOMEDRIVE") + environment_service.get("HOMEPATH"); path = path.replace("~", home); } @@ -145,6 +139,46 @@ const vimperator = (function() //{{{ return path; } + // TODO: add this functionality to LocalFile or wait for Scriptable I/O in FUEL + function pathExists(path) + { + var p = Components.classes["@mozilla.org/file/local;1"] + .createInstance(Components.interfaces.nsILocalFile); + p.initWithPath(expandPath(path)); + + return p.exists(); + } + + function getPluginDir() + { + var plugin_dir; + + if (navigator.platform == "Win32") + plugin_dir = "~/vimperator/plugin"; + else + plugin_dir = "~/.vimperator/plugin"; + + plugin_dir = expandPath(plugin_dir); + + return pathExists(plugin_dir) ? plugin_dir : null; + } + + function getRCFile() + { + var rc_file1 = expandPath("~/.vimperatorrc"); + var rc_file2 = expandPath("~/_vimperatorrc"); + + if (navigator.platform == "Win32") + [rc_file1, rc_file2] = [rc_file2, rc_file1] + + if (pathExists(rc_file1)) + return rc_file1; + else if (pathExists(rc_file2)) + return rc_file2; + else + return null; + } + /////////////////////////////////////////////////////////////////////////////}}} ////////////////////// PUBLIC SECTION ////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////{{{ @@ -169,14 +203,12 @@ const vimperator = (function() //{{{ count: -1 // parsed count from the input buffer }, - /** - * @param type can be: - * "submit": when the user pressed enter in the command line - * "change" - * "cancel" - * "complete" - * TODO: "zoom": if the zoom value of the current buffer changed - */ + // @param type can be: + // "submit": when the user pressed enter in the command line + // "change" + // "cancel" + // "complete" + // TODO: "zoom": if the zoom value of the current buffer changed registerCallback: function(type, mode, func) { // TODO: check if callback is already registered @@ -207,7 +239,7 @@ const vimperator = (function() //{{{ if (main) { mode = main; - extended_mode = this.modes.NONE; + extended_mode = vimperator.modes.NONE; } if (typeof extended === "number") extended_mode = extended; @@ -304,19 +336,15 @@ const vimperator = (function() //{{{ return new LocalFile(path, mode, perms, tmp); }, - /** - * logs a message to the javascript error console - */ + // logs a message to the javascript error console log: function(msg, level) { // if (Options.getPref("verbose") >= level) // FIXME: hangs vimperator, probably timing issue --mst console_service.logStringMessage('vimperator: ' + msg); }, - /** - * logs an object to the javascript error console also prints all - * properties of the object - */ + // logs an object to the javascript error console also prints all + // properties of the object logObject: function(object, level) { if (typeof object != 'object') @@ -337,7 +365,7 @@ const vimperator = (function() //{{{ string += i + ': ' + value + '\n'; } - this.log(string, level); + vimperator.log(string, level); }, // open one or more URLs @@ -512,7 +540,7 @@ const vimperator = (function() //{{{ }); } - vimperator.log("Sourced: " + filename, 1); + vimperator.log("Sourced: " + filename, 3); } catch (e) { @@ -584,20 +612,34 @@ const vimperator = (function() //{{{ // make sourcing asynchronous, otherwise commands that open new tabs won't work setTimeout(function() { - vimperator.source(RC_FILE, true); + var rc_file = getRCFile(); + + if (rc_file) + vimperator.source(rc_file, true); + else + vimperator.log("No user RC file found", 3); // also source plugins in ~/.vimperator/plugin/ var entries = []; try { - var plugin_dir = expandPath(PLUGIN_DIR); - var fd = vimperator.fopen(plugin_dir); - var entries = fd.read(); - fd.close(); - entries.forEach(function(file) { - if (!file.isDirectory()) - vimperator.source(file.path, false); - }); + var plugin_dir = getPluginDir(); + + if (plugin_dir) + { + var fd = vimperator.fopen(plugin_dir); + var entries = fd.read(); + fd.close(); + vimperator.log("Sourcing plugin directory...", 3); + entries.forEach(function(file) { + if (!file.isDirectory()) + vimperator.source(file.path, false); + }); + } + else + { + vimperator.log("No user plugin directory found", 3); + } } catch (e) { From d8c5ce148c0488c402dd051389297cc9b116d63b Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Fri, 24 Aug 2007 11:12:24 +0000 Subject: [PATCH 004/224] make sure the active listcell in the second column of the preview window uses HighlightText as the CSS color value and move the #vimperator-multiline-output styles to default.css --- chrome/content/vimperator/default.css | 10 +++++++--- chrome/content/vimperator/vimperator.xul | 3 +-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/chrome/content/vimperator/default.css b/chrome/content/vimperator/default.css index 0ace7442..a7dee5a6 100644 --- a/chrome/content/vimperator/default.css +++ b/chrome/content/vimperator/default.css @@ -144,9 +144,9 @@ fieldset.paypal { } /* the selected item in listboxes is hardly readable without this */ -#vimperator-completion > listitem[selected="true"], -#vimperator-bufferwindow > listitem[selected="true"], -#vimperator-previewwindow > listitem[selected="true"] +#vimperator-completion > listitem[selected="true"] > listcell, +#vimperator-bufferwindow > listitem[selected="true"] > listcell, +#vimperator-previewwindow > listitem[selected="true"] > listcell { background-color: Highlight !important; color: HighlightText !important; @@ -169,6 +169,10 @@ fieldset.paypal { color: black; } +#vimperator-multiline-output { + overflow: hidden; +} + .status_insecure, .status_insecure * { background-color: transparent; } diff --git a/chrome/content/vimperator/vimperator.xul b/chrome/content/vimperator/vimperator.xul index 369837e4..16868ae0 100644 --- a/chrome/content/vimperator/vimperator.xul +++ b/chrome/content/vimperator/vimperator.xul @@ -101,8 +101,7 @@ the terms of any one of the MPL, the GPL or the LGPL. onblur="vimperator.commandline.onEvent(event);"/> -