Skip to content

Commit

Permalink
Fix regression of multi-edit cursors placed wrongly issue
Browse files Browse the repository at this point in the history
Fix #15126, close #15129
  • Loading branch information
donho committed May 12, 2024
1 parent 78c7c3e commit 1e19719
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 caret = static_cast<int>(execute(SCI_GETSELECTIONNCARET, selection, 0));
execute(SCI_SETSELECTION, caret, caret);
execute(SCI_SETSELECTIONMODE, SC_SEL_STREAM);
break;
}

Expand Down
12 changes: 6 additions & 6 deletions PowerEditor/src/WinControls/TabBar/TabBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1360,7 +1360,7 @@ void TabBarPlus::drawItem(DRAWITEMSTRUCT *pDrawItemStruct, bool isDarkMode)
int textHeight = textMetrics.tmHeight;
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 (&).
// ex. If input "test && test &&& test &&&&" then output will be "test & test && test &&&".
Expand All @@ -1379,8 +1379,8 @@ void TabBarPlus::drawItem(DRAWITEMSTRUCT *pDrawItemStruct, bool isDarkMode)
if (_isVertical)
{
// center text horizontally (rotated text is positioned as if it were unrotated, therefore manual positioning is necessary)
Flags |= DT_LEFT;
Flags |= DT_BOTTOM;
flags |= DT_LEFT;
flags |= DT_BOTTOM;
rect.left += (rect.right - rect.left - textHeight) / 2;
rect.bottom += textHeight;

Expand All @@ -1394,8 +1394,8 @@ void TabBarPlus::drawItem(DRAWITEMSTRUCT *pDrawItemStruct, bool isDarkMode)
else
{
// center text vertically
Flags |= DT_LEFT;
Flags |= DT_TOP;
flags |= DT_LEFT;
flags |= DT_TOP;

const int paddingText = ((pDrawItemStruct->rcItem.bottom - pDrawItemStruct->rcItem.top) - (textHeight + textDescent)) / 2;
const int paddingDescent = !hasMultipleLines ? ((textDescent + ((isDarkMode || !isSelected) ? 1 : 0)) / 2) : 0;
Expand All @@ -1415,7 +1415,7 @@ void TabBarPlus::drawItem(DRAWITEMSTRUCT *pDrawItemStruct, bool isDarkMode)

::SetTextColor(hDC, textColor);

::DrawText(hDC, decodedLabel, lstrlen(decodedLabel), &rect, Flags);
::DrawText(hDC, decodedLabel, lstrlen(decodedLabel), &rect, flags);
::RestoreDC(hDC, nSavedDC);
}

Expand Down

0 comments on commit 1e19719

Please sign in to comment.