From: Ingo Schwarze Subject: Re: ksh vi mode: prevent display corruption if line starts with utf8cont To: Walter Alejandro Iglesias Cc: tech@openbsd.org Date: Fri, 2 May 2025 15:38:10 +0200 Hello Walter, Walter Alejandro Iglesias wrote on Fri, May 02, 2025 at 01:01:33PM +0200: > On Tue, Apr 29, 2025 at 09:14:30PM +0200, Ingo Schwarze wrote: >> If someone can tell me about a way to type in arbitrary bytes - >> in particular bytes > 0x7f - into xterm(1) or wscons(4), that >> would be appreciated to make manual testing easier. > In case I understand what you're asking correctly, in xterm(1) you can > do something like the following, for some reason it doesn't work well > for UTF-8 start bytes but it seems to work for continuation bytes. > First edit ~/.Xmodmap: > > ! ~/.Xmodmap > !keycode 67 = F1 F1 F1 F1 F1 F1 XF86Switch_VT_1 F1 F1 XF86Switch_VT_1 > !keycode 68 = F2 F2 F2 F2 F2 F2 XF86Switch_VT_2 F2 F2 XF86Switch_VT_2 > keycode 67 = 0x82 > keycode 68 = 0xac > > Then run: > > $ xmodmap ~/.Xmodmap Thanks for the idea. I don't think this is sustainable though: I do not have 128 spare keys on my keyboard that i could use for such a purpose. What i'm looking for is something like pressing a modifier key, then typing in the byte number. For example, in vi(1), i can press Ctrl-X, then type the hex digits '8' and '0' and i get the byte '\x80'. I didn't find anything like that in X or xterm(1) yet. As a workaround, the trick mentioned by lucas@, using a second xterm(1) window to combine printf(1) with the xclip(1) port and then paste the byte(s) with the mouse is also very hackish, but more flexible and less disruptive than the reconfiguration you suggest. Yours, Ingo P.S. By the way, i'm still looking for an OK for the display() diff to prevent command line corruption in ksh(1) VI mode: https://marc.info/?l=openbsd-tech&m=174595466007518 > In my keyboard, with the example above, F1 will print 0x82 and F2 0xac > (I put also the original keycode setting in the file to be able to reset > those keys after doing the test.) To select which key you prefer to > use: > > $ xmodmap -pke