[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-zile] curses.tigetstr("kbs") vs ^H again :(

From: Gary V. Vaughan
Subject: [Bug-zile] curses.tigetstr("kbs") vs ^H again :(
Date: Fri, 14 Sep 2012 10:20:54 +0700

Hi Reuben,

Since your Tue Sep 11 23:31:07 2012 +0100 commit 2fd0fc7:

  term_curses.lua: get code for BACKSPACE, to make minibuffer edit work again

the test suite started hanging in tests/interactive/quoted-insert.el on my Mac
with TERM=screen-256color, which has kbs=^H in the terminfo db.

Removing the kbs entry from the keycode table constructor again fixes it for me,
but I guess from your commit message that you need it on your terminal for
BACKSPACE to work correctly?

How about the following patch instead?

diff --git a/src/term_curses.lua b/src/term_curses.lua                        
index 184b905..6aeb7cd 100644                                                 
--- a/src/term_curses.lua                                                     
+++ b/src/term_curses.lua                                                     
@@ -71,7 +71,6 @@ function term_init ()                                       
     [0x20]    = "\\SPC",                                                     
     [0x5c]    = "\\\\",                                                      
     [0x7f]    = "\\C-?",                                                     
-    ["kbs"]   = "\\BACKSPACE",                                               
     ["kdch1"] = "\\DELETE",                                                  
     ["kcud1"] = "\\DOWN",                                                    
     ["kend"]  = "\\END",                                                     
@@ -119,8 +118,13 @@ function term_init ()                                    
   -- Reverse lookup of a lone ESC.                                           
   keytocode[keycode "\\e"] = { ESC }                                         
-  -- ...fallback on 0x7f for backspace if terminfo doesn't know better       
-  if not curses.tigetstr ("kbs") then                                        
+  local kbs = curses.tigetstr ("kbs")                                        
+  if kbs and kbs ~= 0x08 then                                                
+    -- using 0x08 (^H) for \BACKSPACE hangs with C-qC-h                      
+    keytocode[keycode "\\BACKSPACE"] = {kbs}                                 
+    codetokey[{kbs}] = "\\BACKSPACE"                                         
+  else                                                                       
+    -- ...fallback on 0x7f for backspace if terminfo doesn't know better     
     keytocode[keycode "\\BACKSPACE"] = {0x7f}                                
   if not codetokey[{0x7f}] then codetokey[{0x7f}] = keycode "\\BACKSPACE" end

I'll push if this works for you too...

Gary V. Vaughan (gary AT gnu DOT org)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]