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:
@@ -210,17 +210,17 @@ function CommandLine ()
|
|||||||
/* user pressed ENTER to carry out a command */
|
/* user pressed ENTER to carry out a command */
|
||||||
if (key == "<Return>" || key == "<C-j>" || key == "<C-m>")
|
if (key == "<Return>" || key == "<C-j>" || key == "<C-m>")
|
||||||
{
|
{
|
||||||
// try {
|
// try {
|
||||||
// [prev_match, heredoc, end] = multiliner(command, prev_match, heredoc);
|
// [prev_match, heredoc, end] = multiliner(command, prev_match, heredoc);
|
||||||
// } catch(e) {
|
// } catch(e) {
|
||||||
// logObject(e);
|
// logObject(e);
|
||||||
// echoerr(e.name + ": " + e.message);
|
// echoerr(e.name + ": " + e.message);
|
||||||
// prev_match = new Array(5);
|
// prev_match = new Array(5);
|
||||||
// heredoc = '';
|
// heredoc = '';
|
||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
// if (!end)
|
// if (!end)
|
||||||
// command_line.value = "";
|
// command_line.value = "";
|
||||||
|
|
||||||
// the command is saved in the blur() handler
|
// the command is saved in the blur() handler
|
||||||
focusContent();
|
focusContent();
|
||||||
@@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user