Hello,

This occurs in release 6.2, and was a change in behavior from 5.x as far as
I know.

If you have a program that has:
  rl_completion_append_char = '\0';
as part of its code to set up readline, then that value is reset to ' '
during completion - effectively making rl_completion_append_char not usable
this way.  I am pretty sure this worked on 5.x.

I've pasted a patch below that we used to change this behavior on 6.2.

But if the intention is that rl_completion_append_character should be
changed only by the completion function, then I added that to its
documentation would be good :)

Thanks for your consideration!

Chad Whipkey


+++ readline/complete.c 2012-03-30 11:23:32.362371000 -0700
@@ -339,6 +339,13 @@
    default is a space. */
 int rl_completion_append_character = ' ';

+/* Copy of rl_completion_append_character, taken before calling the
+ * application-specific completion function. Used to restore
+ * rl_completion_append_character to its default state in
+ * _rl_reset_completion_state.
+ */
+static int rl_completion_default_append_character = ' ';
+
 /* If non-zero, the completion functions don't append any closing quote.
    This is set to 0 by rl_complete_internal and may be changed by an
    application-specific completion function. */
@@ -455,6 +462,7 @@
 {
   rl_completion_found_quote = 0;
   rl_completion_quote_character = 0;
+  rl_completion_append_character = rl_completion_default_append_character;
 }

 /* Set default values for readline word completion.  These are the variables
@@ -468,7 +476,6 @@
   rl_filename_quoting_desired = 1;
   rl_completion_type = what_to_do;
   rl_completion_suppress_append = rl_completion_suppress_quote = 0;
-  rl_completion_append_character = ' ';

   /* The completion entry function may optionally change this. */
   rl_completion_mark_symlink_dirs = _rl_complete_mark_symlink_dirs;
@@ -1807,6 +1814,7 @@

   RL_SETSTATE(RL_STATE_COMPLETING);

+  rl_completion_default_append_character = rl_completion_append_character;
   set_completion_defaults (what_to_do);

   saved_line_buffer = rl_line_buffer ? savestring (rl_line_buffer) :
(char *)NULL;
@@ -2390,6 +2398,8 @@

       RL_SETSTATE(RL_STATE_COMPLETING);

+      rl_completion_default_append_character = rl_completion_append_character;
+
       /* Only the completion entry function can change these. */
       set_completion_defaults ('%');

@@ -2429,6 +2439,7 @@
          FREE (orig_text);
          orig_text = (char *)0;
          completion_changed_buffer = 0;
+         rl_completion_append_character = 
rl_completion_default_append_character;
          RL_UNSETSTATE(RL_STATE_COMPLETING);
          return (0);
        }
@@ -2454,6 +2465,7 @@
       FREE (matches);
       matches = (char **)0;
       completion_changed_buffer = 0;
+      rl_completion_append_character = rl_completion_default_append_character;
       return (0);
     }

@@ -2479,6 +2491,7 @@
     }

   completion_changed_buffer = 1;
+  rl_completion_append_character = rl_completion_default_append_character;
   return (0);
 }
_______________________________________________
Bug-readline mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-readline

Reply via email to