1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-24 03:42:27 +01:00

fixed the indentation and and command line completion

This commit is contained in:
Viktor Kojouharov
2007-05-13 17:17:31 +00:00
parent a8dbd904b5
commit 50bb6aa8f2

View File

@@ -333,16 +333,14 @@ function CommandLine ()
var wildtype = wim[wild_index++] || wim[wim.length - 1]; var wildtype = wim[wild_index++] || wim[wim.length - 1];
if (wildtype == 'list' || wildtype == 'list:full' || wildtype == 'list:longest') if (wildtype == 'list' || wildtype == 'list:full' || wildtype == 'list:longest')
has_list = true; has_list = true;
else if (wildtype == 'longest' || wildtype == 'list:longest') if (wildtype == 'longest' || wildtype == 'list:longest')
longest = true; longest = true;
else if (wildtype == 'full' || wildtype == 'list:full') else if (wildtype == 'full' || wildtype == 'list:full')
full = true; full = true;
// show the list // show the list
if (has_list) if (has_list)
{
completionlist.show(completions); completionlist.show(completions);
}
if (full) if (full)
{ {
@@ -365,11 +363,6 @@ function CommandLine ()
} }
// if (longest && completions.length == 1)
// {
// completion_index=0;
// }
if (completion_index == -1 && !longest) // wrapped around matches, reset command line if (completion_index == -1 && !longest) // wrapped around matches, reset command line
{ {
if (full && completions.length > 1) if (full && completions.length > 1)
@@ -378,25 +371,24 @@ function CommandLine ()
//completion_list.selectedIndex = -1; //completion_list.selectedIndex = -1;
} }
} }
else else
{ {
if (longest && completions.length > 1) if (longest && completions.length > 1)
var compl = get_longest_substring(); var compl = get_longest_substring();
if (full) else if (full)
var compl = completions[completion_index][0]; var compl = completions[completion_index][0];
if (completions.length == 1) else if (completions.length == 1)
var compl = completions[COMMANDS][0]; var compl = completions[0][0];
//alert(compl)
if (compl) if (compl)
{ {
setCommand(command.substring(0, completion_start_index) + compl + completion_postfix); setCommand(command.substring(0, completion_start_index) + compl + completion_postfix);
command_widget.selectionStart = command_widget.selectionEnd = completion_start_index + compl.length; command_widget.selectionStart = command_widget.selectionEnd = completion_start_index + compl.length;
// XXX: needed? // Start a new completion in the next iteration. Useful for commands like :source
// // Start a new completion in the next iteration. Useful for commands like :source // RFC: perhaps the command can indicate whether the completion should be restarted
// if (completions.length == 1 && !full) // RFC: perhaps the command can indicate whether the completion should be restarted // Needed for :source to grab another set of completions after a file/directory has been filled out
// completion_index = UNINITIALIZED; if (completions.length == 1 && !full)
completion_index = UNINITIALIZED;
} }
} }