public inbox for frysk-cvs@sourceware.org
help / color / mirror / Atom feed
* [SCM]  master: Fix completion of: alias <TAB>
@ 2007-11-09 17:54 cagney
  0 siblings, 0 replies; only message in thread
From: cagney @ 2007-11-09 17:54 UTC (permalink / raw)
  To: frysk-cvs

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-11-09 17:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-09 17:54 [SCM] master: Fix completion of: alias <TAB> cagney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).