From 5aea24eb617277404891de4d49679f362969b872 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Thu, 27 Nov 2008 08:21:07 +0000 Subject: [PATCH] Make substring preview less quirky --- content/io.js | 4 ++-- content/ui.js | 37 ++++++++++++++++++++++++++----------- 2 files changed, 28 insertions(+), 13 deletions(-) diff --git a/content/io.js b/content/io.js index a166c178..a5fcfb6c 100644 --- a/content/io.js +++ b/content/io.js @@ -776,7 +776,7 @@ lookup: // no need (actually forbidden) to add: js <{substring}, document), editor.rootElement, 1); + commandWidget.selectionStart = commandWidget.selectionEnd = start; + } + } + // sets the command - e.g. 'tabopen', 'open http://example.com/' function setCommand(cmd) { @@ -827,17 +851,7 @@ function CommandLine() //{{{ else if (event.type == "input") { liberator.triggerCallback("change", currentExtendedMode, command); - // Kludge. Major kludge. - let wildmode = options.get("wildmode"); - let wildType = wildmode.values[Math.min(wildIndex, wildmode.values.length - 1)]; - if (wildmode.checkHas(wildType, "longest")) - { - let start = commandWidget.selectionStart; - let substring = completionContext.longestAllSubstring.substr(start - completionContext.allItems.start); - removeSuffix = substring; - editor.insertNode(util.xmlToDom({substring}, document), editor.rootElement, 1); - commandWidget.selectionStart = commandWidget.selectionEnd = start; - } + previewSubstring(); } else if (event.type == "keypress") { @@ -1260,6 +1274,7 @@ function CommandLine() //{{{ // prefix when wrapping around searches // with that, we SOMETIMES have problems with followed by in :open completions + previewSubstring(); let command = this.getCommand(); if (command.substr(command.length - removeSuffix.length) == removeSuffix) command = command.substr(0, command.length - removeSuffix.length)