Frederick888/external-editor-revived

Auto disable line wrap for the edited message

paride opened this issue · 10 comments

Description

When editing a message with the external editor, once it's saved and moved to the TB native editor, longs lines are wrapped (and sent wrapped). That's not desirable in my opinion: any wrapping should be done by external editor. My use case is writing text, plus code snippets (which are sacred and shouldn't be wrapped).

I could disable wrapping TB-wide, but sometimes I want to write simple message with TB's native editor. I think the ideal solution would be to get this extension disable wrapping for the message it edits (not sure this is feasible).

(Huge thanks for this much needed extension!)

Environment

  • OS: Linux
  • Thunderbird version: 102.0.1
  • ExtEditorR extension version: 0.3.0
  • ExtEditorR host version:v0.3.0

Can you use https://addons.thunderbird.net/en-us/thunderbird/addon/toggle-line-wrap/ for the time being?

The linked extension uses an experimental Thunderbird API, thus

  • requires full access to TB
  • potentially needs to be updated frequently to keep up with TB API changes

So unless this gets requested by a lot of other users as well, I reckon it's better to leave it to a separate extension. I'm more than happy to add this functionality once the API is stabilised of cos.

Makes sense, thanks.

Firstly thanks very much for writing this extension!

unless this gets requested by a lot of other users as well, I reckon it's better to leave it to a separate extension.

I also hit this problem. To keep noise down on this issue, perhaps a thumbs up on the comment by @Frederick888 which I've quoted would be a good way of indicating that you'd like this feature (which I've just done)?

@tim-seoss I just realised that messenger.ComposeLineWrap wasn't an experimental API from Thunderbird itself but one registered by Toggle Line Wrap. So filing a feature request to https://bugzilla.mozilla.org to provide the same API natively is more appropriate.

Adding @jan-kiszka (developer of Toggle Line Wrap).

I'm affected by this as well. The symptom I'm encountering is a bit different though (I think anyway) from the one reported at the top of this ticket. Namely, for me the undesired wrapping occurs when invoking ExtEditorR from TB upon a message already being composed, for which wrapping has already been disabled using Toggle Line Wrap. In other words, the damage to the composition occurs as soon as I invoke ExtEditorR, not (only) when I return from ExtEditorR to Thunderbird.

Env:

  • Toggle Line Wrap 1.4.1
  • External Editor Revived 0.4.3
  • Thunderbird 102.5.0

Steps:

  1. Select Message | New Message in the main Thunderbird window / main menu bar.
  2. Click the Line Wrap button in the composition window, so that the red off icon appears atop of Line Wrap.
  3. Open your favorite editor manually, enter an a character, followed by 126 space characters, followed by a b character, and then a newline. This makes for a line that's 128 characters long.
  4. Copy this line to the clipboard using the external editor, then paste it like 10 times into the Thunderbird composition window. This produces a column of as to the left, and a column of bs to the right -- no wrapping.
  5. Briefly toggle the Line Wrap button twice, so as to check, temporarily, that Thunderbird would normally wrap these lines, but won't wrap them now.
  6. With the separate (not wrapped) columns of as and bs visible in the composition window, click External Editor.
  7. As soon as the external editor displays the temporary file, the lines are already wrapped.

Which component is responsible for the wrapping?

Thank you.

@lersek I'm not sure if it's actually related, but TB recently changed the way how text is extracted from the composition window, and this change landed in 102.5.1. Could you upgrade and test again?

@Frederick888 thank you for the suggestion; I've installed 102.6.0, and indeed everything works fine.

Thanks for having reported https://bugzilla.mozilla.org/show_bug.cgi?id=1792551 in the upstream thunderbird bug tracker!

@Frederick888 would it be possible to use the messenger.ComposeLineWrap API that the Toggle Line Wrap extension defines to disable wrapping when editing a message with an external editor? This would make external-editor-revived depend on Toggle Line Wrap being installed for this feature to work, of course.

I'm also curious: how do you prevent Thunderbird from rewrapping your externally edited messages, which may contain text you don't want rewrapped (e.g. code snippets)? Do you just disable wrapping globally?

(Came here to see if anybody already reported this issue, and I found my own bug report!)

@paride for me, this use case has been working well. I first disable line wrapping using the Toggle Line Wrap extension, then invoke my external editor with the External Editor Revived extension. Using a recent enough Thunderbird, Thunderbird itself does no wrapping at all, so all the wrapping I want, I can (and have to) do in the external editor.