Revision ab5cad1b

View differences:

core/inc/aos_shell.h
35 35
/* CONSTANTS                                                                  */
36 36
/******************************************************************************/
37 37

  
38
/**
39
 * @brief   Size of the escape sequence buffer.
40
 */
41
#if !defined(AOS_SHELL_ESCSEQUENCE_LENGTH) || defined(__DOXYGEN__)
42
#define AOS_SHELL_ESCSEQUENCE_LENGTH              8
43
#endif
38

  
44 39

  
45 40
/**
46 41
 * @brief   Shell event flag that is emitted when the thread starts.
47 42
 */
48
#define AOS_SHELL_EVTFLAG_START                   ((eventflags_t)(1 << 0))
43
#define AOS_SHELL_EVTFLAG_START                 ((eventflags_t)(1 << 0))
49 44

  
50 45
/**
51 46
 * @brief   Shell event flag that is emitted when a command is executed.
52 47
 */
53
#define AOS_SHELL_EVTFLAG_EXECUTE                 ((eventflags_t)(1 << 1))
48
#define AOS_SHELL_EVTFLAG_EXECUTE               ((eventflags_t)(1 << 1))
54 49

  
55 50
/**
56 51
 * @brief   Shell event flag that is emitted when a command execution finished.
57 52
 */
58
#define AOS_SHELL_EVTFLAG_DONE                    ((eventflags_t)(1 << 2))
53
#define AOS_SHELL_EVTFLAG_DONE                  ((eventflags_t)(1 << 2))
59 54

  
60 55
/**
61 56
 * @brief   Shell event flag that is emitted when the shread stops.
62 57
 */
63
#define AOS_SHELL_EVTFLAG_EXIT                    ((eventflags_t)(1 << 3))
58
#define AOS_SHELL_EVTFLAG_EXIT                  ((eventflags_t)(1 << 3))
64 59

  
65 60
/**
66 61
 * @brief   Shell event flag that is emitted when an I/O error occurred.
67 62
 */
68
#define AOS_SHELL_EVTFLAG_IOERROR                 ((eventflags_t)(1 << 4))
63
#define AOS_SHELL_EVTFLAG_IOERROR               ((eventflags_t)(1 << 4))
69 64

  
70 65
/**
71 66
 * @brief   Shell input configuration for replacing content by user input.
72 67
 */
73
#define AOS_SHELL_CONFIG_INPUT_OVERWRITE          (1 << 0)
68
#define AOS_SHELL_CONFIG_INPUT_OVERWRITE        (1 << 0)
74 69

  
75 70
/**
76 71
 * @brief   Shell prompt configuration print a minimalistic prompt.
77 72
 */
78
#define AOS_SHELL_CONFIG_PROMPT_MINIMAL           (1 << 1)
73
#define AOS_SHELL_CONFIG_PROMPT_MINIMAL         (1 << 1)
79 74

  
80 75
/**
81 76
 * @brief   Shell prompt configuration to additionally print the system uptime with the prompt.
82 77
 */
83
#define AOS_SHELL_CONFIG_PROMPT_UPTIME            (1 << 2)
78
#define AOS_SHELL_CONFIG_PROMPT_UPTIME          (1 << 2)
84 79

  
85 80
/**
86 81
 * @brief   Shell prompt configuration to additionally print the date and time with the prompt.
87 82
 */
88
#define AOS_SHELL_CONFIG_PROMPT_DATETIME          (2 << 2)
83
#define AOS_SHELL_CONFIG_PROMPT_DATETIME        (2 << 2)
89 84

  
90 85
/**
91 86
 * @brief   Shell prompt configuration to additionally print the system uptime with the prompt.
92 87
 */
93
#define AOS_SHELL_CONFIG_MATCH_CASE               (1 << 4)
88
#define AOS_SHELL_CONFIG_MATCH_CASE             (1 << 4)
94 89

  
95 90
/**
96 91
 * @brief   Shell I/O channel flag whether the channel is attached to a list.
97 92
 */
98
#define AOS_SHELLCHANNEL_ATTACHED                 (1 << 0)
93
#define AOS_SHELLCHANNEL_ATTACHED               (1 << 0)
99 94

  
100 95
/**
101 96
 * @brief   Shell I/O channel flag whether the channel is enabled as input.
102 97
 */
103
#define AOS_SHELLCHANNEL_INPUT_ENABLED            (1 << 1)
98
#define AOS_SHELLCHANNEL_INPUT_ENABLED          (1 << 1)
104 99

  
105 100
/**
106 101
 * @brief   Shell I/O channel flag whether the channel is enabled as output.
107 102
 */
108
#define AOS_SHELLCHANNEL_OUTPUT_ENABLED           (1 << 2)
103
#define AOS_SHELLCHANNEL_OUTPUT_ENABLED         (1 << 2)
109 104

  
110 105
/******************************************************************************/
111 106
/* SETTINGS                                                                   */
core/src/aos_shell.c
35 35
/******************************************************************************/
36 36

  
37 37
/**
38
 * @brief   Size of the escape sequence buffer.
39
 */
40
#if !defined(AOS_SHELL_ESCSEQUENCE_LENGTH) || defined(__DOXYGEN__)
41
#define AOS_SHELL_ESCSEQUENCE_LENGTH            8
42
#endif
43

  
44
/**
38 45
 * @brief   The character the input buffer is initialized with.
39 46
 */
40 47
#define INBUF_INIT_CHAR                         '\x07'
......
1456 1463
          n = cmatch;
1457 1464
          _strccmp(line, fill, shell->config & AOS_SHELL_CONFIG_MATCH_CASE, &n, &matchlevel);
1458 1465
          // print the auto fill if any
1459
          if (cmatch > rdata->input.cursorpos || (cmatch == rdata->input.cursorpos && matchlevel == CHAR_MATCH_NCASE)) {
1466
          if ((cmatch > rdata->input.cursorpos) ||
1467
              (cmatch == rdata->input.cursorpos && matchlevel == CHAR_MATCH_NCASE && strlen(fill) == rdata->input.cursorpos)) {
1460 1468
            // limit auto fill so it will not overflow the line width
1461 1469
            if (rdata->input.length + (cmatch - rdata->input.cursorpos) > shell->input.linewidth) {
1462 1470
              cmatch = shell->input.linewidth - rdata->input.length + rdata->input.cursorpos;
......
1496 1504
          // compare line content with command, except if cursorpos is 0
1497 1505
          size_t i = rdata->input.cursorpos;
1498 1506
          if (rdata->input.cursorpos > 0) {
1499
            _strccmp(line, cmd->name, true, &i, NULL);
1507
            _strccmp(line, cmd->name, shell->config & AOS_SHELL_CONFIG_MATCH_CASE, &i, NULL);
1500 1508
          }
1501 1509
          const int cmp = (i < rdata->input.cursorpos) ?
1502 1510
                ((int)i - (int)rdata->input.cursorpos) :

Also available in: Unified diff