mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-23 11:58:00 +01:00
Add Preview highlight group
This commit is contained in:
@@ -194,7 +194,6 @@ CompletionContext.prototype = {
|
||||
let lock = {};
|
||||
this.cache.backgroundLock = lock;
|
||||
this.incomplete = true;
|
||||
liberator.dump({name: this.name, length: this.items.length});
|
||||
let now = Date.now();
|
||||
liberator.callAsync(this, function () {
|
||||
let items = this.generate();
|
||||
@@ -253,9 +252,7 @@ CompletionContext.prototype = {
|
||||
if (quote)
|
||||
filtered.forEach(function (item) {
|
||||
item.unquoted = item.text;
|
||||
try {
|
||||
item.text = quote[0] + quote[1](item.text) + quote[2];
|
||||
} catch(e) { liberator.dump(quote.map(function (x) <>{util.objectToString(x)}</>)) }
|
||||
})
|
||||
if (options.get("wildoptions").has("sort"))
|
||||
filtered.sort(this.compare);
|
||||
|
||||
@@ -24,7 +24,7 @@ function Highlights(name, store, serial)
|
||||
WarningMsg color: red; background: white;
|
||||
Message white-space: normal; min-width: 100%; padding-left: 2em; text-indent: -2em; display: block;
|
||||
NonText color: blue; min-height: 16px; padding-left: 2px;
|
||||
|
||||
Preview color: gray;
|
||||
|
||||
CompTitle color: magenta; background: white; font-weight: bold;
|
||||
CompTitle>* border-bottom: 1px dashed magenta;
|
||||
|
||||
@@ -65,7 +65,6 @@ function CommandLine() //{{{
|
||||
|
||||
var historyIndex = UNINITIALIZED;
|
||||
var historyStart = "";
|
||||
var removeSuffix = "";
|
||||
|
||||
var messageHistory = {
|
||||
_messages: [],
|
||||
@@ -322,10 +321,11 @@ function CommandLine() //{{{
|
||||
let wildType = wildmode.values[Math.min(wildIndex, wildmode.values.length - 1)];
|
||||
if (wildmode.checkHas(wildType, "longest"))
|
||||
{
|
||||
// highlight= won't work here.
|
||||
let start = commandWidget.selectionStart;
|
||||
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);
|
||||
let node = <span style={highlight.get("Preview").value}>{substring}</span>
|
||||
editor.insertNode(util.xmlToDom(node, document), editor.rootElement, 1);
|
||||
commandWidget.selectionStart = commandWidget.selectionEnd = start;
|
||||
}
|
||||
}
|
||||
@@ -686,7 +686,7 @@ function CommandLine() //{{{
|
||||
|
||||
getCommand: function getCommand()
|
||||
{
|
||||
return commandWidget.value;
|
||||
return commandWidget.inputField.editor.rootElement.firstChild.textContent;
|
||||
},
|
||||
|
||||
open: function open(prompt, cmd, extendedMode)
|
||||
@@ -1276,8 +1276,6 @@ function CommandLine() //{{{
|
||||
|
||||
previewSubstring();
|
||||
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);
|
||||
completionPostfix = command.substring(commandWidget.selectionStart);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user