From f25fafae6c6cc277619989099b126788b88ab4d8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Deuc=D0=B5?= <shurd@sasktel.net>
Date: Wed, 23 Oct 2024 12:35:30 -0400
Subject: [PATCH] Fix some remains of input weirdness...

Now that the conio layer is handling translation of character sets,
the key handler in term.c should only handle terminal related
translations (such as backspace to delete).

This fixes bug 159, but there's still some inconsistency across
the various backends on how they handle C0 control characters and
input characters outside of US-ASCII.
---
 src/syncterm/term.c | 35 ++---------------------------------
 1 file changed, 2 insertions(+), 33 deletions(-)

diff --git a/src/syncterm/term.c b/src/syncterm/term.c
index 41d1c1c3bb..67b39b995f 100644
--- a/src/syncterm/term.c
+++ b/src/syncterm/term.c
@@ -4317,18 +4317,11 @@ doterm(struct bbslist *bbs)
 			if (key && (cterm->emulation == CTERM_EMULATION_ATASCII)) {
                                 /* Translate keys to ATASCII */
 				switch (key) {
-					case '\r':
-					case '\n': // 0x9b
-					case 155:
-						ch[0] = 155;
-						conn_send(ch, 1, 0);
-						break;
 					case CIO_KEY_DOWN:
 						ch[0] = 29;
 						conn_send(ch, 1, 0);
 						break;
 					case CIO_KEY_DC: /* "Delete" key */
-					case '\b':       /* Backspace */
 						ch[0] = 126;
 						conn_send(ch, 1, 0);
 						break;
@@ -4348,28 +4341,13 @@ doterm(struct bbslist *bbs)
 						ch[0] = 255;
 						conn_send(ch, 1, 0);
 						break;
-					case '\t':
-						ch[0] = 127;
-						conn_send(ch, 1, 0);
-						break;
-					case '|':
-						ch[0] = 124 + (atascii_inverse ? 128 : 0);
-						conn_send(ch, 1, 0);
-						break;
 					case 96: /* Backtick toggles inverse */
 						atascii_inverse = !atascii_inverse;
 						break;
 					default:
 						if (key < 256) {
-                                                        /* ASCII Translation */
-							if (key < 123) {
-								ch[0] = key + (atascii_inverse ? 128 : 0);
-								conn_send(ch, 1, 0);
-							}
-							else if (key > 252 && key < 256) {
-								ch[0] = key;
-								conn_send(ch, 1, 0);
-							}
+							ch[0] = key;
+							conn_send(ch, 1, 0);
 						}
 						break;
 				}
@@ -4394,7 +4372,6 @@ doterm(struct bbslist *bbs)
 						ch[0] = 147; /* Clear / Shift-Home */
 						conn_send(ch, 1, 0);
 						break;
-					case '\b':
 					case CIO_KEY_DC: /* "Delete" key */
 						ch[0] = 20;
 						conn_send(ch, 1, 0);
@@ -4638,14 +4615,6 @@ doterm(struct bbslist *bbs)
 					case CIO_KEY_IC:
 						conn_send("\033[@", 3, 0);
 						break;
-					case 17: /* CTRL-Q */
-						ch[0] = key;
-						conn_send(ch, 1, 0);
-						break;
-					case 19: /* CTRL-S */
-						ch[0] = key;
-						conn_send(ch, 1, 0);
-						break;
 					case CIO_KEY_BACKTAB:
 						conn_send("\033[Z", 3, 0);
 						break;
-- 
GitLab