Menu

#1587 "hard stop" SCI_FORMATRANGEFULL (Option or Variant)

Initial
open
nobody
5
3 hours ago
3 hours ago
pryrt
No

As discussed in Notepad++ PR#18063, it would be useful to have an version of SCI_FORMATRANGEFULL that forces it to not go beyond chrg.cpMax rather than the current implementation using cpMax as a "suggestion" and actually stopping at the the first line-ending (or EOF) after the cpMax as the end point

In the Notepad++ use case, it would allow inserting page breaks at formfeed (ASCII 12, U+000C). But it would also allow other use cases -- as a text-based application might have any number of reasons for intentionally breaking the page at a specific point (I could immediately think of making the pages all have the same number of characters, but I am sure there are other use cases that I haven't thought of).

As far as implementation goes, I had two ideas:

  • dedicated message (like SCI_FORMATLIMITEDRANGEFULL) that essentially duplicates the SCI_FORMATRANGEFULL command, but making it stop as cpMax instead of continuing beyond when looking for EOL
  • or have some way to set an option for it on the fly: like another message, something like
    • a separate SCI_SETFORMATRANGELIMITMODE
      • with SC_FORMATRANGE_EOL=0 for default search-for-EOL, and SC_FORMATRANGE_HARDSTOP=1 for the "hard stop"
    • or maybe repurposing the wParam bool draw to be int drawMode
      • with SC_FORMATRANGE_NONE=0 for no-draw, SC_FORMATRANGE_EOL=1 for normal mode, and SC_FORMATRANGE_HARDSTOP=2 for the "hard stop" at cpMax

Discussion


Log in to post a comment.

Auth0 Logo