mirror of
https://github.com/rizonesoft/Notepad3.git
synced 2026-06-11 21:03:05 +08:00
fix mouse cursor flickering in case of "hide mouse while typing"
This commit is contained in:
parent
f2c726d7a6
commit
963c5f2ca7
@ -347,7 +347,9 @@ class ScintillaWin :
|
||||
bool capturedMouse;
|
||||
bool trackedMouseLeave;
|
||||
BOOL typingWithoutCursor;
|
||||
bool cursorIsHidden;
|
||||
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
|
||||
//bool cursorIsHidden;
|
||||
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
|
||||
SetCoalescableTimerSig SetCoalescableTimerFn;
|
||||
|
||||
unsigned int linesPerScroll; ///< Intellimouse support
|
||||
@ -494,6 +496,9 @@ class ScintillaWin :
|
||||
void ClaimSelection() override;
|
||||
|
||||
void GetMouseParameters() noexcept;
|
||||
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
|
||||
bool IsMouseCursorHidden() noexcept;
|
||||
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
|
||||
void CopyToGlobal(GlobalMemory &gmUnicode, const SelectionText &selectedText);
|
||||
void CopyToClipboard(const SelectionText &selectedText) override;
|
||||
void ScrollMessage(WPARAM wParam);
|
||||
@ -579,7 +584,9 @@ ScintillaWin::ScintillaWin(HWND hwnd) {
|
||||
capturedMouse = false;
|
||||
trackedMouseLeave = false;
|
||||
typingWithoutCursor = false;
|
||||
cursorIsHidden = false;
|
||||
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
|
||||
//cursorIsHidden = false;
|
||||
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
|
||||
SetCoalescableTimerFn = nullptr;
|
||||
|
||||
linesPerScroll = 0;
|
||||
@ -1612,19 +1619,27 @@ sptr_t ScintillaWin::MouseMessage(unsigned int iMessage, uptr_t wParam, sptr_t l
|
||||
break;
|
||||
|
||||
case WM_MOUSEMOVE: {
|
||||
cursorIsHidden = false; // to be shown by ButtonMoveWithModifiers
|
||||
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
|
||||
const Point pt = PointFromLParam(lParam);
|
||||
|
||||
// Windows might send WM_MOUSEMOVE even though the mouse has not been moved:
|
||||
// http://blogs.msdn.com/b/oldnewthing/archive/2003/10/01/55108.aspx
|
||||
if (ptMouseLast != pt) {
|
||||
if (IsMouseCursorHidden()) {
|
||||
::ShowCursor(TRUE);
|
||||
//cursorIsHidden = false; // to be shown by ButtonMoveWithModifiers
|
||||
}
|
||||
SetTrackMouseLeaveEvent(true);
|
||||
ButtonMoveWithModifiers(pt, ::GetMessageTime(), MouseModifiers(wParam));
|
||||
}
|
||||
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_MOUSELEAVE:
|
||||
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
|
||||
if (IsMouseCursorHidden()) { ::ShowCursor(TRUE); }
|
||||
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
|
||||
SetTrackMouseLeaveEvent(false);
|
||||
MouseLeave();
|
||||
return ::DefWindowProc(MainHWND(), iMessage, wParam, lParam);
|
||||
@ -2123,7 +2138,10 @@ sptr_t ScintillaWin::WndProc(Message iMessage, uptr_t wParam, sptr_t lParam) {
|
||||
|
||||
case WM_SETCURSOR:
|
||||
if (LOWORD(lParam) == HTCLIENT) {
|
||||
if (!cursorIsHidden) {
|
||||
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
|
||||
//if (!cursorIsHidden) {
|
||||
if (!IsMouseCursorHidden()) {
|
||||
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
|
||||
POINT pt;
|
||||
if (::GetCursorPos(&pt)) {
|
||||
::ScreenToClient(MainHWND(), &pt);
|
||||
@ -2397,10 +2415,13 @@ void ScintillaWin::SetTrackMouseLeaveEvent(bool on) noexcept {
|
||||
|
||||
void ScintillaWin::HideCursorIfPreferred() noexcept {
|
||||
// SPI_GETMOUSEVANISH from OS.
|
||||
if (typingWithoutCursor && !cursorIsHidden) {
|
||||
::SetCursor(NULL);
|
||||
cursorIsHidden = true;
|
||||
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
|
||||
if (typingWithoutCursor && !IsMouseCursorHidden()) {
|
||||
//::SetCursor(NULL);
|
||||
::ShowCursor(FALSE);
|
||||
//cursorIsHidden = true;
|
||||
}
|
||||
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
|
||||
}
|
||||
|
||||
void ScintillaWin::UpdateBaseElements() {
|
||||
@ -3265,6 +3286,13 @@ void ScintillaWin::GetMouseParameters() noexcept {
|
||||
::SystemParametersInfo(SPI_GETMOUSEVANISH, 0, &typingWithoutCursor, 0);
|
||||
}
|
||||
|
||||
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
|
||||
bool ScintillaWin::IsMouseCursorHidden() noexcept {
|
||||
CURSORINFO curInfo = { sizeof(CURSORINFO) };
|
||||
return GetCursorInfo(&curInfo) ? (curInfo.flags == 0UL) : false;
|
||||
}
|
||||
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
|
||||
|
||||
void ScintillaWin::CopyToGlobal(GlobalMemory &gmUnicode, const SelectionText &selectedText) {
|
||||
const std::string_view svSelected(selectedText.Data(), selectedText.LengthWithTerminator());
|
||||
if (IsUnicodeMode()) {
|
||||
|
||||
@ -2904,25 +2904,32 @@ extern "C" bool EditSetDocumentBuffer(const char* lpstrText, DocPosU lenText, bo
|
||||
{
|
||||
bool const bLargerThan2GB = (lenText >= ((DocPosU)INT32_MAX));
|
||||
bool const bLargeFileLoaded = (lenText >= ((DocPosU)Settings2.FileLoadWarningMB << 20));
|
||||
int const docOptions = bLargeFileLoaded ? (bLargerThan2GB ? SC_DOCUMENTOPTION_TEXT_LARGE : SC_DOCUMENTOPTION_STYLES_NONE)
|
||||
: SC_DOCUMENTOPTION_DEFAULT;
|
||||
int const docOptions = bLargeFileLoaded ? (bLargerThan2GB ? SC_DOCUMENTOPTION_TEXT_LARGE : SC_DOCUMENTOPTION_STYLES_NONE)
|
||||
: SC_DOCUMENTOPTION_DEFAULT;
|
||||
bool ok = true;
|
||||
LimitNotifyEvents();
|
||||
if (SciCall_GetDocumentOptions() != docOptions) {
|
||||
// we have to create a new document with changed options
|
||||
return CreateNewDocument(lpstrText, lenText, docOptions, reload);
|
||||
ok = CreateNewDocument(lpstrText, lenText, docOptions, reload);
|
||||
}
|
||||
bool const bReadOnly = SciCall_GetReadOnly();
|
||||
SciCall_SetReadOnly(false);
|
||||
if (!lpstrText || (lenText == 0)) {
|
||||
SciCall_ClearAll();
|
||||
} else {
|
||||
SciCall_TargetWholeDocument();
|
||||
if (reload) {
|
||||
SciCall_ReplaceTargetMinimal(lenText, lpstrText);
|
||||
} else {
|
||||
SciCall_ReplaceTarget(lenText, lpstrText);
|
||||
else {
|
||||
bool const bReadOnly = SciCall_GetReadOnly();
|
||||
SciCall_SetReadOnly(false);
|
||||
if (!lpstrText || (lenText == 0)) {
|
||||
SciCall_ClearAll();
|
||||
}
|
||||
else {
|
||||
SciCall_TargetWholeDocument();
|
||||
if (reload) {
|
||||
SciCall_ReplaceTargetMinimal(lenText, lpstrText);
|
||||
}
|
||||
else {
|
||||
SciCall_ReplaceTarget(lenText, lpstrText);
|
||||
}
|
||||
}
|
||||
SciCall_SetReadOnly(bReadOnly);
|
||||
}
|
||||
SciCall_SetReadOnly(bReadOnly);
|
||||
return true;
|
||||
RestoreNotifyEvents();
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
||||
13
src/Edit.c
13
src/Edit.c
@ -423,6 +423,7 @@ void EditSetNewText(HWND hwnd, const char* lpstrText, DocPosU lenText, bool bCle
|
||||
}
|
||||
s_bFreezeAppTitle = true;
|
||||
|
||||
|
||||
// clear markers, flags and positions
|
||||
if (FocusedView.HideNonMatchedLines) {
|
||||
EditToggleView(hwnd);
|
||||
@ -497,6 +498,8 @@ bool EditConvertText(HWND hwnd, cpi_enc_t encSource, cpi_enc_t encDest)
|
||||
Encoding_Current(encDest);
|
||||
return true;
|
||||
}
|
||||
bool ok = false;
|
||||
LimitNotifyEvents();
|
||||
|
||||
// moves the gap within Scintilla so that the text of the document is stored consecutively and
|
||||
// ensure there is a NUL character after the text
|
||||
@ -532,7 +535,7 @@ bool EditConvertText(HWND hwnd, cpi_enc_t encSource, cpi_enc_t encDest)
|
||||
SciCall_GotoPos(curPos);
|
||||
SciCall_SetFirstVisibleLine(vis1stLine);
|
||||
FreeMem(pchText);
|
||||
return true;
|
||||
ok = true;
|
||||
}
|
||||
else {
|
||||
FreeMem(pwchText);
|
||||
@ -546,7 +549,8 @@ bool EditConvertText(HWND hwnd, cpi_enc_t encSource, cpi_enc_t encDest)
|
||||
FreeMem(pwchText);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
RestoreNotifyEvents();
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
||||
@ -7545,7 +7549,6 @@ bool EditReplace(HWND hwnd, LPEDITFINDREPLACE lpefr)
|
||||
// EditReplaceAllInRange()
|
||||
//
|
||||
//
|
||||
|
||||
DocPosU EditReplaceAllInRange(HWND hwnd, LPEDITFINDREPLACE lpefr, DocPos iStartPos, DocPos iEndPos, DocPos *enlargement)
|
||||
{
|
||||
if (iStartPos > iEndPos) {
|
||||
@ -7583,7 +7586,7 @@ DocPosU EditReplaceAllInRange(HWND hwnd, LPEDITFINDREPLACE lpefr, DocPos iStartP
|
||||
}
|
||||
|
||||
DocPosU iCount = 0;
|
||||
|
||||
LimitNotifyEvents();
|
||||
UndoTransActionBegin();
|
||||
|
||||
while ((iPos >= 0LL) && (start <= iEndPos)) {
|
||||
@ -7616,6 +7619,8 @@ DocPosU EditReplaceAllInRange(HWND hwnd, LPEDITFINDREPLACE lpefr, DocPos iStartP
|
||||
*enlargement = (iEndPos - iOrigEndPos);
|
||||
SciCall_SetTargetRange(_saveTargetBeg_, _saveTargetEnd_ + *enlargement); //restore
|
||||
|
||||
RestoreNotifyEvents();
|
||||
|
||||
return iCount;
|
||||
}
|
||||
|
||||
|
||||
@ -876,6 +876,31 @@ static inline LONG64 GetTicks_ms() {
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
__forceinline POINT POINTFromLParam(LPARAM lParam)
|
||||
{
|
||||
POINT const pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
|
||||
return pt;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#if 0
|
||||
__forceinline bool IsCursorVisible()
|
||||
{
|
||||
CURSORINFO ci = { sizeof(CURSORINFO) };
|
||||
return GetCursorInfo(&ci) ? (ci.flags != 0UL) : true;
|
||||
}
|
||||
|
||||
__forceinline bool IsMouseVanish()
|
||||
{
|
||||
BOOL bMouseVanish = FALSE;
|
||||
return SystemParametersInfoW(SPI_GETMOUSEVANISH, 0, &bMouseVanish, 0) ? bMouseVanish : false;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
#endif
|
||||
|
||||
|
||||
#endif //_NP3_HELPERS_H_
|
||||
|
||||
/// End of Helpers.h ///
|
||||
|
||||
224
src/Notepad3.c
224
src/Notepad3.c
@ -2231,7 +2231,6 @@ LRESULT CALLBACK MainWndProc(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
|
||||
case WM_SIZE:
|
||||
return MsgSize(hwnd, wParam, lParam);
|
||||
|
||||
|
||||
#ifdef D_NP3_WIN10_DARK_MODE
|
||||
case WM_SETTINGCHANGE: {
|
||||
if (IsColorSchemeChangeMessage(lParam)) {
|
||||
@ -2323,7 +2322,8 @@ LRESULT CALLBACK MainWndProc(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
|
||||
return MsgSysCommand(hwnd, umsg, wParam, lParam);
|
||||
|
||||
case WM_MBUTTONDOWN: {
|
||||
DocPos const pos = SciCall_CharPositionFromPointClose(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
|
||||
POINT const cpt = POINTFromLParam(lParam);
|
||||
DocPos const pos = SciCall_CharPositionFromPointClose(cpt.x, cpt.y);
|
||||
if (pos >= 0) {
|
||||
HandleHotSpotURLClicked(pos, OPEN_WITH_BROWSER);
|
||||
}
|
||||
@ -3967,7 +3967,7 @@ LRESULT MsgContextMenu(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
POINT pt = { 0, 0 };
|
||||
POINT pt = { -1, -1 };
|
||||
pt.x = (int)((short)LOWORD(bMargin ? wParam : lParam));
|
||||
pt.y = (int)((short)HIWORD(bMargin ? wParam : lParam));
|
||||
#define IS_CTX_PT_VALID(P) (((P).x != -1 || (P).y != -1))
|
||||
@ -4080,14 +4080,12 @@ LRESULT MsgTrayMessage(HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||
HMENU hTrayMenu = LoadMenu(Globals.hLngResContainer, MAKEINTRESOURCE(IDR_MUI_POPUPMENU));
|
||||
HMENU hMenuPopup = GetSubMenu(hTrayMenu, 3);
|
||||
|
||||
POINT pt;
|
||||
int iCmd;
|
||||
|
||||
SetForegroundWindow(hwnd);
|
||||
|
||||
POINT pt = { -1, -1 };
|
||||
GetCursorPos(&pt);
|
||||
SetMenuDefaultItem(hMenuPopup, IDM_TRAY_RESTORE, false);
|
||||
iCmd = TrackPopupMenu(hMenuPopup,
|
||||
int iCmd = TrackPopupMenu(hMenuPopup,
|
||||
TPM_NONOTIFY | TPM_RETURNCMD | TPM_LEFTBUTTON | TPM_RIGHTBUTTON,
|
||||
pt.x, pt.y, 0, hwnd, NULL);
|
||||
|
||||
@ -7844,7 +7842,7 @@ LRESULT MsgUahMenuBar(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
|
||||
//
|
||||
// HandleDWellStartEnd()
|
||||
//
|
||||
static DocPos prevCursorPosition = -1;
|
||||
static DocPos prevCaretPosition = -1;
|
||||
|
||||
void HandleDWellStartEnd(const DocPos position, const UINT uid)
|
||||
{
|
||||
@ -7852,8 +7850,8 @@ void HandleDWellStartEnd(const DocPos position, const UINT uid)
|
||||
static DocPos prevEndPosition = -1;
|
||||
|
||||
if (position >= 0) {
|
||||
if (prevCursorPosition < 0) {
|
||||
prevCursorPosition = position;
|
||||
if (prevCaretPosition < 0) {
|
||||
prevCaretPosition = position;
|
||||
}
|
||||
if (prevStartPosition < 0) {
|
||||
prevStartPosition = position;
|
||||
@ -7870,14 +7868,14 @@ void HandleDWellStartEnd(const DocPos position, const UINT uid)
|
||||
|
||||
if (position < 0) {
|
||||
Sci_CallTipCancelEx();
|
||||
prevCursorPosition = -1;
|
||||
prevCaretPosition = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
if (Settings.HyperlinkHotspot) {
|
||||
if (SciCall_IndicatorValueAt(INDIC_NP3_HYPERLINK, position) > 0) {
|
||||
indicator_id = INDIC_NP3_HYPERLINK;
|
||||
if (position != prevCursorPosition) {
|
||||
if (position != prevCaretPosition) {
|
||||
Sci_CallTipCancelEx();
|
||||
}
|
||||
}
|
||||
@ -8064,13 +8062,14 @@ void HandleDWellStartEnd(const DocPos position, const UINT uid)
|
||||
}
|
||||
}
|
||||
|
||||
prevCursorPosition = position;
|
||||
prevCaretPosition = position;
|
||||
prevStartPosition = firstPos;
|
||||
prevEndPosition = lastPos;
|
||||
}
|
||||
break;
|
||||
|
||||
case SCN_DWELLEND: {
|
||||
|
||||
if ((position >= prevStartPosition) && ((position <= prevEndPosition))) {
|
||||
return; // avoid flickering
|
||||
}
|
||||
@ -8082,7 +8081,7 @@ void HandleDWellStartEnd(const DocPos position, const UINT uid)
|
||||
return; // no change for if caret in range
|
||||
}
|
||||
s_bCallTipEscDisabled = false;
|
||||
prevCursorPosition = -1;
|
||||
prevCaretPosition = -1;
|
||||
|
||||
// clear SCN_DWELLSTART visual styles
|
||||
SciCall_SetIndicatorCurrent(INDIC_NP3_COLOR_DEF_T);
|
||||
@ -8708,111 +8707,112 @@ static bool _IsIMEOpenInNoNativeMode()
|
||||
// !!! Set correct SCI_SETMODEVENTMASK in _InitializeSciEditCtrl()
|
||||
//
|
||||
|
||||
inline static LRESULT _MsgNotifyLean(const SCNotification *const scn, bool* bModified) {
|
||||
inline static LRESULT _MsgNotifyLean(const SCNotification* const scn, bool* bModified)
|
||||
{
|
||||
|
||||
const LPNMHDR pnmh = (LPNMHDR)scn;
|
||||
|
||||
static LONG _urtoken = URTok_NoTransaction;
|
||||
|
||||
// --- check only mandatory events (must be fast !!!) ---
|
||||
if (pnmh->idFrom == IDC_EDIT) {
|
||||
if (pnmh->idFrom != IDC_EDIT) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
switch (pnmh->code) {
|
||||
switch (pnmh->code) {
|
||||
|
||||
case SCN_MODIFIED: {
|
||||
*bModified = false; // init
|
||||
int const iModType = scn->modificationType;
|
||||
if ((iModType & SC_MULTISTEPUNDOREDO) && !(iModType & SC_LASTSTEPINUNDOREDO)) {
|
||||
return TRUE; // wait for last step in multi-step-undo/redo
|
||||
case SCN_MODIFIED: {
|
||||
*bModified = false; // init
|
||||
int const iModType = scn->modificationType;
|
||||
if ((iModType & SC_MULTISTEPUNDOREDO) && !(iModType & SC_LASTSTEPINUNDOREDO)) {
|
||||
return TRUE; // wait for last step in multi-step-undo/redo
|
||||
}
|
||||
bool const bInUndoRedoStep = (iModType & (SC_PERFORMED_UNDO | SC_PERFORMED_REDO));
|
||||
if (iModType & SC_MOD_INSERTCHECK) {
|
||||
if (!bInUndoRedoStep) {
|
||||
_HandleInsertCheck(scn);
|
||||
}
|
||||
bool const bInUndoRedoStep = (iModType & (SC_PERFORMED_UNDO | SC_PERFORMED_REDO));
|
||||
if (iModType & SC_MOD_INSERTCHECK) {
|
||||
}
|
||||
if (iModType & (SC_MOD_BEFOREINSERT | SC_MOD_BEFOREDELETE)) {
|
||||
*bModified = false; // not yet
|
||||
if (!bInUndoRedoStep) {
|
||||
if (!_InUndoRedoTransaction() && (_urtoken < URTok_TokenStart)) {
|
||||
_SaveSelectionToBuffer();
|
||||
bool const bSelEmpty = SciCall_IsSelectionEmpty();
|
||||
bool const bIsMultiRectSel = Sci_IsMultiOrRectangleSelection();
|
||||
if (!bSelEmpty || bIsMultiRectSel) {
|
||||
LONG const tok = _SaveUndoSelection();
|
||||
_urtoken = (tok >= URTok_TokenStart ? tok : _urtoken);
|
||||
}
|
||||
// TODO: @@@ Find reason for why this NOP workaround is needed:
|
||||
if (!bSelEmpty && bIsMultiRectSel) {
|
||||
// need to trigger SCI:InvalidateCaret()
|
||||
bool const bAddSelTyping = SciCall_GetAdditionalSelectionTyping();
|
||||
//~SciCall_SetAdditionalSelectionTyping(!bAddSelTyping); // v5.1.1: no check for change, so:
|
||||
SciCall_SetAdditionalSelectionTyping(bAddSelTyping);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (iModType & (SC_MOD_INSERTTEXT | SC_MOD_DELETETEXT)) {
|
||||
if (!bInUndoRedoStep) {
|
||||
if (!_InUndoRedoTransaction() && (_urtoken >= URTok_TokenStart)) {
|
||||
_SaveRedoSelection(_urtoken, SciCall_GetModify());
|
||||
_urtoken = URTok_NoTransaction;
|
||||
}
|
||||
if (iModType & SC_MOD_DELETETEXT) {
|
||||
_HandleDeleteCheck(scn);
|
||||
}
|
||||
}
|
||||
*bModified = true;
|
||||
}
|
||||
// check for ADDUNDOACTION step
|
||||
if (iModType & SC_MOD_CONTAINER) {
|
||||
// we are inside undo/redo transaction, so do delayed PostMessage() instead of SendMessage()
|
||||
if (iModType & SC_PERFORMED_UNDO) {
|
||||
PostMessage(Globals.hwndMain, WM_RESTORE_UNDOREDOACTION, (WPARAM)UNDO, (LPARAM)scn->token);
|
||||
}
|
||||
else if (iModType & SC_PERFORMED_REDO) {
|
||||
PostMessage(Globals.hwndMain, WM_RESTORE_UNDOREDOACTION, (WPARAM)REDO, (LPARAM)scn->token);
|
||||
}
|
||||
}
|
||||
if (*bModified) {
|
||||
LONG64 const timeout = Settings2.UndoTransactionTimeout;
|
||||
if (timeout != 0LL) {
|
||||
if (!bInUndoRedoStep) {
|
||||
_HandleInsertCheck(scn);
|
||||
_DelaySplitUndoTransaction(max_ll(_MQ_IMMEDIATE, timeout));
|
||||
}
|
||||
}
|
||||
if (iModType & (SC_MOD_BEFOREINSERT | SC_MOD_BEFOREDELETE)) {
|
||||
*bModified = false; // not yet
|
||||
if (!bInUndoRedoStep) {
|
||||
if (!_InUndoRedoTransaction() && (_urtoken < URTok_TokenStart)) {
|
||||
_SaveSelectionToBuffer();
|
||||
bool const bSelEmpty = SciCall_IsSelectionEmpty();
|
||||
bool const bIsMultiRectSel = Sci_IsMultiOrRectangleSelection();
|
||||
if (!bSelEmpty || bIsMultiRectSel) {
|
||||
LONG const tok = _SaveUndoSelection();
|
||||
_urtoken = (tok >= URTok_TokenStart ? tok : _urtoken);
|
||||
}
|
||||
// TODO: @@@ Find reason for why this NOP workaround is needed:
|
||||
if (!bSelEmpty && bIsMultiRectSel) {
|
||||
// need to trigger SCI:InvalidateCaret()
|
||||
bool const bAddSelTyping = SciCall_GetAdditionalSelectionTyping();
|
||||
//~SciCall_SetAdditionalSelectionTyping(!bAddSelTyping); // v5.1.1: no check for change, so:
|
||||
SciCall_SetAdditionalSelectionTyping(bAddSelTyping);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (iModType & (SC_MOD_INSERTTEXT | SC_MOD_DELETETEXT)) {
|
||||
if (!bInUndoRedoStep) {
|
||||
if (!_InUndoRedoTransaction() && (_urtoken >= URTok_TokenStart)) {
|
||||
_SaveRedoSelection(_urtoken, SciCall_GetModify());
|
||||
_urtoken = URTok_NoTransaction;
|
||||
}
|
||||
if (iModType & SC_MOD_DELETETEXT) {
|
||||
_HandleDeleteCheck(scn);
|
||||
}
|
||||
}
|
||||
*bModified = true;
|
||||
}
|
||||
// check for ADDUNDOACTION step
|
||||
if (iModType & SC_MOD_CONTAINER) {
|
||||
// we are inside undo/redo transaction, so do delayed PostMessage() instead of SendMessage()
|
||||
if (iModType & SC_PERFORMED_UNDO) {
|
||||
PostMessage(Globals.hwndMain, WM_RESTORE_UNDOREDOACTION, (WPARAM)UNDO, (LPARAM)scn->token);
|
||||
} else if (iModType & SC_PERFORMED_REDO) {
|
||||
PostMessage(Globals.hwndMain, WM_RESTORE_UNDOREDOACTION, (WPARAM)REDO, (LPARAM)scn->token);
|
||||
}
|
||||
}
|
||||
if (*bModified) {
|
||||
LONG64 const timeout = Settings2.UndoTransactionTimeout;
|
||||
if (timeout != 0LL) {
|
||||
if (!bInUndoRedoStep) {
|
||||
_DelaySplitUndoTransaction(max_ll(_MQ_IMMEDIATE, timeout));
|
||||
}
|
||||
}
|
||||
}
|
||||
} break;
|
||||
}
|
||||
} break;
|
||||
|
||||
case SCN_SAVEPOINTREACHED: {
|
||||
SetSaveDone();
|
||||
} break;
|
||||
case SCN_SAVEPOINTREACHED: {
|
||||
SetSaveDone();
|
||||
} break;
|
||||
|
||||
case SCN_SAVEPOINTLEFT: {
|
||||
SetSaveNeeded(false);
|
||||
} break;
|
||||
case SCN_SAVEPOINTLEFT: {
|
||||
SetSaveNeeded(false);
|
||||
} break;
|
||||
|
||||
case SCN_MODIFYATTEMPTRO: {
|
||||
if (FocusedView.HideNonMatchedLines) {
|
||||
EditToggleView(Globals.hwndEdit);
|
||||
case SCN_MODIFYATTEMPTRO: {
|
||||
if (FocusedView.HideNonMatchedLines) {
|
||||
EditToggleView(Globals.hwndEdit);
|
||||
}
|
||||
else {
|
||||
if (!FileWatching.MonitoringLog && !IsYesOkay(InfoBoxLng(MB_YESNO | MB_ICONINFORMATION, L"QuietKeepReadonlyLock", IDS_MUI_DOCUMENT_READONLY))) {
|
||||
SendWMCommand(Globals.hwndMain, IDM_VIEW_READONLY);
|
||||
}
|
||||
else {
|
||||
if (!FileWatching.MonitoringLog
|
||||
&& !IsYesOkay(InfoBoxLng(MB_YESNO | MB_ICONINFORMATION, L"QuietKeepReadonlyLock", IDS_MUI_DOCUMENT_READONLY)))
|
||||
{
|
||||
SendWMCommand(Globals.hwndMain, IDM_VIEW_READONLY);
|
||||
}
|
||||
else {
|
||||
AttentionBeep(MB_YESNO | MB_ICONINFORMATION);
|
||||
}
|
||||
AttentionBeep(MB_YESNO | MB_ICONINFORMATION);
|
||||
}
|
||||
} break;
|
||||
}
|
||||
} break;
|
||||
|
||||
default:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
} // switch
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
} // switch
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
@ -8899,7 +8899,7 @@ static LRESULT _MsgNotifyFromEdit(HWND hwnd, const SCNotification* const scn)
|
||||
|
||||
case SCN_STYLENEEDED: {
|
||||
// this event needs SCI_SETLEXER(SCLEX_CONTAINER)
|
||||
//EditUpdateIndicators(SciCall_GetEndStyled(), scn->position, false);
|
||||
//~EditUpdateIndicators(SciCall_GetEndStyled(), scn->position, false);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -8966,9 +8966,9 @@ static LRESULT _MsgNotifyFromEdit(HWND hwnd, const SCNotification* const scn)
|
||||
|
||||
|
||||
case SCN_CALLTIPCLICK: {
|
||||
if (prevCursorPosition >= 0) {
|
||||
if (prevCaretPosition >= 0) {
|
||||
//~HandleHotSpotURLClicked(SciCall_CallTipPosStart(), OPEN_WITH_BROWSER);
|
||||
HandleHotSpotURLClicked(prevCursorPosition, OPEN_WITH_BROWSER);
|
||||
HandleHotSpotURLClicked(prevCaretPosition, OPEN_WITH_BROWSER);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -9007,6 +9007,10 @@ static LRESULT _MsgNotifyFromEdit(HWND hwnd, const SCNotification* const scn)
|
||||
int const ich = scn->ch;
|
||||
Sci_CallTipCancelEx();
|
||||
|
||||
//if (IsMouseVanish()) {
|
||||
// showMouseCursor(false);
|
||||
//}
|
||||
|
||||
if (Sci_IsMultiSelection()) {
|
||||
SciCall_SetIndicatorCurrent(INDIC_NP3_MULTI_EDIT);
|
||||
DocPosU const selCount = SciCall_GetSelections();
|
||||
@ -9044,7 +9048,6 @@ static LRESULT _MsgNotifyFromEdit(HWND hwnd, const SCNotification* const scn)
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case SCN_AUTOCCHARDELETED:
|
||||
if ((Settings.AutoCompleteWords || Settings.AutoCLexerKeyWords)) {
|
||||
if (!EditAutoCompleteWord(Globals.hwndEdit, false)) {
|
||||
@ -9323,7 +9326,7 @@ LRESULT MsgNotify(HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||
break;
|
||||
|
||||
case NM_RCLICK: {
|
||||
POINT pt = { 0, 0 };
|
||||
POINT pt = { -1, -1 };
|
||||
GetCursorPos(&pt);
|
||||
MsgContextMenu(hwnd, 0, (WPARAM)Globals.hwndStatus, MAKELPARAM(pt.x, pt.y));
|
||||
} break;
|
||||
@ -10725,7 +10728,6 @@ static void _UpdateStatusbarDelayed(bool bForceRedraw)
|
||||
SendMessage(Globals.hwndStatus, WM_SETREDRAW, TRUE, 0);
|
||||
InvalidateRect(Globals.hwndStatus, NULL, TRUE);
|
||||
|
||||
//PostMessage(Globals.hwndStatus, WM_SIZE, 0, 0);
|
||||
}
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
@ -12633,14 +12635,14 @@ void SetNotifyIconTitle(HWND hwnd)
|
||||
//
|
||||
void ResetMouseDWellTime()
|
||||
{
|
||||
if (Settings.ShowHypLnkToolTip || IsColorDefHotspotEnabled() || Settings.HighlightUnicodePoints) {
|
||||
SciCall_SetMouseDWellTime(USER_TIMER_MINIMUM << 4);
|
||||
} else {
|
||||
Sci_DisableMouseDWellNotification();
|
||||
}
|
||||
//~if (Settings.ShowHypLnkToolTip || IsColorDefHotspotEnabled() || Settings.HighlightUnicodePoints) {
|
||||
//~ SciCall_SetMouseDWellTime(USER_TIMER_MINIMUM << 4);
|
||||
//~} else {
|
||||
//~ Sci_DisableMouseDWellNotification();
|
||||
//~}
|
||||
SciCall_SetMouseDWellTime(500); // needed for "Mouse cursor vanish handling (hide while typing)"
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// ShowZoomCallTip()
|
||||
|
||||
@ -86,7 +86,7 @@ inline LPCWSTR _Win10BuildToReleaseId(const DWORD build)
|
||||
|
||||
if (build >= 22000) { // Win11
|
||||
|
||||
if (build >= 22631)
|
||||
if (build >= 22631)
|
||||
{
|
||||
lpcReleaseID = L"23H2";
|
||||
}
|
||||
@ -245,7 +245,7 @@ inline LPCWSTR _Win10BuildToReleaseId(const DWORD build)
|
||||
#endif
|
||||
#elif (_MSC_VER == 1929)
|
||||
#if (_MSC_FULL_VER >= 192930154)
|
||||
#define VER_CPL MS Visual C++ 2019 v16.11.34
|
||||
#define VER_CPL MS Visual C++ 2019 v16.11.(34-36)
|
||||
#elif (_MSC_FULL_VER >= 192930153)
|
||||
#define VER_CPL MS Visual C++ 2019 v16.11.33
|
||||
#elif (_MSC_FULL_VER >= 192930152)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user