This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch master
in repository terminology.

View the commit online.

commit 85c6d89414a655695fb6c35f5037d029cfb3295e
Author: Boris Faure <bill...@gmail.com>
AuthorDate: Mon Aug 14 20:09:50 2023 +0200

    termptyesc: handle Application Escape Code
    
    Should make your vim more responsive ;)
---
 src/bin/keyin.c      | 19 +++++++++++++++++++
 src/bin/termpty.h    |  1 +
 src/bin/termptyesc.c |  6 +++---
 src/bin/termptyops.c |  1 +
 4 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/src/bin/keyin.c b/src/bin/keyin.c
index f10ffa4..fcfedb4 100644
--- a/src/bin/keyin.c
+++ b/src/bin/keyin.c
@@ -133,6 +133,25 @@ keyin_handle_key_to_pty(Termpty *ty, const Evas_Event_Key_Down *ev,
           }
         return;
      }
+   if (!strcmp(ev->key, "Escape"))
+     {
+        if (ty->termstate.esc_keycode)
+          {
+             TERMPTY_WRITE_STR("\033O[");
+          }
+        else
+          {
+             if (alt)
+               {
+                  TERMPTY_WRITE_STR("\x9b");
+               }
+             else
+               {
+                  TERMPTY_WRITE_STR("\033");
+               }
+          }
+        return;
+     }
    if (!strcmp(ev->key, "Return"))
      {
         if (alt)
diff --git a/src/bin/termpty.h b/src/bin/termpty.h
index 0e25d6b..429f738 100644
--- a/src/bin/termpty.h
+++ b/src/bin/termpty.h
@@ -132,6 +132,7 @@ typedef struct tag_Term_State {
     unsigned int  hide_cursor : 1;
     unsigned int  combining_strike : 1;
     unsigned int  sace_rectangular : 1;
+    unsigned int  esc_keycode : 1;
     int xmod[6];
 } Term_State;
 
diff --git a/src/bin/termptyesc.c b/src/bin/termptyesc.c
index f22116d..44d4a6e 100644
--- a/src/bin/termptyesc.c
+++ b/src/bin/termptyesc.c
@@ -543,9 +543,9 @@ _handle_esc_csi_reset_mode(Termpty *ty, Eina_Unicode cc, Eina_Unicode *b,
                    WRN("TODO: ambigous width reporting %i", mode);
                    ty->decoding_error = EINA_TRUE;
                    break;
-                case 7727: // ignore
-                   WRN("TODO: enable application escape mode %i", mode);
-                   ty->decoding_error = EINA_TRUE;
+                case 7727:
+                   DBG("%s application escape mode", mode ? "enable" : "disable");
+                   ty->termstate.esc_keycode = !!mode;
                    break;
                 case 7766: // ignore
                    WRN("TODO: %s scrollbar", mode ? "hide" : "show");
diff --git a/src/bin/termptyops.c b/src/bin/termptyops.c
index 2cb3ae0..cd7458d 100644
--- a/src/bin/termptyops.c
+++ b/src/bin/termptyops.c
@@ -451,6 +451,7 @@ termpty_soft_reset_state(Termpty *ty)
    ty->termstate.cjk_ambiguous_wide = 0;
    ty->termstate.hide_cursor = 0;
    ty->termstate.sace_rectangular = 0;
+   ty->termstate.esc_keycode = 0;
    ty->mouse_mode = MOUSE_OFF;
    ty->mouse_ext = MOUSE_EXT_NONE;
    ty->bracketed_paste = 0;

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to