Adds support for the control sequences for home and end on a keyboard to the
telnet server interface.
---
 src/server/telnet_server.c |   20 +++++++++++++++++++-
 1 files changed, 19 insertions(+), 1 deletions(-)

diff --git a/src/server/telnet_server.c b/src/server/telnet_server.c
index 92e7480..f42f056 100644
--- a/src/server/telnet_server.c
+++ b/src/server/telnet_server.c
@@ -467,10 +467,24 @@ int telnet_input(struct connection *connection)
                                                }
                                                t_con->state = 
TELNET_STATE_DATA;
                                        }
-                                       else if (*buf_p == '3')
+                                       else if (*buf_p == '3') /* delete */
                                        {
                                                t_con->last_escape = *buf_p;
                                        }
+                                       else if (*buf_p == '4') /* end */
+                                       {
+                                               t_con->last_escape = *buf_p;
+                                               telnet_write(connection, 
t_con->line + t_con->line_cursor, t_con->line_size - t_con->line_cursor);
+                                               t_con->line_cursor = 
t_con->line_size;
+                                       }
+                                       else if (*buf_p == '1') /* home */
+                                       {
+                                               t_con->last_escape = *buf_p;
+                                               while (t_con->line_cursor > 0) {
+                                                       
telnet_write(connection, "\b", 1);
+                                                       t_con->line_cursor--;
+                                               }
+                                       }
                                        else
                                        {
                                                t_con->state = 
TELNET_STATE_DATA;
@@ -507,6 +521,10 @@ int telnet_input(struct connection *connection)
                                                t_con->state = 
TELNET_STATE_DATA;
                                        }
                                }
+                               else if (t_con->last_escape == '4' || 
t_con->last_escape == '1')
+                               {
+                                       t_con->state = TELNET_STATE_DATA;
+                               }
                                else if (t_con->last_escape == '\x00')
                                {
                                        if (*buf_p == '[')
-- 
1.6.5.2

_______________________________________________
Openocd-development mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to