Opened 13 years ago

Last modified 10 years ago

#180 new enhancement

Paste detection in wordwrap

Reported by: adehnert@mit.edu Owned by:
Priority: major Milestone:
Component: ui Keywords:
Cc: andersk@mit.edu

Description

When pasting zephyr excerpts, code, and other preformatted text, it's annoying when Barnowl rewraps it. It'd be nice if Barnowl could detect pasting (by how quick the characters are coming, for example) and inhibited word wrap.

Change History (3)

comment:1 Changed 13 years ago by andersk@mit.edu

  • Cc andersk@mit.edu added

This particular misfeature has been discussed at length before, but IMO,

  • Underlying this ticket is a false dichotomy between typed paragraphs and pasted code. In reality, there’s also plenty of typed code and pasted paragraphs.
  • If you don’t know what you’re doing, I want your outgoing zephyrs to default to always wrapped, so that I can read them (even when you’re pasting paragraphs from Wikipedia).
  • If you do, you can :startup set edit:maxwrapcols -1 and gain a M-q finger macro, like I did.
  • For something that doesn’t really address the right problem at the right level, paste detection is a messy and unreliable kludge.

There are things we can and should improve, though.

I think the ideal solution is to replace our hard autowrapping with soft autowrapping:

  • Instead of inserting newlines as you type, BarnOwl should insert them before sending. (This can even be a per-protocol thing, because Zephyr is the only protocol we really want to be wrapping.)
  • The editwin should display soft newlines where they’re going to be inserted in your zephyr, so that you can see the wrapping before it happens.
  • We can bind a key to toggle edit:maxwrapcols in edit context.

Then if you paste in some code and then notice that it got inappropriately wrapped, you can fix it immediately.

comment:2 Changed 11 years ago by adehnert@mit.edu

Should we want to do something with paste detection at some point, http://cirw.in/blog/bracketed-paste may be useful.

comment:3 Changed 10 years ago by andersk@mit.edu

After thinking about this on -c davidben, I’d support the addition of a variable, enabled by default, to suppress bracketed pastes from doing anything other than plain textual input. So bracketed paste would turn off key bindings in recv, RET in single line edit, RET . RET in multiline edit, etc. (I have occasionally pasted a sequence of :filter commands into recv intentionally, but it’s fine to prevent that by default as long as the default can be overridden if necessary.)

I’d also be fine with a variable, disabled by default, to suppress wrapping for bracketed pastes into the edit window, since people seem to want that. (Remember, the defaults are for not designed for you and me, but for the users who don’t know what they’re doing yet and whose zephyrs we have to read.)

Note: See TracTickets for help on using tickets.