News for hackers. Stuff that matters.
Re:Zsh and Fish’s simple but clever trick for highlighting m... by ComputerGuru on Sunday June 14, 2020 @04:10PM (#23520890)
No worries! (Now try figuring out what it does and why it does it from the code that you found spread out over a few hundred lines of C interspersed with curses calls and no comments.)
Re:Zsh and Fish’s simple but clever trick for highlighting m... by teddyh on Sunday June 14, 2020 @04:35PM (#23521100)
If I understand it correctly, if a terminal had the “bw” attribute, you could simply do

PROMPT_COMMAND='echo -n %;tput cub1; tput cub1; tput cud1; echo -ne \\r'

But the “bw” attribute does not seem to be common, so I guess the trick with spaces is usually necessary.

Re:Zsh and Fish’s simple but clever trick for highlighting m... by ComputerGuru on Sunday June 14, 2020 @10:29PM (#23523232)
I would think so?

Not directly in fish, because we manually set the tty flags and restore them after each execution (it's why your fish prompt doesn't break when you ^C in the middle of a redirect or when you accidentally output binary to the terminal), but e.g. in bash or if fish were to emit those escape codes directly. But yeah, it definitely seems like a good hack and it would cut down on the bandwidth requirements (you can notice the lag when using fish/zsh over ssh on a lossy connection).

Note that depending on the xn attribute, \r may or may not end up taking you to col 0 of the same row, depending on if the previous output caused a soft wrap but didn't include the trailing new line - you could wind up at col 0 of the previous row instead, if I'm reading it correctly!

Re:Zsh and Fish’s simple but clever trick for highlighting m... by ComputerGuru on Monday June 15, 2020 @02:03AM (#23524255)
Errr, you can disregard that bit about it not working in fish. This has nothing to do with flags/modes and would be very basic ansi escapes.