Skip to content

Conversation

@pull
Copy link

@pull pull bot commented Jun 8, 2025

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.1)

Can you help keep this open source service alive? 💖 Please sponsor : )

Summary by Sourcery

Deprecate obsolete Scintilla and Notepad++ plugin interfaces in favor of 2GB+ safe or newer APIs; extend PythonScript and plugin functionality for toolbar icon choice, sorting commands, dark mode, and docking dialogs; clean up generated stubs and correct typos across headers.

New Features:

  • Expose getToolBarIconSetChoice in PythonScript for retrieving current toolbar icon set
  • Add locale‐aware sort lines commands and introduce ERRORLIST language type

Enhancements:

  • Mark legacy Scintilla messages (GETSTYLEDTEXT, FINDTEXT, FORMAT RANGES, GETTEXTRANGE) and related structs as deprecated and migrate to FULL interfaces
  • Deprecate NPPM_GETOPENFILENAMES and related messages in favor of buffer-ID APIs
  • Enhance NppDarkMode with toolbar/fluent icon controls, accent color, background brushes, and painting utilities
  • Update DockingDlgInterface to support virtual creation overloads, custom icon IDs, and icon retrieval
  • Improve WcharMbcsConvertor API with size getters and consolidated encode signatures
  • Clean up PythonScript wrappers by removing old Scintilla methods and fixing return types
  • Correct typos, grammar, and comment clarity across multiple Notepad++ plugin headers

Chores:

  • Remove unused stubs and stdafx.h includes generated by PythonScript
  • Update copyright years to 2025 in plugin interface files

chcg added 2 commits June 7, 2025 23:03
update to N++ 8.8.2 pre
@pull pull bot added the ⤵️ pull label Jun 8, 2025
@sourcery-ai
Copy link

sourcery-ai bot commented Jun 8, 2025

Reviewer's Guide

This PR systematically migrates legacy Scintilla APIs to the newer “FULL” interfaces, enriches the Notepad++ plugin and PythonScript bindings with toolbar icon‐set and language/menu enhancements, refines dark mode and docking support, and applies wide‐ranging cleanup and deprecation of obsolete messages and functions.

Sequence Diagram for Scintilla API Usage Change in ScintillaWrapper::getWord

sequenceDiagram
    participant C as ClientCode
    participant SW as ScintillaWrapper
    participant SCN as ScintillaNativeAPI
    Note over C, SCN: Change in ScintillaWrapper::getWord internal implementation
    C->>SW: getWord(position, wordChars)
    SW->>SCN: Call SCI_WORDSTARTPOSITION(position, wordChars)
    SCN-->>SW: startPos
    SW->>SCN: Call SCI_WORDENDPOSITION(position, wordChars)
    SCN-->>SW: endPos
    Note right of SW: Previously might have used SCI_GETTEXTRANGE.
    SW->>SCN: Call SCI_GETTEXTRANGEFULL(0, &Sci_TextRangeFull)
    SCN-->>SW: Fill Sci_TextRangeFull with text between startPos and endPos
    SW-->>C: word string (from Sci_TextRangeFull)
Loading

Class Diagram for Scintilla API Struct Changes

classDiagram
    class Sci_CharacterRange {
        <<deprecated>>
        Sci_PositionCR cpMin
        Sci_PositionCR cpMax
    }
    class Sci_CharacterRangeFull {
        Sci_Position cpMin
        Sci_Position cpMax
    }
    Sci_CharacterRange --|> Sci_CharacterRangeFull : Replaced by

    class Sci_TextRange {
        <<deprecated>>
        Sci_CharacterRange chrg
        char* lpstrText
    }
    class Sci_TextRangeFull {
        Sci_CharacterRangeFull chrg
        char* lpstrText
    }
    Sci_TextRange --|> Sci_TextRangeFull : Replaced by

    class Sci_TextToFind {
        <<deprecated>>
        Sci_CharacterRange chrg
        const char* lpstrText
        Sci_CharacterRange chrgText
    }
    class Sci_TextToFindFull {
        Sci_CharacterRangeFull chrg
        const char* lpstrText
        Sci_CharacterRangeFull chrgText
    }
    Sci_TextToFind --|> Sci_TextToFindFull : Replaced by

    class Sci_RangeToFormat {
        <<deprecated>>
        Sci_SurfaceID hdc
        Sci_SurfaceID hdcTarget
        Sci_Rectangle rc
        Sci_Rectangle rcPage
        Sci_CharacterRange chrg
    }
    class Sci_RangeToFormatFull {
        Sci_SurfaceID hdc
        Sci_SurfaceID hdcTarget
        Sci_Rectangle rc
        Sci_Rectangle rcPage
        Sci_CharacterRangeFull chrg
    }
    Sci_RangeToFormat --|> Sci_RangeToFormatFull : Replaced by
Loading

Class Diagram for PythonScript ScintillaWrapper Method Changes

classDiagram
    class ScintillaWrapper {
        <<PythonScript>>
        -- Removed Methods --
        -GetStyledText(Sci_PositionCR start, Sci_PositionCR end) tuple
        -FindText(int searchFlags, Sci_PositionCR start, Sci_PositionCR end, object ft) object
        -GetTextRange(Sci_PositionCR start, Sci_PositionCR end) str
        -- Modified Methods --
        +MarkerSymbolDefined(int markerNumber) int  // Return type changed from intptr_t
    }
Loading

Class Diagram for NppDarkMode Struct Changes

classDiagram
    namespace NppDarkMode {
        class Colors {
             COLORREF background
             COLORREF softerBackground // Comment updated: ctrl background color
             COLORREF hotBackground
             COLORREF pureBackground // Comment updated: dlg background color
             COLORREF errorBackground
             COLORREF text
             COLORREF darkerText
             COLORREF hotText
             COLORREF disabledText
             COLORREF edge
             COLORREF hotEdge
             COLORREF disabledEdge
        }
        class AdvOptDefaults {
            <<Removed>>
            #std::wstring _xmlFileName
            #int _toolBarIconSet
            #int _tabIconSet
            #bool _tabUseTheme
        }
        class AdvancedOptions {
            <<Removed>>
            #bool _enableWindowsMode
            #NppDarkMode::AdvOptDefaults _darkDefaults
            #NppDarkMode::AdvOptDefaults _lightDefaults
        }
    }
Loading

Class Diagram for NppDarkMode Function Additions and Renames

classDiagram
    namespace NppDarkMode {
        class NppDarkModeFunctions {
            <<New and Renamed Functions>>
            +getToolbarIconInfo(bool useDark) TbIconInfo
            +getToolbarIconInfo() TbIconInfo
            +setToolbarIconSet(int state2Set, bool useDark) void
            +setToolbarIconSet(int state2Set) void
            +setToolbarFluentColor(FluentColor color2Set, bool useDark) void
            +setToolbarFluentColor(FluentColor color2Set) void
            +setToolbarFluentMonochrome(bool setMonochrome, bool useDark) void
            +setToolbarFluentMonochrome(bool setMonochrome) void
            +setToolbarFluentCustomColor(COLORREF color, bool useDark) void
            +setToolbarFluentCustomColor(COLORREF color) void
            +getAccentColor(bool useDark) COLORREF
            +getAccentColor() COLORREF
            +getCtrlBackgroundColor() COLORREF // Renamed from getSofterBackgroundColor
            +getDlgBackgroundColor() COLORREF // Renamed from getDarkerBackgroundColor
            +getCtrlBackgroundBrush() HBRUSH // Renamed from getSofterBackgroundBrush
            +getDlgBackgroundBrush() HBRUSH // Renamed from getDarkerBackgroundBrush
            +paintRoundRect(HDC hdc, RECT rect, HPEN hpen, HBRUSH hBrush, int width, int height) void
            +autoSubclassCtlColor(HWND hWnd) void
            +onCtlColorCtrl(HDC hdc) LRESULT // Renamed from onCtlColorSofter
            +onCtlColorDlg(HDC hdc) LRESULT // Renamed from onCtlColorDarker
            +onCtlColorDlgStaticText(HDC hdc, bool isTextEnabled) LRESULT // Renamed from onCtlColorDarkerBGStaticText
            +onCtlColorDlgLinkText(HDC hdc, bool isTextEnabled) LRESULT
        }
    }
Loading

Class Diagram for WcharMbcsConvertor and StringBuffer Changes

classDiagram
    class WcharMbcsConvertor {
        +char2wchar(const char* mbcs2Convert, size_t codepage, intptr_t* mstart, intptr_t* mend, int len) const wchar_t* // Added 'len' param
        +wchar2char(const wchar_t* wcStr, size_t codepage, intptr_t* mstart, intptr_t* mend, int lenIn, int* lenOut) const char* // Added 'lenIn', 'lenOut' params
        +getSizeW() size_t // New method
        +getSizeA() size_t // New method
        #StringBuffer~wchar_t~ _wideCharStr
        #StringBuffer~char~ _multiByteStr
    }
    class StringBuffer~T~ {
      +sizeTo(size_t size) void // Modified logic
      +empty() void // Modified logic
      +size() size_t // New method
      #size_t _dataLen // New member
    }
    WcharMbcsConvertor *-- "1" StringBuffer~wchar_t~ : uses
    WcharMbcsConvertor *-- "1" StringBuffer~char~ : uses
Loading

Class Diagram for DockingDlgInterface Changes

classDiagram
    class DockingDlgInterface {
        +create(tTbData* data, std::array<int, 3> iconIDs, bool isRTL) void // New overload
        +getIconIDs() const std::array<int,3>& // New method
        #std::array<int,3> _iconIDs // New member
        #run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) intptr_t // Modified FillRect to use NppDarkMode::getDlgBackgroundBrush()
    }
Loading

Class Diagram for PythonScript NotepadPlusWrapper Changes

classDiagram
    class NotepadPlusWrapper {
        <<PythonScript>>
        +getToolBarIconSetChoice() int  // New method
        +getFiles() list // Internally uses _DEPRECATED NPPM messages
        +activateBufferID(intptr_t bufferID) void // Internal logic change for NPPM_GETPOSFROMBUFFERID call
    }
Loading

File-Level Changes

Change Details Files
Deprecate and migrate legacy Scintilla interfaces to FULL variants
  • Comment out older SCI_GETSTYLEDTEXT, SCI_FINDTEXT, SCI_FORMATRANGE, SCI_GETTEXTRANGE definitions
  • Add deprecation notices and remove old Sci_TextRange, Sci_TextToFind, Sci_RangeToFormat structs
  • Remove wrapper methods GetStyledText, FindText, GetTextRange and switch to *Full variants
  • Update ScintillaWrapper and Enums to use Sci_TextRangeFull and SCI_GETTEXTRANGEFULL, SCI_FINDTEXTFULL, SCI_FORMATRANGEFULL
NppPlugin/include/Scintilla.h
PythonScript/src/Scintilla.h
PythonScript/src/ScintillaWrapperGenerated.cpp
PythonScript/src/ScintillaWrapper.h
PythonScript/src/ScintillaWrapper.cpp
PythonScript/src/ScintillaPython.cpp
PythonScript/src/Enums.h
PythonScript/src/EnumsWrapper.cpp
Expose new toolbar icon‐set choice API in scripting and wrapper layers
  • Introduce NPPM_GETTOOLBARICONSETCHOICE in plugin messages
  • Add getToolBarIconSetChoice() to NotepadPlusWrapper and bind to Python
  • Update NotepadPython bindings to expose toolbar icon-set choice
NppPlugin/include/Notepad_plus_msgs.h
PythonScript/src/NotepadPlusWrapper.h
PythonScript/src/NotepadPlusWrapper.cpp
PythonScript/src/NotepadPython.cpp
Deprecate old open-filenames messages and enrich menu/enum definitions
  • Rename NPPM_GETOPENFILENAMES(_PRIMARY/SECOND) to *_DEPRECATED
  • Add guidance to use buffer‐ID APIs instead
  • Add new menu commands (SORTLINES_LOCALE_ASC/DESC, ERRORLIST) and fix workspace spelling
  • Sync enum values in menuCmdID.h and PythonScript wrappers
NppPlugin/include/Notepad_plus_msgs.h
NppPlugin/include/menuCmdID.h
PythonScript/src/NotepadPlusWrapper.h
PythonScript/src/NotepadPython.cpp
Enhance NppDarkMode support with new brush/color APIs
  • Add functions for toolbar fluent color, ctrl/dialog backgrounds, accent color
  • Rename darker/softer background and brush getters to clearer names
  • Remove obsolete AdvOptDefaults/AdvancedOptions structs
  • Update dummy implementations accordingly
NppPlugin/include/NppDarkMode.h
NppPlugin/src/NppDarkModeDummy.cpp
Improve docking interface and resource definitions
  • Add contribution metadata in dockingResource.h
  • Unify indentation and message enums for DMM/DMN codes
  • Make create() virtual in DockingDlgInterface and overload for iconIDs
  • Add storage and accessor for _iconIDs in docking dialog interface
NppPlugin/include/dockingResource.h
NppPlugin/include/DockingDlgInterface.h
General cleanup and typo fixes across plugin code
  • Fix misspellings in Common.h, Docking.h, menuCmdID.h and comments
  • Remove redundant #include "stdafx.h" from several sources
  • Adjust parameter types (e.g., MarkerSymbolDefined return)
  • Clean up StringBuffer, WcharMbcsConvertor formatting and initialization
NppPlugin/include/Common.h
NppPlugin/src/StaticDialog.cpp
NppPlugin/src/dpiManagerV2.cpp
NppPlugin/include/Docking.h

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@pull pull bot merged commit 467c3b9 into rrosajp:master Jun 8, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant