ASCII table and history – Or, why does Ctrl+i insert a Tab in my terminal?
bestasciitable.com
bestasciitable.com
Modern terminal emulators can do this using the xterm modifyOtherKeys protocol, which sends escape sequences for such combinations.
Meta: I'm not among the downvoters; on the contrary I aim to upvote any on-topic reply (although I don't always get back to a thread, and anyway I suspect all my votes are shadow-ignored).
1a) try to figure out what the escape code for the play/pause key is 1b) it still suffers from the issue that esc keypresses cannot be distinguished from other escape codes 1c) The keyboard protocol can be turned on/off by user config, so there is no robust way for software running in the terminal to know if it is available or not. 1d) it does not support any modifiers beyond the basic 4 1e) It has no support for lock keys num lock/caps lock 1f) It has no support for alternate keyboard layouts 1g) it has no support for shifted keys 2) How does one represent release events in modifyOtherKeys?
xterm has a long and convoluted history of coming up with poorly designed hacks that the entire ecosystem has to carry around forever afterwards. Not wanting to support these mis-faetures is an entirely reasonable position.
Likewise, programs don’t really need to know if the terminal supports an extended set of key combinations, because they can just react to them if they arrive. If they don’t arrive, then either the terminal doesn’t support that feature or the user didn’t type that key combination; either way the program needs to do nothing.
As for modifiers, good look finding a keyboard that supports more than the basic four. No need for xterm to go out on a limb and support something you can’t use anyway.
And who cares about num lock and caps lock? I’ve never seen any program care what state they were in. Well, GDM does warn you if capslock is on during a password prompt, but that is very niche.
Terminals have never operated on scan codes, so keyboard layouts are irrelevant. The application doesn’t really care what button you pressed to get a Q, just that you typed a Q.
Likewise there has never been support for key release events on terminals. I suppose it’s useful for games, but in most other situations the user will have autorepeat configured and that will handle it.
Why should xterm go out on a limb and invent a scheme that tries to cover every possible future need, even needs that are not in evidence? Better to implement something simpler that just covers what is actually needed. It can always be extended later.
Yes programs need to know about an extended set of key combinations, because lots of programs just spill escape codes they dont understand to the screen. So you cannot produce such codes arbitrarily, only when a program indicates it wants them. And as is usual with xterm, it didnt bother to think this through. It has a facility for requesting these extended keys, but that facility may or may not work. And there is no way to detect if it has short of waiting for those keys. So if a program wants to say, present a different interface in terminals that support extended keys, it cant do so, because it has no way to know if the terminal does support it.
I dont need a keyboard that supports physical keys. I can repurpose unused physical keys as modifiers.
Its nice you dont care about num lock and caps lock. Its not so nice that you are foisting your lack of care on the rest of us.
Let me paraphrase what you said about keyboard layouts. "Something was not done previously and therefore it should never be done". Support for layouts means pressing ctrl+letter can work even on a cyrillic keyboard, but of course, terminals have never done that, and everyone speaks english anyway. So no one cares.
You suppose its useful for games? Try making a game that uses keys for real time control without release events. Autorepeat my ass. But ofcourse, no one cares. Are you in the habit of assuming that because you dont care about something, everyone else also must not care about it.
xterm absolutely shouldn't. it would make a pigs breakfast of it. I am very happy it didn't. What you should do is stop advocating for a broken, half assed hack.
It's all very tricky and quite an arcane art but it's possible to get, for example, the "Hyper" modifier when Emacs is ran inside an XTerm (that is: in "-nw" / no-window mode).
Maybe I should add a section about it though; KiTTY also seems to have some new keyboard protocol thingy now.
the idea of your program not doing graphics, but instead invoking and interacting with a simulated model of a teletype (a device nobody born after 1990 even knows what is) so then the graphics stack can render its behavior to screen is completely asinine, like on the "anyone who uses this in their work should be fired" level.
i could never decide what's stupider, this or the C language. both were obsolete 30 years ago. yet diehard patriotic nostalgia tripping nerds who have no idea how software engineering works but just want to learn complicated things to look cool fought tooth and nail to keep this crap alive for decades. whenever someone says "the UN*X way", they really are saying, "I designed something modularily, you could have never thought of that", but what it really means are all these insane nonsense ideas that don't even begin to make sense, like:
-a filesystem centric security model that doesn't even begin to address real world use cases
-C
-ad hoc encodings that never mattered like octal, everything being a int<my machine word size>
-*sh
-perl, tcl
-terminal emulators
-DNS
-all these shitty little tools that compose horribly, like sed, where you have to pass --sandbox to make up for the fact that it indeed composes horribly
-web and email, which are thoroughly embedded in UN\*X influence, and ergo, suck big time
-X.509
this is why open source sucks and is barely a competitor to proprietary garbage running in your IoT device. in fact, every single vulnerability in them springs from these bad ideas.i have
It's not about "open source", it's about compatibility. Changing the terminal text protocol is akin to changing a public API and would break programs. Actually, it's worse than changing a public API as you get no error and either nothing happens or the wrong thing happens and there is no good way to signal versioning (you can do some communication in "raw mode", but in the default buffered/cooked mode you can't really).
Almost all your gripes are about compatibility, really.
why does the console (it should be called console, as terminal refers to a setup that was obsolete 30 years ago) not have a proper input line? why does pasting a newline make it run? i should be able to type a command and edit it in a line that is a separate UI element from the text output. there is no compatibility argument here. only 0.001% of programs actually need to do anything other than be run and output text (and just text, not escape characters that do funny stuff). there's no dilemma that you love to imagine where changing it to work this way would cause massive incompatibility problems. we could even just make a new console called dumbtextconsole that works this way
viewing some logs from the shell is annoying as hell because the input goes into the program and once the program exits the shell runs whatever you typed. this is obviously a bad UI design. you will always have this stupid invisible buffer that you have to keep track of in your head the number of times you accidentally typed a letter there. if you ssh or tmux in, then you are more likely to enter bogus characters by accident when mistyping a command to ssh/tmux. the argument that its needed for compatibility is still moot if you only want a console for running commands. you dont need those interactive commands either. those are the most bogus hacky scripts that serve no purpose. i dont need a terminal to edit files either, that can be done with a proper GUI that runs outside the console.
it's also a security vulnerability the way shell input works. since you might paste something with a newline on the end and it will automatically execute. the idea that you should be responsible for what's in your clipboard is just bogus. you are resorting to some ad-hoc philosophy to argue this. if there was simple a proper input line where you pressed enter to run it, this wouldn't be a concern.
that one python shell.. Dreampy does this, no problem. the insane user who thinks it's a thing for some function to hijack random parts of the terminal[1] has his program break, and the rest of stuff just continues to work
this post also answers the "there are no alternatives" hackjobs in this comment chain. clearly there are alternatives, i just stated some, and once you follow this line of thought it actually leads to an entirely different OS (duh, why did i even have to state this, oh yeah, because you're disingenuous hackjobs). the fact that these people have the audacity to claim that UN*X, which is a absolutely highly specific way of designing things, that would never happen in isolation, is the only way to design an OS, proves how big of an issue this is in the software industry.
1. the insanity here being obviously that once you change random attributes about the global shared state, you have to assume other programs don't get the same idea as you and do stuff in conflicting ways
Unfortunately, the IT industry seems to have at some point decided that UNIX and C are somehow fundamental to computing, and the only way forward is to build more and more layers of abstraction on top of it.
The most depressing thing is that even "indie" OSes buy into this garbage (Serenity, Redox, ...). Yes, you get tons of (crappy) portable software that now runs on your platform for free, but at the cost of being stuck with a lowest-common-denominator API.
It’s a sincere question, because I also believe that user interfaces could be better and there is a room for discussion, but ggp only enumerated observable downsides without explaining how to transform them without losing functionality. Maybe I’m thinking in-the-box, but how could I e.g. control process groups if a terminal was just a canvas and some app wouldn’t support C-z? Or if a process group is also “UNIX”, then what’s the alternative to, well, a group of processes? The initial comment brings many questions without mentioning anything that could at least direct the line of thought.
For tiny games (and applications) in these machines, SDL ran everywhere, so most 320x240 and 640x480 ran on these embedded machines. Uberportable, fasts an dedicated UIs existed such as the GP2X menu. Thank libre software and Unix like OS and libraries for that. SDL and framebuffer based software exists, such as PDF readers and video players. Thus, you could design an electronic billboard for ads in the streets/subway with very little and a ridiculous power cost, being the big screen the most costly component here.
Back in the day, for SCUMMVM (Lucas Arts adventure games) they used tons of Unix utilities to generate the engine and data handling, they saved lots of hours on engineering. The same happens today. These small tools, with little preparation (The AWK programming language, man ksh, "perldoc perlintro"...) can do in days what for the programmers of non-Unix OSs took weeks of clumsy Python hacking.
UN*X does not have anything that makes it inherently performant in contrast to a sanely designed OS with one language instead of 10 that all do the same thing, a terminal emulator which is by design non performant, and a bunch of text formats that are also non performant and have bad semantics
> These small tools, with little preparation (The AWK programming language, man ksh, "perldoc perlintro"...) can do in days what for the programmers of non-Unix OSs took weeks of clumsy Python hacking.
no, it really can't. if you are string flinging on such a high level, your code is broken to hell. the reason perl awk bash sed suck so much is that they are intrinsically insecure the moment any input anywhere can be controlled by an adversary (and just wonky and gets in the user's way without even talking about security). working around that requires extreme levels of discipline that go far beyond programming in a real general purpose programming language (java, C#, ML, Pascla, Ada, etc). the moment you are able to write a secure *sh program, you are spending 3x as much time per line of code than in a real language.
>Perl/awk/sed suck so much...
Perl replaces awk, sed and sh and it's far better than python for system scripting. Python with whitespaces it's a clusterfuck.
>Secure sh program.
Perl has pledge(4) and unveil(4) support under OpenBSD from base. Far better than Java and C#. And I consider OpenBSD the correct BSD descendant following the best philosophies from Unix, even if I use Hyperbola GNU/Linux as a daily basis because of the freedom of sharing. And OFC a good bunch of OpenBSD tools are installed here, such as Oksh and sndio, doing proper audio mixing in userspace (and loopback monitoring, cool for WebSDR's and radio tools). Easy peasy. Try that with Windows.
BTW, those terminal emulators, Perl and the tools allow you to easily debug your IoT device over serial.
The terminal issue it's about configuration; some of them allow mouse actions, such as XTerm.
In the very rare cases where you need to change the indentation of a line, there's == or, if that doesn't work, you can indent a line forth and back with >> and << .
Ctrl-[ is impossible to type on, say, a German layout, as the [ character is hidden behind AltGr + 8, where AltGr is the right Alt key, which is itself (for most terminals/systems) just the combination of Ctrl+(left)Alt. So you'd basically have to type Ctrl+(Ctrl+Alt)+8 which is not possible....
I remember reading something, or maybe it was a talk on some conference, by someone who had some deep knowledge of the terminal layer. He explained some ways for alternatives to, say, ctrl+i, because something about the way the control characters only use 5 bits and if you type ctrl + a key that has the same lower 5 bits as "i", that also works like ctrl-i or something. I've been trying to find that video (or web page) again but I couldn't. But I think back then I found a replacement for ctrl+[ but I have long since forgotten it ...
Also, swap Ctrl and Caps Lock:
setxkbmap us -option compose:menu -option compose:rwin -option ctrl:swapcapsAnd I understand that accidentally hitting capslock can also be annoying when typing, but that happens so rarely (for me) that it's not an issue, and one could always just disable the capslock key in that case.
What am I missing?
I've seen this photo a hundred times and never thought about that. I wonder when ergonomics started being a thing when designing computer workplaces.
* carriage return used to be huge honking lever
It's strange to me that so many computer keyboards still have fold-out tabs at the back to emulate this. I even saw an old PS/2 keyboard with terraced rows just like a typewriter! But habit is a powerful thing. Pardon the tangent, but we're using an 1870s design whose main constraints were making room for key levers to travel up and down (which is also why we have staggered keys instead of an ortholinear grid). The funny thing is that there were decades more of alternative typewriter keyboard designs (look up the Hammond 1 for an example), but the first commercially successful typewriter, the Sholes and Glidden, is the one that won out in the end.
Look at what Douglas Englebart used for the "mother of all demos"
Seem to recall that ergonomics really took off in the 80s and 90s, as people started suing for things like RSI which made companies start to care. I remember that was when everyone seemed to be swapping out for adjustable chairs and bolting keyboard trays on desks and having everyone take ergo training.
I watched this documentary, about a huge computer, just massive, huge, and a guy called Forbin. It showed governement spending out of control, and the ensuing disaster, although I was a bit high at the time, and the plot eluded me.
Anyhow, the terminals seemed much nicer than you describe, so maybe it was down to the employer?
Military computer joins up with its Soviet counterpart and takes over the world. There may have been some teletypes, but the more memorable output device was the big scrolling line of text.
RESTORE COMMUNICATION -- FROM COLOSSUS -- TO GUARDIAN -- OR ACTION WILL BE TAKEN
IME, it was the early to mid 90's. Suddenly there were consultants for everything, and office/ergonomics consultants started popping up.
I suspect it's related to the shift to the widespread use of computers in the office. Carpal tunnel syndrome went from obscure to an "everyone knows someone with it" kind of thing. I knew someone who eventually had to wear big arm-length metal braces while using a VT-52.
The bean counters figured out that if they made small-money adjustments to their workplaces, they could save big money on health insurance premiums.
With the curious exception of Ctrl-?, which turns ON the 7th bit and results in DEL.
You can get around this with Ctrl-v
Like typing, at a shell prompt:
echo "<ctrl-v><ctrl-#>"
And it works for other things, like:
echo "<ctrl-v><esc>c" clears my screen.
(where <ctrl-key> means pressing <ctrl>+key, <esc> means pressing the escape key, etc)
Four Column ASCII: https://garbagecollected.org/2017/01/31/four-column-ascii/ (and associated HN discussion: https://news.ycombinator.com/item?id=13539552)
The Evolution of Character Codes, 1875-1968: https://archive.org/details/enf-ascii (and associated Github repo: https://github.com/e-n-f/ascii)
Bob Bemer, consider the "Father of ASCII", died in 2004 and his website has gone offline. The Wayback Machine has archives. It looks like the last one that was his website (before the current squatter) was: https://web.archive.org/web/20180511201723/http://bobbemer.c...
I was just wondering if there was an even better product of a design by committee.
ASCII is pretty good for its time and how it was created.
Unless your data happens to contain record, file, unit, group separators... Which is kinda the whole problem; ASCII does not have any proper separation/layering between the data and control characters.
Obviously you need a more elaborate protocol for embedding arbitrary data, but ASCII isn't the right place to define that.
It is as non human readable as the other ones. It's just that it got more support historically.
If e.g. Microsoft had used the separator control characters for CSV you can bet those control characters would have even better support than TAB does today.
Nowadays, it's of course a bit wasteful that of the first 32 characters of the most used character set only about one third is still being used. And it's pretty sad that the separators control characters are not used. We could have a much better CSV with them instead of the error prone CSV we have know.
But FWIW I almost daily use BEL.
clear the 7th bit.
I wonder how common it is to see bits numbered from 1 instead of 0, because "7th bit" to me is the top one in a byte, with weight 2^7 = 128.
The result is that, rather than articles getting contextually-dependent links that are customized for the community and the time (and which lead to particular discussions), you as the author have to try to come up with a single title that somehow manages to simultaneously be a reasonable title but also serves as its own pull quote (which also effectively prevents long content or manuals from getting linked at all)... it is utter madness, and that the moderators here don't seem to understand this dynamic (even in a "we realize this is bad but we are stuck with it for various reasons--which may include some that are trade offs--but are interested in looking into alternative options" way... dang, as one example, seriously seems to only defend this behavior as good, citing some form of author control despite failing to show that this isn't a problem for authors) is the main reason I wish Hacker News didn't have a from-network monopoly on this community :(.
Originally I wrote "why does ^I insert tab?" because it's a common question that kept coming up on the vi.stackexchange.com site. I figured a canonical slightly more in-depth answer would be useful.
To properly explain things a table is useful; but you can't really add that well on Stack Exchange sites because there's very limited formatting, so I had to create a site. I also never found ascii(1) convenient and most search results for "ascii table" are crap, so it became a "two flies with one stone" kind of thing.
Then I couldn't decide which title to use, so I added both. That's the only reason the page has the title that it has: the page has two purposes, so it has two titles. It wasn't intended to be cute or to grab anyone's attention. I'm surprised it was even submitted (and upvoted) here.