hannesm / jackline

minimalistic secure XMPP client in OCaml
BSD 2-Clause "Simplified" License
250 stars 20 forks source link

Multiline paste #227

Closed cfcs closed 2 years ago

cfcs commented 2 years ago

This commit adds support for multi-line pasting into a single message (so if you paste 10 lines you get one message that contains newlines as opposed to 10 individual messages). I think that's easier to read, and it's easier to copy-paste from.

I've been using this for a few years and it's been stable and worked nicely for me, but I haven't tested it on top of a recent main head. As noted in the commit message, the local editing could be implemented more nicely: with this patch it's still one single line where the newlines "show up" as invisible characters that you can delete/insert (by pasting), but it doesn't implement a multi-line edit buffer.

It looks like I also added another thing, the

`Cc = Uucp.Gc.general_category chr 

check that turns control characters into the unicode replacement character. It could be a separate PR, but splitting them out is awkward since they touch the same code. Happy to strip that part if you don't like it. :-)

ping @hannesm

cfcs commented 2 years ago

CI is unhappy, but I compiled it locally and it seems to work fine.

hannesm commented 2 years ago

Thanks for your patch. I rebased on top of main (where I fixed the CI issue), and added a minor style commit -- does that look reasonable to you? The code is rather far away in my head, but the changes are pretty local and should work (as long as Notty reports the Paste start and Paste end accordingly). I'd be fine to merge.

hannesm commented 2 years ago

Thanks, merged. This will automatically appear in our binary repositories :) (https://apt.robur.coop) once the daily scheduled build was executed.

cfcs commented 1 year ago

Sorry, yes, your changes look good!