Fix regression of multi-edit cursors placed wrongly issue

Fix #15126, close #15129
This commit is contained in:
Don Ho 2024-05-12 00:46:20 +02:00
parent 78c7c3e645
commit 1e19719f8f
2 changed files with 7 additions and 6 deletions

View File

@ -650,6 +650,7 @@ LRESULT ScintillaEditView::scintillaNew_Proc(HWND hwnd, UINT Message, WPARAM wPa
int selection = static_cast<int>(execute(SCI_GETMAINSELECTION, 0, 0)); int selection = static_cast<int>(execute(SCI_GETMAINSELECTION, 0, 0));
int caret = static_cast<int>(execute(SCI_GETSELECTIONNCARET, selection, 0)); int caret = static_cast<int>(execute(SCI_GETSELECTIONNCARET, selection, 0));
execute(SCI_SETSELECTION, caret, caret); execute(SCI_SETSELECTION, caret, caret);
execute(SCI_SETSELECTIONMODE, SC_SEL_STREAM);
break; break;
} }

View File

@ -1360,7 +1360,7 @@ void TabBarPlus::drawItem(DRAWITEMSTRUCT *pDrawItemStruct, bool isDarkMode)
int textHeight = textMetrics.tmHeight; int textHeight = textMetrics.tmHeight;
int textDescent = textMetrics.tmDescent; int textDescent = textMetrics.tmDescent;
int Flags = DT_SINGLELINE | DT_NOPREFIX; int flags = DT_SINGLELINE | DT_NOPREFIX;
// This code will read in one character at a time and remove every first ampersand (&). // This code will read in one character at a time and remove every first ampersand (&).
// ex. If input "test && test &&& test &&&&" then output will be "test & test && test &&&". // ex. If input "test && test &&& test &&&&" then output will be "test & test && test &&&".
@ -1379,8 +1379,8 @@ void TabBarPlus::drawItem(DRAWITEMSTRUCT *pDrawItemStruct, bool isDarkMode)
if (_isVertical) if (_isVertical)
{ {
// center text horizontally (rotated text is positioned as if it were unrotated, therefore manual positioning is necessary) // center text horizontally (rotated text is positioned as if it were unrotated, therefore manual positioning is necessary)
Flags |= DT_LEFT; flags |= DT_LEFT;
Flags |= DT_BOTTOM; flags |= DT_BOTTOM;
rect.left += (rect.right - rect.left - textHeight) / 2; rect.left += (rect.right - rect.left - textHeight) / 2;
rect.bottom += textHeight; rect.bottom += textHeight;
@ -1394,8 +1394,8 @@ void TabBarPlus::drawItem(DRAWITEMSTRUCT *pDrawItemStruct, bool isDarkMode)
else else
{ {
// center text vertically // center text vertically
Flags |= DT_LEFT; flags |= DT_LEFT;
Flags |= DT_TOP; flags |= DT_TOP;
const int paddingText = ((pDrawItemStruct->rcItem.bottom - pDrawItemStruct->rcItem.top) - (textHeight + textDescent)) / 2; const int paddingText = ((pDrawItemStruct->rcItem.bottom - pDrawItemStruct->rcItem.top) - (textHeight + textDescent)) / 2;
const int paddingDescent = !hasMultipleLines ? ((textDescent + ((isDarkMode || !isSelected) ? 1 : 0)) / 2) : 0; const int paddingDescent = !hasMultipleLines ? ((textDescent + ((isDarkMode || !isSelected) ? 1 : 0)) / 2) : 0;
@ -1415,7 +1415,7 @@ void TabBarPlus::drawItem(DRAWITEMSTRUCT *pDrawItemStruct, bool isDarkMode)
::SetTextColor(hDC, textColor); ::SetTextColor(hDC, textColor);
::DrawText(hDC, decodedLabel, lstrlen(decodedLabel), &rect, Flags); ::DrawText(hDC, decodedLabel, lstrlen(decodedLabel), &rect, flags);
::RestoreDC(hDC, nSavedDC); ::RestoreDC(hDC, nSavedDC);
} }