9 ms·
I love the "It's harmless with a terminal emulator". I (obviously) get what they're saying, but you'd think making millions of people waste 3 seconds of their l
by dataflow 3y ago
I love the "It's harmless with a terminal emulator". I (obviously) get what they're saying, but you'd think making millions of people waste 3 seconds of their lives every time would be considered at least a modicum of harm.
- draw_down 3y ago[dead]
- hnlmorg 3y agoThat’s a touch exaggerative don’t you think? reset wouldn’t be used used by millions of people and most of those who do use wouldn’t be using it regularly either. reset should be a last resort. If you need to use it then something else has gone wrong and thats what needs to be fixed. I’m all for modernising our terminal but in this instance we are talking about a last resort command taking 3 seconds longer than needed just in case some of some edge case scenario occurs. So 3 seconds is definitely not harmful.
- ryandrake 3y agoI think in this case it's a bit exaggerative, but this isn't the only example--the mentality is pervasive throughout software engineering: It's OK to sacrifice the user's time (through poor software performance, unnecessary network calls, mutexes and synchronization, and deliberate delays) for developer comfort, or if it means we can go fix something else, or if it's just a really hard problem... Hey, user's time doesn't cost us and they can always wait... And it adds up: 100ms here, 200ms there, times millions of users, times dozens of times per day the issue happens, and it's no wonder our 2024-era supercomputers still feel about as slow as my 2004 Windows XP machine.
- hnlmorg 3y agoI completely agree. But in this case ‘reset’ isn’t the problem. It’s that terminal emulators don’t surface an easier and more standardised way to clear their scrollback history. That’s the thing that needs fixing.
- mhw 3y ago> sleep(1); /* let terminal settle down */ > making millions of people waste 3 seconds > That's a touch exaggerative don't you think? Literally!
- benwaffle 3y agoI use it to clear my scrollback buffer. It makes it easier to search any new output.
- hnlmorg 3y agoThere’s probably a hot key in your terminal emulator to do that. Fewer buttons to press, so even quicker. ;)
- IshKebab 3y agoSadly there isn't on Linux. There is on Mac - Ctrl-K. But for some reason nobody on Linux has realised how useful it is. It's actually even better than `reset` because it works at any time.
- mbork_pl 3y agoThere is in kitty: https://sw.kovidgoyal.net/kitty/conf/#shortcut-kitty.Reset-the-terminal https://sw.kovidgoyal.net/kitty/conf/#shortcut-kitty.Reset-t...
- hnlmorg 3y agoI think you're conflating SHELL with TERM because the OS has nothing to do with what hot keys your terminal emulator supports (the OS wouldn't dictate hot keys available for shells either, but popular Linux distros don't tend to default to Zsh like macOS does). A terminal emulator is the software application you use to bring the command prompt up. So a terminal emulator is operating system agnostic. Granted there are some macOS only terms out there like iTerm2 and Apples own Terminal. Just as there are terminals that haven't (as far as I'm aware) been ported to macOS, like xterm. But there's plenty of cross platform terminal emulators too, in fact most are cross platform.
- IshKebab 3y agoI'm not conflating anything. On Mac you can press Ctrl-K in any terminal emulator and it will clear the terminal and scrollback. On Linux no terminal emulators support this (except Kitty it turns out - as mentioned in the other comment). Sadly Kitty is very bare-bones. Not really for me. And I can't choose to use Kitty in VSCode.
- dataflow 3y ago> reset should be a last resort. If you need to use it then something else has gone wrong and thats what needs to be fixed. Er, my comment was exaggerative? (edit: fixed typo) I use reset all the time, it's not "last resort" by any means. It... clears the screen and scrollback buffer. If you're the kind of person who keeps 150 tabs open then I guess I can see why you wouldn't see the value in cleaning the screen up frequently, but clearing the terminal is a pretty frequent and useful operation for other folks.
- sidneythekidney 3y agoIf you only need to clear the screen, you may want to check out clear(1).
- dataflow 3y agoI literally edited my comment just before you said this because I suddenly realized someone was going to say this. No, the point is never just the "screen". The point is the whole buffer including the screen. Clearing just the screen is pretty useless to me, I might as well just scroll down or hold Enter for 3 seconds.
- sidneythekidney 3y agoHah :) You could try echo -ne '\ec' or echo -ne '\033c'. Or this from bash/readline: clear-display (M-C-l) Clear the screen and, if possible, the terminal's scrollback buffer, then redraw the current line, leaving the current line at the top of the screen. But yea, this might depend on terminal as well
- dataflow 3y agoI'm aware, I already have reset() { clear && printf '\33c'; }
- Ennea 3y agoMy terminal emulator of choice, WezTerm, has this feature built in [1], so there's no need for using `reset`. Perhaps your terminal emulator has something like it, too? [1] https://wezfurlong.org/wezterm/config/lua/keyassignment/ClearScrollback.html https://wezfurlong.org/wezterm/config/lua/keyassignment/Clea...