How to get breakpoint list ?
-
Sorry to bump this really old thread but the NppExec scripts above weren’t working for me, so i tried to write one myself. Here it is, when it finishes running it will echo a string which can be copied into another file.
cls set local currentline = 0 set local breakpoints = "" :repeat sci_sendmsg SCI_MARKERNEXT $(currentline) 0xFFFFFF // If marker next fails then we exit. if $(MSG_RESULT) == -1) exit // Next marker exists. else // Check if the market has looped back to 0. if $(MSG_RESULT) < $(currentline) echo $(breakpoints) exit else // Increment the resulting line by 1. set local currentline ~ $(MSG_RESULT) + 1 set local breakpoints = ${breakpoints} $(FILE_NAME) $(currentline) \r\n endif goto repeat endif
I couldn’t quite figure out how to make NppExec write to a file, so if anyone can add that i’d be really grateful.
-
@Bambofy ,
I’m not sure why you completely reworked @Michael-Vincent’s script, instead of just fixing the third line to
SET LOCAL MASK ~ (1<<24) -1
It seems that would have been a lot less work for you than redoing all the logic, slightly differently.
(I’m also really surprised that Michael’s code worked for him a few years ago; I don’t believe the definition of the MASK field of SCI_MARKERNEXT has changed in the last three years.)As far as redirecting the NppExec output to a file, did you look in Plugins > NppExec > Help/Manual, looking at section 4.5? Because section 4.5 is completely devoted to how to redirect output in NppExec, so that would seem like a natural place to start. As a hint, if you previously had
echo HI
you could replace it with
cmd /c echo HI > outputfile.txt
to redirect it to overwrite outputfile.txt,
orcmd /c echo HI >> outputfile.txt
to redirect it to append to outpputfile.txt
-
(I’m also really surprised that Michael’s code worked for him a few years ago; I don’t believe the definition of the MASK field of SCI_MARKERNEXT has changed in the last three years.)Nevermind. The definition of Notepad++'s MARK_BOOKMARK has changed in the last three years. Specifically, in v8.4.6 in Sept 2022, it was changed from 24 to 20 to work with Scintilla 5.3.0.
So just changing that single line to
SET LOCAL MASK ~ 1<<20
would have been sufficient.
In case you don’t understand: 3 years ago, when Michael wrote the script, bookmarks used mark#24, so
SET LOCAL MASK ~ 1<<24
set the mask to 0x1000000, so if bit #24 matched, it would say the line number.With v8.4.6 and newer, that marker is in bit #20, so if you only are looking at bit#24, it’s not going to find it. Your code, with 0xFFFFFF on the other hand, was looking at all marker numbers from 0 to 23, so it would find marker#20 as the bookmark line. But it would also find any of the other markers on those lines, even the ones that aren’t bookmarks – so it would find markers you weren’t looking for. If you file happened to have other marker types – like if you had any hidden lines due to View > Hide Lines or code folding in your active lexer – then it would report false matches.
Marker Number References
- Scintilla reserves #25-31 for folding margins
- Scintilla reserves #21-24 for Change History
- Notepad++ reserves #16-20 for “internal use” (specifically, 18 & 19 for hidden lines, and 20 for bookmarks, with two more for future use)
- Notepad++ allows #0-15 for plugins to use, but makes no guarantee that two plugins won’t try to make use of the same marker.