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

Too quick hack.

This commit is contained in:
Kris Maglione
2008-11-27 07:55:59 +00:00
parent d87c66210f
commit e3d88be2bd

View File

@@ -65,6 +65,7 @@ function CommandLine() //{{{
var historyIndex = UNINITIALIZED; var historyIndex = UNINITIALIZED;
var historyStart = ""; var historyStart = "";
var removeSuffix = "";
var messageHistory = { var messageHistory = {
_messages: [], _messages: [],
@@ -122,6 +123,7 @@ function CommandLine() //{{{
}); });
var tabTimer = new util.Timer(10, 10, function tabTell(event) { var tabTimer = new util.Timer(10, 10, function tabTell(event) {
let command = commandline.getCommand(); let command = commandline.getCommand();
// always reset our completion history so up/down keys will start with new values // always reset our completion history so up/down keys will start with new values
@@ -797,7 +799,7 @@ function CommandLine() //{{{
try try
{ {
let node = editor.rootElement; let node = editor.rootElement;
node.removeChild(node.firstChild.nextSibling); editor.deleteNode(node.firstChild.nextSibling);
} }
catch (e) {} catch (e) {}
@@ -832,6 +834,7 @@ function CommandLine() //{{{
{ {
let start = commandWidget.selectionStart; let start = commandWidget.selectionStart;
let substring = completionContext.longestAllSubstring.substr(start - completionContext.allItems.start); let substring = completionContext.longestAllSubstring.substr(start - completionContext.allItems.start);
removeSuffix = substring;
editor.insertNode(util.xmlToDom(<span style="color: gray">{substring}</span>, document), editor.rootElement, 1); editor.insertNode(util.xmlToDom(<span style="color: gray">{substring}</span>, document), editor.rootElement, 1);
commandWidget.selectionStart = commandWidget.selectionEnd = start; commandWidget.selectionStart = commandWidget.selectionEnd = start;
} }
@@ -1256,7 +1259,10 @@ function CommandLine() //{{{
// why do we have to set that here? Without that, we lose the // why do we have to set that here? Without that, we lose the
// prefix when wrapping around searches // prefix when wrapping around searches
// with that, we SOMETIMES have problems with <tab> followed by <s-tab> in :open completions // with that, we SOMETIMES have problems with <tab> followed by <s-tab> in :open completions
var command = this.getCommand();
let command = this.getCommand();
if (command.substr(command.length - removeSuffix.length) == removeSuffix)
command = command.substr(0, command.length - removeSuffix.length)
completionPrefix = command.substring(0, commandWidget.selectionStart); completionPrefix = command.substring(0, commandWidget.selectionStart);
completionPostfix = command.substring(commandWidget.selectionStart); completionPostfix = command.substring(commandWidget.selectionStart);
}, },
@@ -1269,6 +1275,7 @@ function CommandLine() //{{{
completions = { start: completions.start, items: [] }; completions = { start: completions.start, items: [] };
completionIndex = historyIndex = UNINITIALIZED; completionIndex = historyIndex = UNINITIALIZED;
wildIndex = 0; wildIndex = 0;
removeSuffix = "";
} }
}; };
//}}} //}}}