This is an automated email from the ASF dual-hosted git repository.

jerzy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit fd714ad5e52ebb7b831f5f7819abacb5fcc28d4b
Author: Jerzy Kasenberg <[email protected]>
AuthorDate: Tue Oct 15 13:53:16 2019 +0200

    sys/console: Simplify ignoring non nlip input
    
    Now that code that handles nlip is in one function
    there is no need to check variable 'g_console_ignore_non_nlip'
    in many places.
---
 sys/console/full/src/console.c | 22 +++-------------------
 1 file changed, 3 insertions(+), 19 deletions(-)

diff --git a/sys/console/full/src/console.c b/sys/console/full/src/console.c
index acb949c..f8fb42b 100644
--- a/sys/console/full/src/console.c
+++ b/sys/console/full/src/console.c
@@ -781,24 +781,18 @@ console_handle_char(uint8_t byte)
     }
     input = current_line_ev->ev_arg;
 
-    if (handle_nlip(byte)) {
+    if (handle_nlip(byte) || g_console_ignore_non_nlip) {
         return 0;
     }
 
     /* Handle ANSI escape mode */
     if (esc_state & ESC_ANSI) {
-        if (g_console_ignore_non_nlip) {
-            return 0;
-        }
         handle_ansi(byte, input->line);
         return 0;
     }
 
     /* Handle escape mode */
     if (esc_state & ESC_ESC) {
-        if (g_console_ignore_non_nlip) {
-            return 0;
-        }
         esc_state &= ~ESC_ESC;
         handle_ansi(byte, input->line);
         switch (byte) {
@@ -819,9 +813,6 @@ console_handle_char(uint8_t byte)
         switch (byte) {
         case DEL:
         case BS:
-            if (g_console_ignore_non_nlip) {
-                break;
-            }
             if (cur > 0) {
                 cursor_backward(1);
                 cur--;
@@ -830,9 +821,6 @@ console_handle_char(uint8_t byte)
             }
             break;
         case ESC:
-            if (g_console_ignore_non_nlip) {
-                break;
-            }
             esc_state |= ESC_ESC;
             break;
         default:
@@ -857,9 +845,6 @@ console_handle_char(uint8_t byte)
             console_handle_line();
             break;
         case '\t':
-            if (g_console_ignore_non_nlip) {
-                break;
-            }
             if (completion && !trailing_chars) {
 #if MYNEWT_VAL(CONSOLE_UART_RX_BUF_SIZE) == 0
                 console_blocking_mode();
@@ -875,9 +860,8 @@ console_handle_char(uint8_t byte)
         return 0;
     }
 
-    if (!g_console_ignore_non_nlip) {
-        insert_char(&input->line[cur], byte);
-    }
+    insert_char(&input->line[cur], byte);
+
     return 0;
 }
 

Reply via email to