1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-22 00:17:58 +01:00

added flags to vimperator.commandline.echo()

This commit is contained in:
Martin Stubenschrott
2007-10-08 23:22:04 +00:00
parent ad5138cf91
commit 2521d3e693
11 changed files with 45 additions and 30 deletions

View File

@@ -277,7 +277,7 @@ function Bookmarks() //{{{
}
list += "</table>";
vimperator.commandline.echo(list, vimperator.commandline.HL_NORMAL, true);
vimperator.commandline.echo(list, vimperator.commandline.HL_NORMAL, vimperator.commandline.FORCE_MULTILINE);
}
}
}
@@ -501,7 +501,7 @@ function History() //{{{
}
list += "</table>";
vimperator.commandline.echo(list, vimperator.commandline.HL_NORMAL, true);
vimperator.commandline.echo(list, vimperator.commandline.HL_NORMAL, vimperator.commandline.FORCE_MULTILINE);
}
}
}
@@ -758,7 +758,7 @@ function Marks() //{{{
}
list += "</table>";
vimperator.commandline.echo(list, vimperator.commandline.HL_NORMAL, true); // TODO: force of multiline widget a better way
vimperator.commandline.echo(list, vimperator.commandline.HL_NORMAL, vimperator.commandline.FORCE_MULTILINE); // TODO: force of multiline widget a better way
}
//}}}
} //}}}
@@ -850,7 +850,7 @@ function QuickMarks() //{{{
}
list += "</table>";
vimperator.commandline.echo(list, vimperator.commandline.HL_NORMAL, true); // TODO: force of multiline widget a better way
vimperator.commandline.echo(list, vimperator.commandline.HL_NORMAL, vimperator.commandline.FORCE_MULTILINE); // TODO: force of multiline widget a better way
}
this.destroy = function()

View File

@@ -253,7 +253,7 @@ function Buffer() //{{{
}
list += "</table>";
vimperator.commandline.echo(list, vimperator.commandline.HL_NORMAL, true);
vimperator.commandline.echo(list, vimperator.commandline.HL_NORMAL, vimperator.commandline.FORCE_MULTILINE);
}
}

View File

@@ -284,11 +284,10 @@ function Commands() //{{{
result.title = result.url;
vimperator.bookmarks.add(result.title, result.url);
vimperator.echo("Bookmark `" + result.title + "' added with url `" + result.url + "'");
vimperator.echo("Bookmark `" + result.title + "' added with url `" + result.url + "'", vimperator.commandline.FORCE_SINGLELINE);
}
else
{
//vimperator.echo("Usage: :bmark [-t \"My Title\"] [-T tag1,tag2] <url>");
vimperator.echoerr("E474: Invalid argument");
}
},
@@ -385,7 +384,7 @@ function Commands() //{{{
result.url = vimperator.buffer.URL;
var deleted_count = vimperator.bookmarks.remove(result.url);
vimperator.echo(deleted_count + " bookmark(s) with url `" + result.url + "' deleted");
vimperator.echo(deleted_count + " bookmark(s) with url `" + result.url + "' deleted", vimperator.commandline.FORCE_SINGLELINE);
}
else
{
@@ -680,7 +679,7 @@ function Commands() //{{{
str += "<tr><td style=\"width: 200px;\">" + i + "</td><td>" + prefix + value + "</td>\n";
}
if (str)
vimperator.echo("<table>" + str + "</table>", true);
vimperator.echo("<table>" + str + "</table>", vimperator.commandline.FORCE_MULTILINE);
else
vimperator.echo("No variables found");
return;
@@ -1471,7 +1470,7 @@ function Commands() //{{{
"<tr>" + total + "</tr>" +
"</table>";
vimperator.commandline.echo(str, vimperator.commandline.HL_NORMAL, true);
vimperator.commandline.echo(str, vimperator.commandline.HL_NORMAL, vimperator.commandline.FORCE_MULTILINE);
}
else
{

View File

@@ -845,7 +845,7 @@ function Events() //{{{
if (ssli == 1)
vimperator.statusline.updateUrl("Link: " + link);
else if (ssli == 2)
vimperator.echo("Link: " + link);
vimperator.echo("Link: " + link, vimperator.commandline.DISALLOW_MULTILINE);
}
if (link == "")

View File

@@ -168,7 +168,7 @@ function Search() //{{{
}
else
{
vimperator.echo((up ? "?" : "/") + last_search_pattern);
vimperator.echo((up ? "?" : "/") + last_search_pattern, null, vimperator.commandline.FORCE_SINGLELINE);
if (vimperator.options["hlsearch"])
this.highlight(last_search_string);

View File

@@ -520,7 +520,7 @@ function Hints() //{{{
this.disableHahMode(null, true);
vimperator.copyToClipboard(loc);
vimperator.echo("Yanked " + loc);
vimperator.echo("Yanked " + loc, vimperator.commandline.FORCE_SINGLELINE);
};
this.yankTextHints = function()
@@ -543,7 +543,7 @@ function Hints() //{{{
this.disableHahMode(null, true);
vimperator.copyToClipboard(loc);
vimperator.echo("Yanked " + loc);
vimperator.echo("Yanked " + loc, vimperator.commandline.FORCE_SINGLELINE);
};
function setMouseOverElement(elem)

View File

@@ -295,7 +295,7 @@ function Mappings() //{{{
}
list += "</table>";
vimperator.commandline.echo(list, vimperator.commandline.HL_NORMAL, true); // TODO: force of multiline widget a better way
vimperator.commandline.echo(list, vimperator.commandline.HL_NORMAL, vimperator.commandline.FORCE_MULTILINE);
}
/////////////////////////////////////////////////////////////////////////////}}}
@@ -678,7 +678,7 @@ function Mappings() //{{{
{
var url = vimperator.buffer.URL;
vimperator.copyToClipboard(url);
vimperator.echo("Yanked " + url);
vimperator.echo("Yanked " + url, vimperator.commandline.FORCE_SINGLELINE);
},
{
short_help: "Yank current location to the clipboard",

View File

@@ -150,9 +150,9 @@ vimperator.modes = (function()
var msg = getModeMessage();
if (msg)
vimperator.commandline.echo("-- " + getModeMessage() + " --", vimperator.commandline.HL_MODEMSG);
vimperator.commandline.echo("-- " + getModeMessage() + " --", vimperator.commandline.HL_MODEMSG, vimperator.commandline.DISALLOW_MULTILINE);
else
vimperator.commandline.echo("");
vimperator.commandline.echo("", null, vimperator.commandline.DISALLOW_MULTILINE);
},
// helper function to set both modes in one go

View File

@@ -326,7 +326,7 @@ function Options() //{{{
list += "</table>";
vimperator.commandline.echo(list, vimperator.commandline.HL_NORMAL, true);
vimperator.commandline.echo(list, vimperator.commandline.HL_NORMAL, vimperator.commandline.FORCE_MULTILINE);
}
// TODO: separate Preferences from Options? Would these utility functions

View File

@@ -251,9 +251,12 @@ function CommandLine() //{{{
this.HL_WARNING = "hl-Warning";
// not yet used
this.FORCE_MULTILINE = 1 << 0;
this.FORCE_SINGLELINE = 1 << 1;
this.FORCE_ECHO = 1 << 2; // also echoes if the commandline has focus
this.FORCE_MULTILINE = 1 << 0;
this.FORCE_SINGLELINE = 1 << 1;
this.DISALLOW_MULTILINE = 1 << 2; // if an echo() should try to use the single line,
// but output nothing when the MOW is open; when also
// FORCE_MULTILINE is given, FORCE_MULTILINE takes precedence
this.APPEND_TO_MESSAGES = 1 << 3; // will show the string in :messages
this.getCommand = function()
{
@@ -292,8 +295,8 @@ function CommandLine() //{{{
this.clear();
}
// FIXME: flags not yet really functional --mst
// multiline string don't obey highlight_group
// TODO: add :messages entry
// vimperator.echo uses different order of flags as it omits the hightlight group, change v.commandline.echo argument order? --mst
this.echo = function(str, highlight_group, flags)
{
var focused = document.commandDispatcher.focusedElement;
@@ -302,10 +305,23 @@ function CommandLine() //{{{
highlight_group = highlight_group || this.HL_NORMAL;
if (flags || !multiline_output_widget.collapsed || /\n|<br\/?>/.test(str))
setMultiline(str, highlight_group);
else
setLine(str, highlight_group);
var where = setLine;
if (flags & this.FORCE_MULTILINE)
where = setMultiline;
else if (flags & this.FORCE_SINGLELINE)
where = setLine;
else if (!multiline_output_widget.collapsed)
{
if (flags & this.DISALLOW_MULTILINE)
where = null;
else
where = setMultiline;
}
else if (/\n|<br\/?>/.test(str))
where = setMultiline;
if (where)
where(str, highlight_group);
cur_extended_mode = null;

View File

@@ -743,8 +743,8 @@ const vimperator = (function() //{{{
vimperator.hints = new Hints();
vimperator.log("All modules loaded", 3);
vimperator.echo = function(str) { vimperator.commandline.echo(str); }
vimperator.echoerr = function(str) { vimperator.commandline.echo(str, vimperator.commandline.HL_ERRORMSG); }
vimperator.echo = function(str, flags) { vimperator.commandline.echo(str, vimperator.commandline.HL_NORMAL, flags); }
vimperator.echoerr = function(str, flags) { vimperator.commandline.echo(str, vimperator.commandline.HL_ERRORMSG, flags); }
vimperator.globalVariables = {};