Junbo-Zheng commented on code in PR #4010:
URL: https://github.com/apache/nuttx-apps/pull/4010#discussion_r4533190166


##########
system/readline/readline_common.c:
##########
@@ -246,6 +498,16 @@ static bool tab_completion(FAR struct rl_common_s *vtbl, 
char *buf,
 
   if (len >= 1)
     {
+      /* Completing an argument rather than the command name (or an
+       * explicit path as the command): match the last word against
+       * directory entries instead of command names.
+       */
+
+      if (tab_word_start(buf, len) > 0 || buf[0] == '/')

Review Comment:
   > remove if check here to avoid the dup at line 259, let tab_path_completion 
return fail to continue the following code instead.
   
   done



##########
system/readline/readline_common.c:
##########
@@ -201,6 +202,257 @@ static void tab_print_match(FAR struct rl_common_s *vtbl,
 }
 #endif
 
+/****************************************************************************
+ * Name: tab_word_start
+ *
+ * Description:
+ *   Return the offset of the word being completed: the character after
+ *   the last space in the line, or 0 when the cursor is still on the
+ *   first word (the command position).
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_READLINE_TABCOMPLETION
+static int tab_word_start(FAR const char *buf, int len)

Review Comment:
   > merge into tab_path_completion?
   
   done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to