Community
    • Login

    why SCI_APPENDTEXT changed NPP default background?

    Scheduled Pinned Locked Moved Notepad++ & Plugin Development
    5 Posts 3 Posters 1.2k Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • glandonG Offline
      glandon
      last edited by

      Maybe something wrong, i didn’t get the root cause.

      986d3770-3539-42c6-884c-27249c60ff6a-image.png

      glandonG PeterJonesP rdipardoR 3 Replies Last reply Reply Quote 0
      • glandonG Offline
        glandon @glandon
        last edited by

        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;
        

        }

        1 Reply Last reply Reply Quote 0
        • PeterJonesP Offline
          PeterJones @glandon
          last edited by PeterJones

          @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 from stylers.model.xml into stylers.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.

          1 Reply Last reply Reply Quote 2
          • rdipardoR Offline
            rdipardo @glandon
            last edited by

            @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.

            glandonG 1 Reply Last reply Reply Quote 2
            • glandonG Offline
              glandon @rdipardo
              last edited by

              @rdipardo Perfect, with your guide, my code works well again, thanks!

              1 Reply Last reply Reply Quote 0

              Hello! It looks like you're interested in this conversation, but you don't have an account yet.

              Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

              With your input, this post could be even better 💗

              Register Login
              • First post
                Last post
              The Community of users of the Notepad++ text editor.
              Powered by NodeBB | Contributors