You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 3, 2025. It is now read-only.
Repository navigation
This repository was archived by the owner on Oct 3, 2025. It is now read-only.
Cited text shows up as ordinary text after returning from external editor #66
When the external editor opens, and you save the text and quit the external editor, all text shows up as “normal text”. Even lines that had been marked as cited before (blue on white in the default Thunderbird setup; pressing Enter in such a block auto-inserts “> ” at the start of the next line, and such) become ordinary text lines, too (black on white in the default setup).
@nicoroeser, I spent the last two days also bugged by this problem.
I could not find a solution yet, but I found out the following:
Thunderbird 68 (the one I tested it) is adding a white-space just before the greater-than sign.
Looking in the source code, I think the editor.insertText() might be the cause of problem: I guess it looks for the greater-than symbol in the beginning of a line and prepend it with a white-space.
Calling "Edit→Rewrap" or "Edit→Paste as Quotation" in the editor window "fixes" the problem (introducing others, such as rewrapping the text where it shouldn't or adding an extra greater-than symbol in the pasted message).
I have zero knowledge about the Mozilla code-base and JavaScript (used to develop this extension), but I hope this information will help the maintainers to hunt down this bug.
Unfortunately, insertTextWithQuotations() is already removed (patch), so we can't use that function on Thunderbird 68 :(. In fact, current code is a product of workaround for that removal.
I haven't found a way to fix this issue with some simple API call. Maybe External Editor could do a rewrap after closing the editor, but it has some side effects as you mention.
External Editor can style the message as a HTML even when it is a plaintext, so it can replicate the Thunderbird functionality in principle. (i.e. parsing quotation >s and redo highlight as the rewrap command do). But it requires some work.
External Editor can style the message as a HTML even when it is a plaintext,
I am sorry, I don’t know what you mean by this. I hope that it will still be possible to use text-only (text/plain) messages in Thunderbird?
so it can replicate the Thunderbird functionality in principle. (i.e. parsing quotation >s and redo highlight as the rewrap command do). But it requires some work.
As I am bitten by this issue every day, I am willing to invest a bit of time here and try to produce code that can help. Unfortunately I do not understand the way of going forward which you are outlining here. If you could explain the idea a bit further or could share a few pointers into the code or relevant methods or whatever, I’d be grateful, and will happily give it a try!
editor is an nsIEditor at the moment, and we are using its insertText method. Am I right?
And there is insertAsCitedQuotation in nsIEditorMailSupport, which can insert a piece of text as a quotation.
So it seems to me that we have to parse the text in the JavaScript code of the External Editor addon. We need to alternately call insertText and insertAsCitedQuotation (with the leading > or > removed on each line because it will be re-inserted). This should properly move all of the text to the editor in Thunderbird.
I do not understand yet how to move the cursor or how to position Node objects within the document, but we probably do not need it at all if we handle everything in succession.
I’ve only had a brief look at the source code, and am not an expert on this. Please correct me if I’m wrong.
Activity
guiraldelli commentedon May 14, 2020
@nicoroeser, I spent the last two days also bugged by this problem.
I could not find a solution yet, but I found out the following:
editor.insertText()might be the cause of problem: I guess it looks for the greater-than symbol in the beginning of a line and prepend it with a white-space.I have zero knowledge about the Mozilla code-base and JavaScript (used to develop this extension), but I hope this information will help the maintainers to hunt down this bug.
EDIT:
It seems there is a function called
insertTextWithQuotations()that I have the feeling it could be correct one instead ofinsertText()given they have the same function signature.snipsnipsnip commentedon May 25, 2020
Hi, thanks for report and investigation.
Unfortunately,
insertTextWithQuotations()is already removed (patch), so we can't use that function on Thunderbird 68 :(. In fact, current code is a product of workaround for that removal.I haven't found a way to fix this issue with some simple API call. Maybe External Editor could do a rewrap after closing the editor, but it has some side effects as you mention.
External Editor can style the message as a HTML even when it is a plaintext, so it can replicate the Thunderbird functionality in principle. (i.e. parsing quotation
>s and redo highlight as the rewrap command do). But it requires some work.nicoroeser commentedon May 28, 2020
@snipsnipsnip, you wrote:
I am sorry, I don’t know what you mean by this. I hope that it will still be possible to use text-only (
text/plain) messages in Thunderbird?As I am bitten by this issue every day, I am willing to invest a bit of time here and try to produce code that can help. Unfortunately I do not understand the way of going forward which you are outlining here. If you could explain the idea a bit further or could share a few pointers into the code or relevant methods or whatever, I’d be grateful, and will happily give it a try!
nicoroeser commentedon Aug 24, 2020
editoris annsIEditorat the moment, and we are using itsinsertTextmethod. Am I right?And there is
insertAsCitedQuotationinnsIEditorMailSupport, which can insert a piece of text as a quotation.So it seems to me that we have to parse the text in the JavaScript code of the External Editor addon. We need to alternately call
insertTextandinsertAsCitedQuotation(with the leading>or>removed on each line because it will be re-inserted). This should properly move all of the text to the editor in Thunderbird.I do not understand yet how to move the cursor or how to position
Nodeobjects within the document, but we probably do not need it at all if we handle everything in succession.I’ve only had a brief look at the source code, and am not an expert on this. Please correct me if I’m wrong.
Insert text with quotes as intended
nicoroeser commentedon Sep 16, 2020
I’ve been using #75 for some time now without any problems. Has anyone else tried it and can give feedback?
Insert text with quotes as intended
nicoroeser commentedon Oct 22, 2020
Pull request updated and repaired. Tested with several empty and non-empty messages. Looks good to me now. 😄
Insert text with quotes as intended (#75)