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

Add CompletionContextoptions.jswait. Dont preview 1 character substrings.

This commit is contained in:
Kris Maglione
2008-11-28 16:15:45 +00:00
parent 0698afef24
commit e0a3e761ed
5 changed files with 130 additions and 6 deletions

View File

@@ -106,6 +106,7 @@ function CommandLine() //{{{
var wildIndex = 0; // keep track how often we press <Tab> in a row
var startHints = false; // whether we're waiting to start hints mode
var lastSubstring = "";
var statusTimer = new util.Timer(5, 100, function statusTell() {
if (completionIndex >= completions.items.length)
@@ -324,6 +325,9 @@ function CommandLine() //{{{
// highlight= won't work here.
let start = commandWidget.selectionStart;
let substring = completionContext.longestAllSubstring.substr(start - completionContext.allItems.start);
if (substring.length < 2 && substring != lastSubstring.substr(Math.max(0, lastSubstring.length - substring.length)))
return;
lastSubstring = substring;
let node = <span style={highlight.get("Preview").value}>{substring}</span>
editor.insertNode(util.xmlToDom(node, document), editor.rootElement, 1);
commandWidget.selectionStart = commandWidget.selectionEnd = start;