mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-22 06:08:02 +01:00
added flags to vimperator.commandline.echo()
This commit is contained in:
@@ -277,7 +277,7 @@ function Bookmarks() //{{{
|
|||||||
}
|
}
|
||||||
list += "</table>";
|
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>";
|
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>";
|
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>";
|
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()
|
this.destroy = function()
|
||||||
|
|||||||
@@ -253,7 +253,7 @@ function Buffer() //{{{
|
|||||||
}
|
}
|
||||||
list += "</table>";
|
list += "</table>";
|
||||||
|
|
||||||
vimperator.commandline.echo(list, vimperator.commandline.HL_NORMAL, true);
|
vimperator.commandline.echo(list, vimperator.commandline.HL_NORMAL, vimperator.commandline.FORCE_MULTILINE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -284,11 +284,10 @@ function Commands() //{{{
|
|||||||
result.title = result.url;
|
result.title = result.url;
|
||||||
|
|
||||||
vimperator.bookmarks.add(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
|
else
|
||||||
{
|
{
|
||||||
//vimperator.echo("Usage: :bmark [-t \"My Title\"] [-T tag1,tag2] <url>");
|
|
||||||
vimperator.echoerr("E474: Invalid argument");
|
vimperator.echoerr("E474: Invalid argument");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -385,7 +384,7 @@ function Commands() //{{{
|
|||||||
result.url = vimperator.buffer.URL;
|
result.url = vimperator.buffer.URL;
|
||||||
|
|
||||||
var deleted_count = vimperator.bookmarks.remove(result.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
|
else
|
||||||
{
|
{
|
||||||
@@ -680,7 +679,7 @@ function Commands() //{{{
|
|||||||
str += "<tr><td style=\"width: 200px;\">" + i + "</td><td>" + prefix + value + "</td>\n";
|
str += "<tr><td style=\"width: 200px;\">" + i + "</td><td>" + prefix + value + "</td>\n";
|
||||||
}
|
}
|
||||||
if (str)
|
if (str)
|
||||||
vimperator.echo("<table>" + str + "</table>", true);
|
vimperator.echo("<table>" + str + "</table>", vimperator.commandline.FORCE_MULTILINE);
|
||||||
else
|
else
|
||||||
vimperator.echo("No variables found");
|
vimperator.echo("No variables found");
|
||||||
return;
|
return;
|
||||||
@@ -1471,7 +1470,7 @@ function Commands() //{{{
|
|||||||
"<tr>" + total + "</tr>" +
|
"<tr>" + total + "</tr>" +
|
||||||
"</table>";
|
"</table>";
|
||||||
|
|
||||||
vimperator.commandline.echo(str, vimperator.commandline.HL_NORMAL, true);
|
vimperator.commandline.echo(str, vimperator.commandline.HL_NORMAL, vimperator.commandline.FORCE_MULTILINE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -845,7 +845,7 @@ function Events() //{{{
|
|||||||
if (ssli == 1)
|
if (ssli == 1)
|
||||||
vimperator.statusline.updateUrl("Link: " + link);
|
vimperator.statusline.updateUrl("Link: " + link);
|
||||||
else if (ssli == 2)
|
else if (ssli == 2)
|
||||||
vimperator.echo("Link: " + link);
|
vimperator.echo("Link: " + link, vimperator.commandline.DISALLOW_MULTILINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (link == "")
|
if (link == "")
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ function Search() //{{{
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
vimperator.echo((up ? "?" : "/") + last_search_pattern);
|
vimperator.echo((up ? "?" : "/") + last_search_pattern, null, vimperator.commandline.FORCE_SINGLELINE);
|
||||||
|
|
||||||
if (vimperator.options["hlsearch"])
|
if (vimperator.options["hlsearch"])
|
||||||
this.highlight(last_search_string);
|
this.highlight(last_search_string);
|
||||||
|
|||||||
@@ -520,7 +520,7 @@ function Hints() //{{{
|
|||||||
this.disableHahMode(null, true);
|
this.disableHahMode(null, true);
|
||||||
|
|
||||||
vimperator.copyToClipboard(loc);
|
vimperator.copyToClipboard(loc);
|
||||||
vimperator.echo("Yanked " + loc);
|
vimperator.echo("Yanked " + loc, vimperator.commandline.FORCE_SINGLELINE);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.yankTextHints = function()
|
this.yankTextHints = function()
|
||||||
@@ -543,7 +543,7 @@ function Hints() //{{{
|
|||||||
this.disableHahMode(null, true);
|
this.disableHahMode(null, true);
|
||||||
|
|
||||||
vimperator.copyToClipboard(loc);
|
vimperator.copyToClipboard(loc);
|
||||||
vimperator.echo("Yanked " + loc);
|
vimperator.echo("Yanked " + loc, vimperator.commandline.FORCE_SINGLELINE);
|
||||||
};
|
};
|
||||||
|
|
||||||
function setMouseOverElement(elem)
|
function setMouseOverElement(elem)
|
||||||
|
|||||||
@@ -295,7 +295,7 @@ function Mappings() //{{{
|
|||||||
}
|
}
|
||||||
list += "</table>";
|
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;
|
var url = vimperator.buffer.URL;
|
||||||
vimperator.copyToClipboard(url);
|
vimperator.copyToClipboard(url);
|
||||||
vimperator.echo("Yanked " + url);
|
vimperator.echo("Yanked " + url, vimperator.commandline.FORCE_SINGLELINE);
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
short_help: "Yank current location to the clipboard",
|
short_help: "Yank current location to the clipboard",
|
||||||
|
|||||||
@@ -150,9 +150,9 @@ vimperator.modes = (function()
|
|||||||
|
|
||||||
var msg = getModeMessage();
|
var msg = getModeMessage();
|
||||||
if (msg)
|
if (msg)
|
||||||
vimperator.commandline.echo("-- " + getModeMessage() + " --", vimperator.commandline.HL_MODEMSG);
|
vimperator.commandline.echo("-- " + getModeMessage() + " --", vimperator.commandline.HL_MODEMSG, vimperator.commandline.DISALLOW_MULTILINE);
|
||||||
else
|
else
|
||||||
vimperator.commandline.echo("");
|
vimperator.commandline.echo("", null, vimperator.commandline.DISALLOW_MULTILINE);
|
||||||
},
|
},
|
||||||
|
|
||||||
// helper function to set both modes in one go
|
// helper function to set both modes in one go
|
||||||
|
|||||||
@@ -326,7 +326,7 @@ function Options() //{{{
|
|||||||
|
|
||||||
list += "</table>";
|
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
|
// TODO: separate Preferences from Options? Would these utility functions
|
||||||
|
|||||||
@@ -251,9 +251,12 @@ function CommandLine() //{{{
|
|||||||
this.HL_WARNING = "hl-Warning";
|
this.HL_WARNING = "hl-Warning";
|
||||||
|
|
||||||
// not yet used
|
// not yet used
|
||||||
this.FORCE_MULTILINE = 1 << 0;
|
this.FORCE_MULTILINE = 1 << 0;
|
||||||
this.FORCE_SINGLELINE = 1 << 1;
|
this.FORCE_SINGLELINE = 1 << 1;
|
||||||
this.FORCE_ECHO = 1 << 2; // also echoes if the commandline has focus
|
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()
|
this.getCommand = function()
|
||||||
{
|
{
|
||||||
@@ -292,8 +295,8 @@ function CommandLine() //{{{
|
|||||||
this.clear();
|
this.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: flags not yet really functional --mst
|
// TODO: add :messages entry
|
||||||
// multiline string don't obey highlight_group
|
// 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)
|
this.echo = function(str, highlight_group, flags)
|
||||||
{
|
{
|
||||||
var focused = document.commandDispatcher.focusedElement;
|
var focused = document.commandDispatcher.focusedElement;
|
||||||
@@ -302,10 +305,23 @@ function CommandLine() //{{{
|
|||||||
|
|
||||||
highlight_group = highlight_group || this.HL_NORMAL;
|
highlight_group = highlight_group || this.HL_NORMAL;
|
||||||
|
|
||||||
if (flags || !multiline_output_widget.collapsed || /\n|<br\/?>/.test(str))
|
var where = setLine;
|
||||||
setMultiline(str, highlight_group);
|
if (flags & this.FORCE_MULTILINE)
|
||||||
else
|
where = setMultiline;
|
||||||
setLine(str, highlight_group);
|
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;
|
cur_extended_mode = null;
|
||||||
|
|
||||||
|
|||||||
@@ -743,8 +743,8 @@ const vimperator = (function() //{{{
|
|||||||
vimperator.hints = new Hints();
|
vimperator.hints = new Hints();
|
||||||
vimperator.log("All modules loaded", 3);
|
vimperator.log("All modules loaded", 3);
|
||||||
|
|
||||||
vimperator.echo = function(str) { vimperator.commandline.echo(str); }
|
vimperator.echo = function(str, flags) { vimperator.commandline.echo(str, vimperator.commandline.HL_NORMAL, flags); }
|
||||||
vimperator.echoerr = function(str) { vimperator.commandline.echo(str, vimperator.commandline.HL_ERRORMSG); }
|
vimperator.echoerr = function(str, flags) { vimperator.commandline.echo(str, vimperator.commandline.HL_ERRORMSG, flags); }
|
||||||
|
|
||||||
vimperator.globalVariables = {};
|
vimperator.globalVariables = {};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user