From: Ben Pfaff Date: Wed, 28 Jun 2006 18:40:21 +0000 (+0000) Subject: Don't offer both the full and abbreviated names for a single command X-Git-Tag: v0.6.0~798 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e44ce942f35733d51c59b9ddc901f65600831209;p=pspp-builds.git Don't offer both the full and abbreviated names for a single command in command name completion. --- diff --git a/src/language/ChangeLog b/src/language/ChangeLog index 962a80a1..812491ba 100644 --- a/src/language/ChangeLog +++ b/src/language/ChangeLog @@ -1,3 +1,13 @@ +Wed Jun 28 11:38:23 2006 Ben Pfaff + + Don't offer both the full and abbreviated names for a single + command in command name completion. + + * command.c: (enum flags) Add F_ABBREV flag. + (cmd_complete) Ignore command with F_ABBREV flag set. + + * command.def: Add F_ABBREV to N, Q, SORT commands. + Tue Jun 27 22:36:38 2006 Ben Pfaff Fix regression in command name completion reported by John diff --git a/src/language/command.c b/src/language/command.c index c55ff1b8..61d54f9c 100644 --- a/src/language/command.c +++ b/src/language/command.c @@ -97,7 +97,8 @@ enum flags { F_ENHANCED = 0x10, /* Allowed only in enhanced syntax mode. */ F_TESTING = 0x20, /* Allowed only in testing mode. */ - F_KEEP_FINAL_TOKEN = 0x40 /* Don't skip final token in command name. */ + F_KEEP_FINAL_TOKEN = 0x40,/* Don't skip final token in command name. */ + F_ABBREV = 0x80 /* Not a candidate for name completion. */ }; /* A single command. */ @@ -632,6 +633,7 @@ cmd_complete (const char *prefix, const struct command **cmd) if (!memcasecmp ((*cmd)->name, prefix, strlen (prefix)) && (!((*cmd)->flags & F_TESTING) || get_testing_mode ()) && (!((*cmd)->flags & F_ENHANCED) || get_syntax () == ENHANCED) + && !((*cmd)->flags & F_ABBREV) && ((*cmd)->function != NULL) && in_correct_state (*cmd, completion_state)) return (*cmd)++->name; diff --git a/src/language/command.def b/src/language/command.def index 588b8d78..c8253955 100644 --- a/src/language/command.def +++ b/src/language/command.def @@ -29,10 +29,10 @@ DEF_CMD (S_ANY, 0, "FINISH", cmd_finish) DEF_CMD (S_ANY, 0, "HOST", cmd_host) DEF_CMD (S_ANY, 0, "INCLUDE", cmd_include) DEF_CMD (S_ANY, 0, "N OF CASES", cmd_n_of_cases) -DEF_CMD (S_ANY, 0, "N", cmd_n_of_cases) +DEF_CMD (S_ANY, F_ABBREV, "N", cmd_n_of_cases) DEF_CMD (S_ANY, 0, "NEW FILE", cmd_new_file) DEF_CMD (S_ANY, 0, "PERMISSIONS", cmd_permissions) -DEF_CMD (S_ANY, 0, "Q", cmd_finish) +DEF_CMD (S_ANY, F_ABBREV, "Q", cmd_finish) DEF_CMD (S_ANY, 0, "QUIT", cmd_finish) DEF_CMD (S_ANY, 0, "SET", cmd_set) DEF_CMD (S_ANY, 0, "SHOW", cmd_show) @@ -114,7 +114,7 @@ DEF_CMD (S_DATA, 0, "RENAME VARIABLES", cmd_rename_variables) DEF_CMD (S_DATA, 0, "SAMPLE", cmd_sample) DEF_CMD (S_DATA, 0, "SAVE", cmd_save) DEF_CMD (S_DATA, 0, "SORT CASES", cmd_sort_cases) -DEF_CMD (S_DATA, 0, "SORT", cmd_sort_cases) +DEF_CMD (S_DATA, F_ABBREV, "SORT", cmd_sort_cases) DEF_CMD (S_DATA, 0, "T-TEST", cmd_t_test) DEF_CMD (S_DATA, 0, "TEMPORARY", cmd_temporary) DEF_CMD (S_DATA, 0, "USE", cmd_use)