NPP_ExportPlugin icon indicating copy to clipboard operation
NPP_ExportPlugin copied to clipboard

Extra highlights not included in Copy or Export

Open pryrt opened this issue 5 years ago • 4 comments

As discussed in https://community.notepad-plus-plus.org/topic/19448/copying-highlighted-text-lines-from-1-notepad-file-to-another/:

if I have additional styling (such as Mark Using 3rd Style), that extra styling isn't included in the Copy HTML or RTF to clipboard.

Not mentioned in that thread: the same is true for Export to HTML or RTF.

I'm not sure whether it's a bug report or a feature request, but either way, the reasonable expectation is that all highlighting -- whether from active lexer/syntax highlighter or from user-applied Styles, Marks, etc -- would be included in the Export/Copy-to HTML/RTF.

I tried with both v0.2.9.21 that came bundled with Notepad 7.8.6, and the newer v0.3.0 which isn't in nppPluginList yet.

pryrt avatar May 22 '20 18:05 pryrt

As clarified in the forum thread, the original poster's need was to copy highlights from one file in NPP to another. Since the NppExport plugin uses the Windows clipboard formats, and NPP itself will only paste from the plaintext entry in the clipboard, NppExport won't help the OP.

However, after my experiments, I would still expect the copy-to-HTML and export-to-HTML to include "extra" stylings, such as the Mark... > Using 3rd Style. However, I don't frequently use this feature, so it's not an urgent request. But it would be nice, eventually, to include the"extra" highlights in the export/copy using this plugin.

pryrt avatar May 22 '20 19:05 pryrt

Though maybe that is handled by SCI_STYLEGETHOTSPOT(https://www.scintilla.org/ScintillaDoc.html#SCI_STYLEGETHOTSPOT), but that is something different and not relevant here.

The relevant part seems to be:

#define SCE_UNIVERSAL_FOUND_STYLE_EXT1 25 #define SCE_UNIVERSAL_FOUND_STYLE_EXT2 24 #define SCE_UNIVERSAL_FOUND_STYLE_EXT3 23 #define SCE_UNIVERSAL_FOUND_STYLE_EXT4 22 #define SCE_UNIVERSAL_FOUND_STYLE_EXT5 21

with e.g.

execute(SCI_INDICSETSTYLE, SCE_UNIVERSAL_FOUND_STYLE_EXT1, INDIC_ROUNDBOX);

and further calls with:

SCI_INDICATOR...

see e.g. https://www.scintilla.org/ScintillaDoc.html#SCI_INDICATORVALUEAT

chcg avatar Dec 07 '20 15:12 chcg

@chcg,

This recent Community Forum discussion shows that there are still users out there who want my original interpretation -- that is, that the user-applied additional styling (such as Mark Using Nth Style) get put in the exported RTF or HTML, not just the lexer styling.

pryrt avatar May 23 '22 16:05 pryrt

User applied 1th-5th style is handled additionally to the styling which is currently retrieved in code via SCI_GETSTYLEDTEXT. So current response from SCI_GETSTYLEDTEXT in dataBuffer seems to be not easily usable. Additionally multiple indicators could be set for the same text part.

chcg avatar Oct 24 '22 21:10 chcg