1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-23 23:32:26 +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];
if (wildtype == 'list' || wildtype == 'list:full' || wildtype == 'list:longest')
has_list = true;
else if (wildtype == 'longest' || wildtype == 'list:longest')
if (wildtype == 'longest' || wildtype == 'list:longest')
longest = true;
else if (wildtype == 'full' || wildtype == 'list:full')
full = true;
// show the list
if (has_list)
{
completionlist.show(completions);
}
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 (full && completions.length > 1)
@@ -378,25 +371,24 @@ function CommandLine ()
//completion_list.selectedIndex = -1;
}
}
else
{
if (longest && completions.length > 1)
var compl = get_longest_substring();
if (full)
else if (full)
var compl = completions[completion_index][0];
if (completions.length == 1)
var compl = completions[COMMANDS][0];
//alert(compl)
else if (completions.length == 1)
var compl = completions[0][0];
if (compl)
{
setCommand(command.substring(0, completion_start_index) + compl + completion_postfix);
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
// if (completions.length == 1 && !full) // RFC: perhaps the command can indicate whether the completion should be restarted
// completion_index = UNINITIALIZED;
// 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
// Needed for :source to grab another set of completions after a file/directory has been filled out
if (completions.length == 1 && !full)
completion_index = UNINITIALIZED;
}
}