bug-readline
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-readline] rl_completion_display_matches_hook doesn't get called if


From: Ben Eater
Subject: [Bug-readline] rl_completion_display_matches_hook doesn't get called if there is only one match
Date: Thu, 27 Jan 2011 09:09:43 -0500

If I write my own hook to display completion matches pointed to by
rl_completion_display_matches_hook, it doesn't get called in the case
where there is a single match to display. The fix (in complete.c) is
to move the check (and call) of the hook to before the handling of a
single match.

Is there any issue in doing this that I'm overlooking?

Thanks,
-Ben

--- ../readline-6.1/complete.c  2011-01-27 08:52:59.251349229 -0500
+++ complete.c  2011-01-27 08:53:16.448358608 -0500
@@ -1460,6 +1460,13 @@
   /* Move to the last visible line of a possibly-multiple-line command. */
   _rl_move_vert (_rl_vis_botlin);

+  /* If the caller has defined a display hook, then call that now. */
+  if (rl_completion_display_matches_hook)
+    {
+      (*rl_completion_display_matches_hook) (matches, len, max);
+      return;
+    }
+       
   /* Handle simple case first.  What if there is only one answer? */
   if (matches[1] == 0)
     {
@@ -1487,13 +1494,6 @@

   len = i - 1;

-  /* If the caller has defined a display hook, then call that now. */
-  if (rl_completion_display_matches_hook)
-    {
-      (*rl_completion_display_matches_hook) (matches, len, max);
-      return;
-    }
-       
   /* If there are many items, then ask the user if she really wants to
      see them all. */
   if (rl_completion_query_items > 0 && len >= rl_completion_query_items)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]