From 595074152d3155013ddd95839bff40e3c1c6a473 Mon Sep 17 00:00:00 2001 From: Don Ho Date: Thu, 19 Sep 2024 18:38:07 +0200 Subject: [PATCH] Small refactoring --- PowerEditor/src/NppNotification.cpp | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/PowerEditor/src/NppNotification.cpp b/PowerEditor/src/NppNotification.cpp index be4b697a8699..af855b978493 100644 --- a/PowerEditor/src/NppNotification.cpp +++ b/PowerEditor/src/NppNotification.cpp @@ -985,24 +985,16 @@ BOOL Notepad_plus::notify(SCNotification *notification) wcscpy_s(lpttt->szText, tipTmp.c_str()); return TRUE; } - else if (hWin == _mainDocTab.getHSelf()) + else { - BufferID idd = _mainDocTab.getBufferByIndex(id); - Buffer * buf = MainFileManager.getBufferByID(idd); - if (buf == nullptr) + BufferID idd = BUFFER_INVALID; + if (hWin == _mainDocTab.getHSelf()) + idd = _mainDocTab.getBufferByIndex(id); + else if (hWin == _subDocTab.getHSelf()) + idd = _subDocTab.getBufferByIndex(id); + else return FALSE; - tipTmp = buf->getFullPathName(); - - if (tipTmp.length() >= tipMaxLen) - return FALSE; - wcscpy_s(docTip, tipTmp.c_str()); - lpttt->lpszText = docTip; - return TRUE; - } - else if (hWin == _subDocTab.getHSelf()) - { - BufferID idd = _subDocTab.getBufferByIndex(id); Buffer * buf = MainFileManager.getBufferByID(idd); if (buf == nullptr) return FALSE; @@ -1015,8 +1007,6 @@ BOOL Notepad_plus::notify(SCNotification *notification) lpttt->lpszText = docTip; return TRUE; } - else - return FALSE; } catch (...) {