why SCI_APPENDTEXT changed NPP default background?
-
Maybe something wrong, i didn’t get the root cause.
-
bool appendLogToNpp(std::string &log) {
if (log.empty()){
return true;
}int bufID = ::SendMessage(g_nppData._nppHandle, NPPM_GETCURRENTBUFFERID, 0, 0); if (g_curBufferID != bufID) { return false; } // Get the current scintilla int which = -1; ::SendMessage(g_nppData._nppHandle, NPPM_GETCURRENTSCINTILLA, 0, (LPARAM)&which); if (which == -1) { return false; } HWND curScintilla = (which == 0)?g_nppData._scintillaMainHandle:g_nppData._scintillaSecondHandle; ::SendMessage(curScintilla, SCI_APPENDTEXT, log.length(), (LPARAM)log.c_str()); //::PostMessage(curScintilla, SCI_SCROLLTOEND, 0, 0); ::SendMessage(curScintilla, SCI_GOTOPOS, ::SendMessage(curScintilla, SCI_GETLENGTH, 0, 0), 0); return true;
}
-
@glandon ,
Given the bright orange, I am wondering if you have triggered the change-history feature, but don’t have all the change-history colors in your active theme.
See the Settings > Preferences > Margins/Borders/Edge > Change History options, as well as Settings > Style Configurator > Global Styles for Change History Margin and, lower down in the same section, Change History modified, Change History revert modified, Change History revert origin, and Change History saved
Whether the latter of those are available depends on which version of Notepad++ you have, and whether your
stylers.xml
or theme has been updated to include those settings; if you have a recent Notepad++ and it doesn’t have those, you may have to update your stylers.xml or your theme from stylers.model.xml. (The User Manual has a section called “upgrading a portable edition”… but as the note at the bottom of that section says, the same procedure is useful for bringing over new settings fromstylers.model.xml
intostylers.xml
or your theme, as well.)But maybe I’m wrong, and it really is something weird going on with SCI_APPENDTEXT and your plugin’s code specifically, in which case someone else would have to step in to help you, because I’m not a plugin developer.
-
@glandon said in why SCI_APPENDTEXT changed NPP default background?:
Maybe something wrong, i didn’t get the root cause.
This looks like the same issue as the one discussed here.
The plugin needs to set the change history margin to a non-zero width, as demonstrated here.
-
@rdipardo Perfect, with your guide, my code works well again, thanks!