This is the mail archive of the
frysk-cvs@sources.redhat.com
mailing list for the frysk project.
[SCM] master: Fix completion of: alias <TAB>
- From: cagney at sourceware dot org
- To: frysk-cvs at sourceware dot org
- Date: 9 Nov 2007 17:54:45 -0000
- Subject: [SCM] master: Fix completion of: alias <TAB>
- Reply-to: frysk at sourceware dot org
The branch, master has been updated
via 1e79ab9a46d499104cc07e265842e5b075a90a3b (commit)
from 685835609bb5c145000f0dd69785b781672e7a36 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email.
- Log -----------------------------------------------------------------
commit 1e79ab9a46d499104cc07e265842e5b075a90a3b
Author: Andrew Cagney <cagney@redhat.com>
Date: Fri Nov 9 12:53:08 2007 -0500
Fix completion of: alias <TAB>
frysk-core/frysk/hpd/ChangeLog
2007-11-09 Andrew Cagney <cagney@redhat.com>
* MultiLevelCommand.java: Handle null tokens.
* ParameterizedCommand.java: Ditto.
-----------------------------------------------------------------------
Summary of changes:
frysk-core/frysk/hpd/ChangeLog | 3 +++
frysk-core/frysk/hpd/MultiLevelCommand.java | 13 +++++++------
frysk-core/frysk/hpd/ParameterizedCommand.java | 6 +++++-
3 files changed, 15 insertions(+), 7 deletions(-)
First 500 lines of diff:
diff --git a/frysk-core/frysk/hpd/ChangeLog b/frysk-core/frysk/hpd/ChangeLog
index 2d0e721..d03ce52 100644
--- a/frysk-core/frysk/hpd/ChangeLog
+++ b/frysk-core/frysk/hpd/ChangeLog
@@ -1,5 +1,8 @@
2007-11-09 Andrew Cagney <cagney@redhat.com>
+ * MultiLevelCommand.java: Handle null tokens.
+ * ParameterizedCommand.java: Ditto.
+
* Input.java: Eliminate the sentinel.
(remove(int)): Delete.
(removeFirst()): New.
diff --git a/frysk-core/frysk/hpd/MultiLevelCommand.java b/frysk-core/frysk/hpd/MultiLevelCommand.java
index cd13717..793dcc2 100644
--- a/frysk-core/frysk/hpd/MultiLevelCommand.java
+++ b/frysk-core/frysk/hpd/MultiLevelCommand.java
@@ -123,14 +123,14 @@ public abstract class MultiLevelCommand extends Command {
Input.Token incomplete = input.token(0);
// The cursor is past this token. Find this level's
// sub-command and pass the completion problem on to it.
- if (incomplete.value != null && cursor > incomplete.end) {
+ if (incomplete != null && cursor > incomplete.end) {
Command subCommand = (Command)subCommands.get(incomplete.value);
if (subCommand == null)
return -1; // give up
return subCommand.complete(cli, input.accept(), cursor,
candidates);
}
- if (incomplete.value == null)
+ if (incomplete == null)
candidates.addAll(subCommands.keySet());
else {
for (Iterator i = subCommands.keySet().iterator(); i.hasNext(); ) {
@@ -141,9 +141,10 @@ public abstract class MultiLevelCommand extends Command {
}
// If there's only one token, append a trailing blank so that
// things are ready for the next token.
- if (candidates.size() == 1) {
- candidates.set(0, ((String)candidates.get(0)) + " ");
- }
- return incomplete.start;
+ CompletionFactory.padSingleCandidate(candidates);
+ if (incomplete == null)
+ return cursor;
+ else
+ return incomplete.start;
}
}
diff --git a/frysk-core/frysk/hpd/ParameterizedCommand.java b/frysk-core/frysk/hpd/ParameterizedCommand.java
index b598809..558e367 100644
--- a/frysk-core/frysk/hpd/ParameterizedCommand.java
+++ b/frysk-core/frysk/hpd/ParameterizedCommand.java
@@ -174,7 +174,11 @@ abstract class ParameterizedCommand extends Command {
* Complete the input.
*/
final int complete(CLI cli, Input input, int cursor, List candidates) {
- int start = input.token(0).start;
+ int start;
+ if (input.size() == 0)
+ start = cursor;
+ else
+ start = input.token(0).start;
int pos = complete(cli, cli.getCommandPTSet(input),
input.stringValue(), cursor - start, candidates);
if (pos >= 0) {
hooks/post-receive
--
frysk system monitor/debugger