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

Dont show substring preview when caret isnt at end of line. Fix unanchored substring generation.

This commit is contained in:
Kris Maglione
2008-11-28 09:02:03 +00:00
parent 25d983ec01
commit 082d9d12fa
4 changed files with 8 additions and 9 deletions

View File

@@ -495,8 +495,8 @@ function Buffer() //{{{
argCount: "?", argCount: "?",
completer: function (context) completer: function (context)
{ {
context.title = ["Page Info"];
completion.optionValue(context, "pageinfo", "+", ""); completion.optionValue(context, "pageinfo", "+", "");
context.title = ["Page Info"];
} }
}); });

View File

@@ -314,7 +314,7 @@ CompletionContext.prototype = {
let start = 0; let start = 0;
let idx; let idx;
let length = filter.length; let length = filter.length;
while ((idx = text.indexOf(filter, start)) > -1 && idx < length) while ((idx = text.indexOf(filter, start)) > -1 && idx < text.length)
{ {
for (let end in util.range(idx + length, text.length + 1)) for (let end in util.range(idx + length, text.length + 1))
substrings.push(text.substring(idx, end)); substrings.push(text.substring(idx, end));
@@ -1372,12 +1372,13 @@ function Completion() //{{{
// TODO: Highlight when invalid // TODO: Highlight when invalid
context.advance(context.filter.length - len); context.advance(context.filter.length - len);
/* Not vim compatible, but is a significant enough improvement context.title = ["Option Value"];
* that it's worth breaking compatibility.
*/
let completions = completer(context); let completions = completer(context);
if (!completions) if (!completions)
return; return;
/* Not vim compatible, but is a significant enough improvement
* that it's worth breaking compatibility.
*/
if (newValues instanceof Array) if (newValues instanceof Array)
{ {
completions = completions.filter(function (val) newValues.indexOf(val[0]) == -1); completions = completions.filter(function (val) newValues.indexOf(val[0]) == -1);

View File

@@ -695,9 +695,8 @@ function Options() //{{{
else if (prefix == "no") else if (prefix == "no")
return; return;
let [name, value] = context.filter.split("=", 2);
let option = opt.option; let option = opt.option;
context.advance(name.length + 1); context.advance(context.filter.indexOf("=") + 1);
if (!option) if (!option)
context.highlight(0, name.length, "SPELLCHECK"); context.highlight(0, name.length, "SPELLCHECK");
@@ -713,7 +712,6 @@ function Options() //{{{
}); });
} }
context.title = ["Option Value"];
completion.optionValue(context, opt.name, opt.operator); completion.optionValue(context, opt.name, opt.operator);
}, },
literal: true, literal: true,

View File

@@ -319,7 +319,7 @@ function CommandLine() //{{{
catch (e) {} catch (e) {}
let wildmode = options.get("wildmode"); let wildmode = options.get("wildmode");
let wildType = wildmode.values[Math.min(wildIndex, wildmode.values.length - 1)]; let wildType = wildmode.values[Math.min(wildIndex, wildmode.values.length - 1)];
if (wildmode.checkHas(wildType, "longest")) if (wildmode.checkHas(wildType, "longest") && commandWidget.selectionStart == commandWidget.value.length)
{ {
// highlight= won't work here. // highlight= won't work here.
let start = commandWidget.selectionStart; let start = commandWidget.selectionStart;