Hacker News new | ask | show | jobs
by randomfool 1870 days ago
Does anyone know if there's a trick to avoid the trailing newline when double-clicking a line to copy/paste it elsewhere?

This always annoys me for single-line commands. I'd love a CSS solution but can only think of some ugly JS approaches.

2 comments

I hate that too, and it seems to be a very common default behaviour of text selection. Even Vim does it when you copy a whole line.

It's one of those little UI annoyances that refuse to disappear. Just like blinking cursors in unfocused input fields & windows.

I think that’s because, if you follow selection of a full line by a backspace/delete/cut, you expect the new line to disappear.

Apart from undo state, you also want cut to be equivalent to copy; backspace.

It probably ties into the whole “line ending not newline” philosophy of requiring files to end with an EOL character.
I mean you can probably fix this with autohotkey.

Whether this is a good idea is a whole different matter.