Merge branch 'Master' into Mui_Beta

This commit is contained in:
Pairi Daiza 2023-03-01 16:49:44 +01:00
commit 4c292ba033
No known key found for this signature in database
GPG Key ID: AC2515EF755AF96F

View File

@ -9413,6 +9413,19 @@ void EditSetBookmarkList(HWND hwnd, LPCWSTR pszBookMarks)
#define NOT_FOUND_LN ((DocLn)-1)
__forceinline int _GetAllNP3Markers(const DocLn iLine) {
return (SciCall_MarkerGet(iLine) & (ALL_MARKERS_BITMASK() | CHANGE_HISTORY_MARKER_BITMASK()));
}
static int _RespectLastSearch(const int bitmask) {
static int s_LastSearchBitmask = 0;
if (!(bitmask & s_LastSearchBitmask)) {
s_LastSearchBitmask = bitmask;
}
return s_LastSearchBitmask;
}
static inline DocLn _MarkerNext(const DocLn iLine, const int bitmask)
{
if (bitmask & CHANGE_HISTORY_MARKER_BITMASK()) {
@ -9433,8 +9446,7 @@ void EditBookmarkNext(HWND hwnd, DocLn iLine)
DocLn iNextLine = NOT_FOUND_LN;
bool bWrapedAround = true;
do {
bWrapedAround = !bWrapedAround;
int bitmask = SciCall_MarkerGet(iLine) & (ALL_MARKERS_BITMASK() | CHANGE_HISTORY_MARKER_BITMASK());
int bitmask = _RespectLastSearch(_GetAllNP3Markers(iLine));
if (!bitmask) {
bitmask = BOOKMARK_BITMASK();
}
@ -9451,9 +9463,9 @@ void EditBookmarkNext(HWND hwnd, DocLn iLine)
iNextLine = _MarkerNext(iLine + 1, bitmask); // find change history marker
}
if (iNextLine == NOT_FOUND_LN) {
// initial search not started from beginning?
if (iLine != 0) {
iLine = 0;
bWrapedAround = !bWrapedAround;
}
}
else { // check for consecutive change marker
@ -9464,6 +9476,7 @@ void EditBookmarkNext(HWND hwnd, DocLn iLine)
}
}
}
bWrapedAround = !bWrapedAround;
} while ((iNextLine == NOT_FOUND_LN) && !bWrapedAround);
if (iNextLine != NOT_FOUND_LN) {
@ -9494,8 +9507,7 @@ void EditBookmarkPrevious(HWND hwnd, DocLn iLine)
DocLn iPrevLine = NOT_FOUND_LN;
bool bWrapedAround = true;
do {
bWrapedAround = !bWrapedAround;
int bitmask = SciCall_MarkerGet(iLine) & (ALL_MARKERS_BITMASK() | CHANGE_HISTORY_MARKER_BITMASK());
int bitmask = _RespectLastSearch(_GetAllNP3Markers(iLine));
if (!bitmask) {
bitmask = BOOKMARK_BITMASK();
}
@ -9513,9 +9525,9 @@ void EditBookmarkPrevious(HWND hwnd, DocLn iLine)
iPrevLine = _MarkerPrevious(iLine - 1, bitmask); // find change history marker
}
if (iPrevLine == NOT_FOUND_LN) {
// initial search not started from bottom?
if (iLine != SciCall_GetLineCount()) {
iLine = SciCall_GetLineCount();
bWrapedAround = !bWrapedAround;
}
}
else { // check for consecutive change marker
@ -9526,10 +9538,14 @@ void EditBookmarkPrevious(HWND hwnd, DocLn iLine)
}
}
}
bWrapedAround = !bWrapedAround;
} while ((iPrevLine == NOT_FOUND_LN) && !bWrapedAround);
if (iPrevLine != NOT_FOUND_LN) {
SciCall_GotoLine(iPrevLine);
// find beginning of consecutive change marker
int const bm = _GetAllNP3Markers(iPrevLine);
while ((--iPrevLine >= 0) && (bm & SciCall_MarkerGet(iPrevLine))) {}
SciCall_GotoLine(iPrevLine + 1);
}
}