commit ab5cad1bab7ee6fab2aee8049cd49077d4e40330
Author: Thomas Schöpping <tschoepp@cit-ec.uni-bielefeld.de>
Date:   Fri Jan 17 14:53:37 2020 +0100

    shell: fixed minor issues with auto completion and suggest functionality

diff --git a/core/inc/aos_shell.h b/core/inc/aos_shell.h
index fdf4abb..4765782 100644
--- a/core/inc/aos_shell.h
+++ b/core/inc/aos_shell.h
@@ -35,77 +35,72 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 /* CONSTANTS                                                                  */
 /******************************************************************************/
 
-/**
- * @brief   Size of the escape sequence buffer.
- */
-#if !defined(AOS_SHELL_ESCSEQUENCE_LENGTH) || defined(__DOXYGEN__)
-#define AOS_SHELL_ESCSEQUENCE_LENGTH              8
-#endif
+
 
 /**
  * @brief   Shell event flag that is emitted when the thread starts.
  */
-#define AOS_SHELL_EVTFLAG_START                   ((eventflags_t)(1 << 0))
+#define AOS_SHELL_EVTFLAG_START                 ((eventflags_t)(1 << 0))
 
 /**
  * @brief   Shell event flag that is emitted when a command is executed.
  */
-#define AOS_SHELL_EVTFLAG_EXECUTE                 ((eventflags_t)(1 << 1))
+#define AOS_SHELL_EVTFLAG_EXECUTE               ((eventflags_t)(1 << 1))
 
 /**
  * @brief   Shell event flag that is emitted when a command execution finished.
  */
-#define AOS_SHELL_EVTFLAG_DONE                    ((eventflags_t)(1 << 2))
+#define AOS_SHELL_EVTFLAG_DONE                  ((eventflags_t)(1 << 2))
 
 /**
  * @brief   Shell event flag that is emitted when the shread stops.
  */
-#define AOS_SHELL_EVTFLAG_EXIT                    ((eventflags_t)(1 << 3))
+#define AOS_SHELL_EVTFLAG_EXIT                  ((eventflags_t)(1 << 3))
 
 /**
  * @brief   Shell event flag that is emitted when an I/O error occurred.
  */
-#define AOS_SHELL_EVTFLAG_IOERROR                 ((eventflags_t)(1 << 4))
+#define AOS_SHELL_EVTFLAG_IOERROR               ((eventflags_t)(1 << 4))
 
 /**
  * @brief   Shell input configuration for replacing content by user input.
  */
-#define AOS_SHELL_CONFIG_INPUT_OVERWRITE          (1 << 0)
+#define AOS_SHELL_CONFIG_INPUT_OVERWRITE        (1 << 0)
 
 /**
  * @brief   Shell prompt configuration print a minimalistic prompt.
  */
-#define AOS_SHELL_CONFIG_PROMPT_MINIMAL           (1 << 1)
+#define AOS_SHELL_CONFIG_PROMPT_MINIMAL         (1 << 1)
 
 /**
  * @brief   Shell prompt configuration to additionally print the system uptime with the prompt.
  */
-#define AOS_SHELL_CONFIG_PROMPT_UPTIME            (1 << 2)
+#define AOS_SHELL_CONFIG_PROMPT_UPTIME          (1 << 2)
 
 /**
  * @brief   Shell prompt configuration to additionally print the date and time with the prompt.
  */
-#define AOS_SHELL_CONFIG_PROMPT_DATETIME          (2 << 2)
+#define AOS_SHELL_CONFIG_PROMPT_DATETIME        (2 << 2)
 
 /**
  * @brief   Shell prompt configuration to additionally print the system uptime with the prompt.
  */
-#define AOS_SHELL_CONFIG_MATCH_CASE               (1 << 4)
+#define AOS_SHELL_CONFIG_MATCH_CASE             (1 << 4)
 
 /**
  * @brief   Shell I/O channel flag whether the channel is attached to a list.
  */
-#define AOS_SHELLCHANNEL_ATTACHED                 (1 << 0)
+#define AOS_SHELLCHANNEL_ATTACHED               (1 << 0)
 
 /**
  * @brief   Shell I/O channel flag whether the channel is enabled as input.
  */
-#define AOS_SHELLCHANNEL_INPUT_ENABLED            (1 << 1)
+#define AOS_SHELLCHANNEL_INPUT_ENABLED          (1 << 1)
 
 /**
  * @brief   Shell I/O channel flag whether the channel is enabled as output.
  */
-#define AOS_SHELLCHANNEL_OUTPUT_ENABLED           (1 << 2)
+#define AOS_SHELLCHANNEL_OUTPUT_ENABLED         (1 << 2)
 
 /******************************************************************************/
 /* SETTINGS                                                                   */
diff --git a/core/src/aos_shell.c b/core/src/aos_shell.c
index 5b60050..3fa0418 100644
--- a/core/src/aos_shell.c
+++ b/core/src/aos_shell.c
@@ -35,6 +35,13 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 /******************************************************************************/
 
 /**
+ * @brief   Size of the escape sequence buffer.
+ */
+#if !defined(AOS_SHELL_ESCSEQUENCE_LENGTH) || defined(__DOXYGEN__)
+#define AOS_SHELL_ESCSEQUENCE_LENGTH            8
+#endif
+
+/**
  * @brief   The character the input buffer is initialized with.
  */
 #define INBUF_INIT_CHAR                         '\x07'
@@ -1456,7 +1463,8 @@ static size_t _readChannel(aos_shell_t* shell, runtimedata_t* rdata, AosShellCha
           n = cmatch;
           _strccmp(line, fill, shell->config & AOS_SHELL_CONFIG_MATCH_CASE, &n, &matchlevel);
           // print the auto fill if any
-          if (cmatch > rdata->input.cursorpos || (cmatch == rdata->input.cursorpos && matchlevel == CHAR_MATCH_NCASE)) {
+          if ((cmatch > rdata->input.cursorpos) ||
+              (cmatch == rdata->input.cursorpos && matchlevel == CHAR_MATCH_NCASE && strlen(fill) == rdata->input.cursorpos)) {
             // limit auto fill so it will not overflow the line width
             if (rdata->input.length + (cmatch - rdata->input.cursorpos) > shell->input.linewidth) {
               cmatch = shell->input.linewidth - rdata->input.length + rdata->input.cursorpos;
@@ -1496,7 +1504,7 @@ static size_t _readChannel(aos_shell_t* shell, runtimedata_t* rdata, AosShellCha
           // compare line content with command, except if cursorpos is 0
           size_t i = rdata->input.cursorpos;
           if (rdata->input.cursorpos > 0) {
-            _strccmp(line, cmd->name, true, &i, NULL);
+            _strccmp(line, cmd->name, shell->config & AOS_SHELL_CONFIG_MATCH_CASE, &i, NULL);
           }
           const int cmp = (i < rdata->input.cursorpos) ?
                 ((int)i - (int)rdata->input.cursorpos) :
