about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>2024-01-09 00:34:35 +0000
committerThomas E. Dickey <dickey@invisible-island.net>2024-01-10 08:46:44 +0000
commitee37e435f2a61bd7f067d8a68d29eb9dc1ec03e6 (patch)
tree6f563f14e868e454494a2d2bf6b7fc9611147397 /src
parentcd6eca00f4da52b54382d31cf28dd92eca98c576 (diff)
downloadlynx-snapshots-ee37e435f2a61bd7f067d8a68d29eb9dc1ec03e6.tar.gz
snapshot of project "lynx", label v2-9-0dev_12o
Diffstat (limited to 'src')
-rw-r--r--src/LYCurses.c39
-rw-r--r--src/LYKeymap.c35
2 files changed, 39 insertions, 35 deletions
diff --git a/src/LYCurses.c b/src/LYCurses.c
index e628938e..d1ad337d 100644
--- a/src/LYCurses.c
+++ b/src/LYCurses.c
@@ -1,4 +1,4 @@
-/* $LynxId: LYCurses.c,v 1.205 2024/01/07 23:03:23 tom Exp $ */
+/* $LynxId: LYCurses.c,v 1.207 2024/01/09 00:30:44 tom Exp $ */
 #include <HTUtils.h>
 #include <HTAlert.h>
 
@@ -1387,23 +1387,6 @@ void start_curses(void)
 	LYcols = LYscreenWidth();
 
 #if defined(NCURSES_VERSION)
-#if defined(CAN_CUT_AND_PASTE) && defined(IXON) && defined(IXOFF)
-	/*
-	 * User-defined keymaps are loaded after this check, but since the
-	 * ifdef is enabled, we know that at least the copy/paste commands
-	 * are enabled.  However, binding the copy to ^S is inconvenient,
-	 * so ask curses to permit that (saving an external tweak with stty).
-	 */
-	{
-	    struct termios alter_tty;
-
-	    if (tcgetattr(fileno(stdin), &alter_tty) == 0) {
-		alter_tty.c_iflag &= (unsigned) ~(IXON | IXOFF);
-		tcsetattr(fileno(stdout), TCSAFLUSH, &alter_tty);
-		def_prog_mode();
-	    }
-	}
-#endif
 #if defined(SIGWINCH)
 	size_change(0);
 	LYGetScreenSize(0);
@@ -1436,6 +1419,26 @@ void start_curses(void)
 	    endwin();
 	    exit_immediately(EXIT_FAILURE);
 	}
+#if defined(CAN_CUT_AND_PASTE) && defined(IXON) && defined(IXOFF)
+	/*
+	 * Since the ifdef is enabled, we know that at least the copy/paste
+	 * commands are enabled.  Binding the copy to ^S is inconvenient, so
+	 * ask curses to permit that (saving an external tweak with stty).
+	 *
+	 * Disable the feature in lynx.cfg with
+	 *    KEYMAP:^S:UNMAPPED
+	 */
+	if (keymap[KTL('S')] != LYK_UNKNOWN) {
+	    struct termios alter_tty;
+
+	    CTRACE((tfp, "Allowing ^S as key-binding\n"));
+	    if (tcgetattr(fileno(stdin), &alter_tty) == 0) {
+		alter_tty.c_iflag &= (unsigned) ~(IXON | IXOFF);
+		tcsetattr(fileno(stdout), TCSAFLUSH, &alter_tty);
+		def_prog_mode();
+	    }
+	}
+#endif
 #endif /* ncurses-keymaps */
 
 	/*
diff --git a/src/LYKeymap.c b/src/LYKeymap.c
index 2ec5d919..fdfcac38 100644
--- a/src/LYKeymap.c
+++ b/src/LYKeymap.c
@@ -1,4 +1,4 @@
-/* $LynxId: LYKeymap.c,v 1.123 2023/10/27 20:10:32 tom Exp $ */
+/* $LynxId: LYKeymap.c,v 1.124 2024/01/08 23:53:57 tom Exp $ */
 #include <HTUtils.h>
 #include <LYUtils.h>
 #include <LYGlobalDefs.h>
@@ -228,27 +228,28 @@ static LYEditConfig myKeymapData =
 
 LYKeymap_t key_override[KEYMAP_SIZE];
 
+#define EDIT_INIT(c,l) {(c)+1, (l)}
 static const LYEditInit initOverrideData[] =
 {
-    {22, LYK_NEXT_DOC},		/* ^V */
-    {47, LYK_TAG_LINK},		/* . */
+    EDIT_INIT(CTL('V'), LYK_NEXT_DOC),
+    EDIT_INIT('.', LYK_TAG_LINK),
 #ifndef SUPPORT_CHDIR
-    {68, LYK_CREATE},		/* C */
+    EDIT_INIT('C', LYK_CREATE),
 #else
-    {68, LYK_CHDIR},		/* C */
+    EDIT_INIT('C', LYK_CHDIR),
 #endif
-    {71, LYK_DIRED_MENU},	/* F */
-    {78, LYK_MODIFY},		/* M */
-    {83, LYK_REMOVE},		/* R */
-    {85, LYK_TAG_LINK},		/* T */
-    {86, LYK_UPLOAD},		/* U */
-    {100, LYK_CREATE},		/* c */
-    {103, LYK_DIRED_MENU},	/* f */
-    {110, LYK_MODIFY},		/* m */
-    {115, LYK_REMOVE},		/* r */
-    {117, LYK_TAG_LINK},	/* t */
-    {118, LYK_UPLOAD},		/* u */
-    {271, LYK_DO_NOTHING},	/* DO_NOTHING */
+    EDIT_INIT('F', LYK_DIRED_MENU),
+    EDIT_INIT('M', LYK_MODIFY),
+    EDIT_INIT('R', LYK_REMOVE),
+    EDIT_INIT('T', LYK_TAG_LINK),
+    EDIT_INIT('U', LYK_UPLOAD),
+    EDIT_INIT('c', LYK_CREATE),
+    EDIT_INIT('f', LYK_DIRED_MENU),
+    EDIT_INIT('m', LYK_MODIFY),
+    EDIT_INIT('r', LYK_REMOVE),
+    EDIT_INIT('t', LYK_TAG_LINK),
+    EDIT_INIT('u', LYK_UPLOAD),
+    EDIT_INIT(DO_NOTHING, LYK_DO_NOTHING),
     {-1, LYE_UNKNOWN}
 };