From 3e1bd07ec8e499f16b9165c64e5c4379cf705cd2 Mon Sep 17 00:00:00 2001 From: Martin Stubenschrott Date: Wed, 27 Jun 2007 14:35:11 +0000 Subject: [PATCH] :marks support --- chrome/content/vimperator/bookmarks.js | 24 +++++++++++++++++ chrome/content/vimperator/ui.js | 37 ++++++++++++++------------ 2 files changed, 44 insertions(+), 17 deletions(-) diff --git a/chrome/content/vimperator/bookmarks.js b/chrome/content/vimperator/bookmarks.js index cc7ff244..ea08f5df 100644 --- a/chrome/content/vimperator/bookmarks.js +++ b/chrome/content/vimperator/bookmarks.js @@ -526,6 +526,30 @@ function Marks() //{{{ // TODO: show marks like vim does (when the multiline echo impl is done) or in the preview window right now this.list = function() { + // FIXME: hashes don't have a .length property --mst +// if (local_marks.length + url_marks.length < 1) +// { +// vimperator.echoerr("No marks defined"); +// return; +// } + + var list = ""; + for (var i in local_marks) + { + list += ""; + } + for (var j in url_marks) + { + list += ""; + } + list += "
marklinecolfile
" + i + "" + + Math.round(local_marks[i][0].position.y *100)+ "%" + + Math.round(local_marks[i][0].position.x *100)+ "%" + + local_marks[i][0].location + "
" + j + "" + + Math.round(url_marks[j].position.y *100)+ "%" + + Math.round(url_marks[j].position.x *100)+ "%" + + url_marks[j].location + "
"; + vimperator.commandline.echo(list, true); // TODO: force of multiline widget a better way } //}}} } //}}} diff --git a/chrome/content/vimperator/ui.js b/chrome/content/vimperator/ui.js index 7e3b5fc3..d02714bb 100644 --- a/chrome/content/vimperator/ui.js +++ b/chrome/content/vimperator/ui.js @@ -133,20 +133,14 @@ function CommandLine() //{{{ // Sets the command - e.g. 'tabopen', 'open http://example.com/' function setCommand(cmd) { - // FIXME: very simple, buggy version as of yet, just a tech-demo --mst - //multiline_widget.contentDocument.designMode ="on"; - // multiline - if (cmd.indexOf("\n") > -1 || cmd.indexOf("\\n") > -1 || cmd.indexOf("
") > -1 || cmd.indexOf("
") > -1) - { - multiline_widget.collapsed = false; - cmd = cmd.replace(/\n|\\n/g, "
") + "
Press ENTER or type command to continue"; - multiline_widget.contentDocument.body.innerHTML = cmd; - } - else - { - multiline_widget.collapsed = true; - command_widget.value = cmd; - } + command_widget.value = cmd; + } + + function setMultiline(cmd) + { + multiline_widget.collapsed = false; + cmd = cmd.replace(/\n|\\n/g, "
") + "
Press ENTER or type command to continue"; + multiline_widget.contentDocument.body.innerHTML = cmd; } function addToHistory(str) @@ -193,15 +187,24 @@ function CommandLine() //{{{ command_widget.focus(); }; - this.echo = function(str) + // FIXME: flags not yet really functional --mst + this.echo = function(str, flags) { var focused = document.commandDispatcher.focusedElement; if (!echo_allowed && focused && focused == command_widget.inputField) return false; setNormalStyle(); - setPrompt(""); - setCommand(str); + if (flags || str.indexOf("\n") > -1 || str.indexOf("\\n") > -1 || str.indexOf("
") > -1 || str.indexOf("
") > -1) + { + setMultiline(str); + } + else + { + multiline_widget.collapsed = true; + setPrompt(""); + setCommand(str); + } cur_extended_mode = null; return true; };