From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21822 invoked by alias); 9 Nov 2007 17:54:46 -0000 Received: (qmail 21774 invoked by uid 367); 9 Nov 2007 17:54:45 -0000 Date: Fri, 09 Nov 2007 17:54:00 -0000 Message-ID: <20071109175445.21759.qmail@sourceware.org> From: cagney@sourceware.org To: frysk-cvs@sourceware.org Subject: [SCM] master: Fix completion of: alias X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: 685835609bb5c145000f0dd69785b781672e7a36 X-Git-Newrev: 1e79ab9a46d499104cc07e265842e5b075a90a3b Mailing-List: contact frysk-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: frysk-cvs-owner@sourceware.org Reply-To: frysk@sourceware.org X-SW-Source: 2007-q4/txt/msg00330.txt.bz2 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 Date: Fri Nov 9 12:53:08 2007 -0500 Fix completion of: alias frysk-core/frysk/hpd/ChangeLog 2007-11-09 Andrew Cagney * 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 + * 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