Merge pull request #2223 from RaiKoHoff/Hotfix_REL_5204112

Hotfix: view selection on wrapped long-lines
This commit is contained in:
Rainer Kottenhoff 2020-04-14 11:36:56 +02:00 committed by GitHub
commit 10c9448ff1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 13 deletions

View File

@ -4959,11 +4959,12 @@ void EditSetSelectionEx(DocPos iAnchorPos, DocPos iCurrentPos, DocPos vSpcAnchor
if (vSpcCurrent > 0) {
SciCall_SetRectangularSelectionCaretVirtualSpace(vSpcCurrent);
}
EditEnsureSelectionVisible();
}
else {
SciCall_SetSel(iAnchorPos, iCurrentPos); // scrolls into view
SciCall_ChooseCaretX();
}
EditNormalizeView(Sci_GetCurrentLineNumber()); // normalize view
}
UpdateToolbar();
UpdateStatusbar(false);
@ -5006,15 +5007,12 @@ void EditNormalizeView(const DocLn iDocLine)
//
void EditEnsureSelectionVisible()
{
// Ensure that the first and last lines of a selection are always unfolded
DocLn const iCurrentLine = SciCall_LineFromPosition(SciCall_GetCurrentPos());
DocLn const iAnchorLine = SciCall_LineFromPosition(SciCall_GetAnchor());
// Ensure that the first and last lines of a selection are always unfolded
// This needs to be done *before* the SCI_SETSEL message
SciCall_EnsureVisible(iAnchorLine);
if (iAnchorLine != iCurrentLine) { SciCall_EnsureVisible(iCurrentLine); }
Sci_ScrollToCurrentLine(); // normalize view
Sci_ScrollToLine(iCurrentLine);
Sci_ScrollChooseCaret();
}
@ -6810,7 +6808,8 @@ void EditSelectionMultiSelectAll()
if (iMainAnchor > iMainCaret) {
SciCall_SwapMainAnchorCaret();
}
EditNormalizeView(Sci_GetCurrentLineNumber()); // normalize view
//~EditNormalizeView(Sci_GetCurrentLineNumber());
EditEnsureSelectionVisible();
SciCall_SetTargetRange(saveTargetBeg, saveTargetEnd); //restore

View File

@ -4817,7 +4817,8 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
case IDM_EDIT_SELTONEXT:
{
SciCall_RotateSelection();
EditNormalizeView(Sci_GetCurrentLineNumber());
//~EditNormalizeView(Sci_GetCurrentLineNumber());
EditEnsureSelectionVisible();
}
break;
@ -4830,7 +4831,8 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
DocPosU const iNewMain = SciCall_GetSelections() - 1;
SciCall_SetMainSelection(iNewMain);
}
EditNormalizeView(Sci_GetCurrentLineNumber()); // normalize view
//~EditNormalizeView(Sci_GetCurrentLineNumber());
EditEnsureSelectionVisible();
}
break;
@ -5264,7 +5266,7 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
FileWatching.AutoReloadTimeout = Settings2.AutoReloadTimeout;
UndoRedoRecordingStart();
SciCall_SetEndAtLastLine(!Settings.ScrollPastEOF);
EditNormalizeView(Sci_GetCurrentLineNumber()); // normalize view
EditNormalizeView(Sci_GetCurrentLineNumber());
}
InstallFileWatching(Globals.CurrentFile); // force
@ -9527,8 +9529,7 @@ bool FileLoad(bool bDontSave, bool bNew, bool bReload,
// set historic caret/selection pos
else if ((iCaretPos >= 0) && (iAnchorPos >= 0))
{
SciCall_SetSel(iAnchorPos, iCaretPos); // scroll into view
EditNormalizeView(Sci_GetCurrentLineNumber());
EditSetSelectionEx(iAnchorPos, iCaretPos, 0, 0);
}
}