ref: 778016d179f5e200097de604a84e49c14bf8cabd
dir: /rio-literalnext/
From: noodle <noodle@pastanoggin.com>
Date: Sun, 11 Jan 2026 05:57:55 +0000
Subject: [PATCH] allow escaping C0 control codes via ^'
---
diff 24b39ab89c9fbcac2905a0a6949f07f16fea280b 323a2247215fa0092823bb22e76c4d77fb9cdc65
--- a/sys/include/keyboard.h
+++ b/sys/include/keyboard.h
@@ -60,6 +60,7 @@
Keof= 0x04,
Kenq= 0x05,
Kack= 0x06,
+ Kbel= 0x07,
Kbs= 0x08,
Knack= 0x15,
Ketb= 0x17,
--- a/sys/man/1/rio
+++ b/sys/man/1/rio
@@ -389,6 +389,9 @@
for the preceding string (see
.IR complete (2)).
.PP
+A BEL character (control-') signals that the following character is taken literally
+(read: quoted).
+.PP
Typing a left or right arrow moves the cursor one character in that direction.
Typing an SOH character (control-A) moves the cursor to the beginning of the
current line; an ENQ character (control-E) moves to the end. The STX character
--- a/sys/src/cmd/rio/wind.c
+++ b/sys/src/cmd/rio/wind.c
@@ -842,6 +842,7 @@
static void
wkeyctl(Window *w, Rune r)
{
+ static literal;
uint q0 ,q1;
int n, nb;
int *notefd;
@@ -856,6 +857,10 @@
case Kaltgr:
return;
}
+ if(literal){
+ literal = 0;
+ goto Ordinary;
+ }
if(w->i==nil)
return;
@@ -932,6 +937,9 @@
wsetselect(w, w->qh, w->qh);
wshow(w, w->q0);
return;
+ case Kbel: /* ^': literal next */
+ literal = 1;
+ return;
}
if(w->rawing && (w->q0==w->nr || w->mouseopen)){
waddraw(w, &r, 1);
@@ -983,6 +991,8 @@
}
return;
}
+
+ Ordinary:
/* otherwise ordinary character; just insert */
q0 = w->q0;
q0 = winsert(w, &r, 1, q0);
--- a/sys/src/cmd/samterm/samterm.h
+++ b/sys/src/cmd/samterm/samterm.h
@@ -8,8 +8,6 @@
enum{
Up,
Down,
-
- Kbel=0x7,
};
typedef struct Text Text;
--
⑨