Restore edit zone border in dark mode

Restore functionality for option No edge in preference when using dark mode.

Fix #10205, close #10211
This commit is contained in:
ozone10 2021-07-21 22:00:08 +02:00 committed by Don Ho
parent 1182976cc3
commit 8bf11be0b5
3 changed files with 23 additions and 24 deletions

View File

@ -284,16 +284,8 @@ LRESULT Notepad_plus::init(HWND hwnd)
_subEditView.execute(SCI_SETFONTQUALITY, SC_EFF_QUALITY_LCD_OPTIMIZED);
}
if (NppDarkMode::isEnabled())
{
_mainEditView.setBorderEdge(false);
_subEditView.setBorderEdge(false);
}
else
{
_mainEditView.setBorderEdge(svp._showBorderEdge);
_subEditView.setBorderEdge(svp._showBorderEdge);
}
_mainEditView.setBorderEdge(svp._showBorderEdge);
_subEditView.setBorderEdge(svp._showBorderEdge);
_mainEditView.execute(SCI_SETCARETLINEVISIBLEALWAYS, true);
_subEditView.execute(SCI_SETCARETLINEVISIBLEALWAYS, true);

View File

@ -1511,16 +1511,8 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
case NPPM_SETEDITORBORDEREDGE:
{
bool withBorderEdge = (lParam == 1);
if (NppDarkMode::isEnabled())
{
_mainEditView.setBorderEdge(false);
_subEditView.setBorderEdge(false);
}
else
{
_mainEditView.setBorderEdge(withBorderEdge);
_subEditView.setBorderEdge(withBorderEdge);
}
_mainEditView.setBorderEdge(withBorderEdge);
_subEditView.setBorderEdge(withBorderEdge);
return TRUE;
}
@ -2746,4 +2738,3 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
_pluginsManager.relayNppMessages(message, wParam, lParam);
return result;
}

View File

@ -3705,13 +3705,29 @@ generic_string ScintillaEditView::getEOLString()
void ScintillaEditView::setBorderEdge(bool doWithBorderEdge)
{
long style = static_cast<long>(::GetWindowLongPtr(_hSelf, GWL_STYLE));
long exStyle = static_cast<long>(::GetWindowLongPtr(_hSelf, GWL_EXSTYLE));
if (doWithBorderEdge)
exStyle |= WS_EX_CLIENTEDGE;
else
if (NppDarkMode::isEnabled())
{
exStyle &= ~WS_EX_CLIENTEDGE;
if (doWithBorderEdge)
style |= WS_BORDER;
else
style &= ~WS_BORDER;
}
else
{
style &= ~WS_BORDER;
if (doWithBorderEdge)
exStyle |= WS_EX_CLIENTEDGE;
else
exStyle &= ~WS_EX_CLIENTEDGE;
}
::SetWindowLongPtr(_hSelf, GWL_STYLE, style);
::SetWindowLongPtr(_hSelf, GWL_EXSTYLE, exStyle);
::SetWindowPos(_hSelf, NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED);
}