bug-apl
[Top][All Lists]
Advanced

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

Re: Patch: Allow ctrl-d to act as del-char and re-assign ^D (EOT) to ctr


From: Dr . Jürgen Sauermann
Subject: Re: Patch: Allow ctrl-d to act as del-char and re-assign ^D (EOT) to ctrl-z
Date: Tue, 6 Jul 2021 19:51:06 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0

Hi,

thanks a lot. The patch is included in SVN 1477.

Best Regards,
Jürgen


On 7/4/21 10:10 AM, Russtopia wrote:
Hello,

Please see below a small patch proposal for a new configure option to move the ^D (EOT) behaviour to a different key (^Z which is currently unassigned), which allows keyboard ctrl-D to act as delete-char.

I did this because I found my muscle-memory from bash, emacs etc. caused me to hit CTRL-D too often while editing lines. I find it convenient to have CTRL-D act as expected in concert with CTRL-A,E,K,P,N.

If CTRL-Z is not good, perhaps it could be assigned elsewhere but I didn't see how to easily assign to a less-common key that isn't already in use.

Cheers,
-Russ

---

Index: src/LineInput.cc
===================================================================
--- src/LineInput.cc (revision 1458)
+++ src/LineInput.cc (working copy)
@@ -903,10 +903,23 @@
                    control_C(SIGINT);
                    break;
 
+
+#ifdef WANT_CTRLD_DEL
+              case UNI_SUB:
+                   CERR << "^D";
+                   eof = true;
+                   break;
+#endif
+
               case UNI_EOT:   // ^D
+#ifndef WANT_CTRLD_DEL
                    CERR << "^D";
                    eof = true;
                    break;
+#else
+                   lec.delete_char();
+                   continue;
+#endif
 
               case UNI_BS:    // ^H (backspace)
                    lec.backspc();
@@ -1089,6 +1102,10 @@
              case UNI_SO:  return UNI_CursorDown;    // ^N
              case UNI_DLE: return UNI_CursorUp;      // ^P
              case UNI_EM:  return UNI_EM;      // ^Y
+
+#ifdef WANT_CTRLD_DEL
+             case UNI_SUB: return UNI_SUB;     // ^Z (as alt EOT, allowing ^D as delete-char)
+#endif
              default: goto again;
            }
       }
Index: configure.ac
===================================================================
--- configure.ac (revision 1458)
+++ configure.ac (working copy)
@@ -411,6 +411,20 @@
 AM_CONDITIONAL(WANT_LIBAPL, test "x$user_wants_libapl" = xyes)
 AC_MSG_RESULT([$user_wants_libapl])
 
+AC_MSG_CHECKING([if user wants ctrl-d to be del-char (moving EOT to ctrl-z)])
+user_wants_ctrld_del=no
+AC_ARG_WITH( [ctrld_del],
+             [AS_HELP_STRING([--with-ctrld_del],
+                             [enable to use ctrl-d as del-char, ctrl-z as EOT])],
+             [user_wants_ctrld_del=yes])
+
+if test "x$user_wants_ctrld_del" = xyes ; then
+    AC_DEFINE([WANT_CTRLD_DEL], [1], [Define if ctrl-d should act as del-char and ctrl-z should be EOT])
+fi
+
+AM_CONDITIONAL(WANT_CTRLD_DEL, test "x$user_wants_ctrld_del" = xyes)
+AC_MSG_RESULT([$user_wants_ctrld_del])
+
 # check if the user wants to build the python extension gnu_apl.so
 #
 AC_MSG_CHECKING([if we want to build libpython_apl.so])



reply via email to

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