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:
SCI_FORMATLIMITEDRANGEFULL) that essentially duplicates the SCI_FORMATRANGEFULL command, but making it stop as cpMax instead of continuing beyond when looking for EOLSCI_SETFORMATRANGELIMITMODESC_FORMATRANGE_EOL=0 for default search-for-EOL, and SC_FORMATRANGE_HARDSTOP=1 for the "hard stop"bool draw to be int drawModeSC_FORMATRANGE_NONE=0 for no-draw, SC_FORMATRANGE_EOL=1 for normal mode, and SC_FORMATRANGE_HARDSTOP=2 for the "hard stop" at cpMax