Fixes case switching keybinds gu and gU so they dont chew up newlines - #1381
Fixes case switching keybinds gu and gU so they dont chew up newlines#1381Nomarian wants to merge 1 commit into
Conversation
rnpnr
left a comment
There was a problem hiding this comment.
I don't think you need something so complicated:
awk '{print tolower($0)}'
should do the trick. You don't need to mess with the field separator or force gawk.
Personally I think we should just axe this whole passing off text editing functionality to external tools but that's a different story.
|
It is necessary because print adds a newline. (so selections are not usable) So you must use printf or ORS="". But then you have a problem with RS="", which is that awk has this weird thing that eats away the last newline before EOF. This is an all AWKs thing Now that I think about it, gawk can use \0 in RS, so if its that. |
|
Frankly I think it's a problem with the way vis handles the result. But we can't really fix here without breaking every other use of Like I said, this whole passing off text editing tasks to external programs needs to be thrown away. It's not bloat for a text editor to perform text edits. |
|
No no, its fine, its awk, awk is the problem. Both sed and tr work perfectly well to transform text, take a bunch of text, transform it, print it out, its a simple gsub() call. But awk does not work this way, awk reads a chunk of text until it hits the the record separator (RS), and it throws away the separator itself, you don't know if there is a RS, which means this is tricky (and wrong) gawk is the only one that tells if there is an RS by saving it in RT (record terminator), but this is gawk specific. if RS is multiple characters, it can be a regex, which means this is also possible This is by far the best, most portable solution, there is one awk that does not support RS to be a regex (goawk), but that's also not the default anywhere. I will keep using this last one for a while and see if there's a pitfall. |
Fixes #1238 #1320
| tr does the appropriate behavior but gawk supports other languages. so gawk is used
This makes it unportable, but if portability is desired, then | tr should be used and if which gawk returns true then gawk is used.