mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-21 12:54:42 +02:00
Code enhancement - removing gcc warning
Fix conversion-null, nonnull-compare, dangling-else, address warnings, add initializers. Fix #12198, close #12199
This commit is contained in:
parent
d3b630841e
commit
b29a9ce142
@ -132,7 +132,7 @@ void writeLog(const TCHAR *logFileName, const char *log2write)
|
|||||||
|
|
||||||
if (hFile != INVALID_HANDLE_VALUE)
|
if (hFile != INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
LARGE_INTEGER offset;
|
LARGE_INTEGER offset{};
|
||||||
offset.QuadPart = 0;
|
offset.QuadPart = 0;
|
||||||
::SetFilePointerEx(hFile, offset, NULL, FILE_END);
|
::SetFilePointerEx(hFile, offset, NULL, FILE_END);
|
||||||
|
|
||||||
@ -189,7 +189,7 @@ generic_string getFolderName(HWND parent, const TCHAR *defaultDir)
|
|||||||
|
|
||||||
void ClientRectToScreenRect(HWND hWnd, RECT* rect)
|
void ClientRectToScreenRect(HWND hWnd, RECT* rect)
|
||||||
{
|
{
|
||||||
POINT pt;
|
POINT pt{};
|
||||||
|
|
||||||
pt.x = rect->left;
|
pt.x = rect->left;
|
||||||
pt.y = rect->top;
|
pt.y = rect->top;
|
||||||
@ -230,7 +230,7 @@ std::vector<generic_string> tokenizeString(const generic_string & tokenString, c
|
|||||||
|
|
||||||
void ScreenRectToClientRect(HWND hWnd, RECT* rect)
|
void ScreenRectToClientRect(HWND hWnd, RECT* rect)
|
||||||
{
|
{
|
||||||
POINT pt;
|
POINT pt{};
|
||||||
|
|
||||||
pt.x = rect->left;
|
pt.x = rect->left;
|
||||||
pt.y = rect->top;
|
pt.y = rect->top;
|
||||||
@ -262,7 +262,7 @@ bool isInList(const TCHAR *token, const TCHAR *list)
|
|||||||
const size_t wordLen = 64;
|
const size_t wordLen = 64;
|
||||||
size_t listLen = lstrlen(list);
|
size_t listLen = lstrlen(list);
|
||||||
|
|
||||||
TCHAR word[wordLen];
|
TCHAR word[wordLen] = { '\0' };
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
size_t j = 0;
|
size_t j = 0;
|
||||||
|
|
||||||
@ -1149,7 +1149,7 @@ bool isCertificateValidated(const generic_string & fullFilePath, const generic_s
|
|||||||
DWORD dwFormatType = 0;
|
DWORD dwFormatType = 0;
|
||||||
PCMSG_SIGNER_INFO pSignerInfo = NULL;
|
PCMSG_SIGNER_INFO pSignerInfo = NULL;
|
||||||
DWORD dwSignerInfo = 0;
|
DWORD dwSignerInfo = 0;
|
||||||
CERT_INFO CertInfo;
|
CERT_INFO CertInfo{};
|
||||||
LPTSTR szName = NULL;
|
LPTSTR szName = NULL;
|
||||||
|
|
||||||
generic_string subjectName;
|
generic_string subjectName;
|
||||||
@ -1287,7 +1287,6 @@ bool isAssoCommandExisting(LPCTSTR FullPathName)
|
|||||||
hres = AssocQueryString(ASSOCF_VERIFY|ASSOCF_INIT_IGNOREUNKNOWN, ASSOCSTR_COMMAND, ext, NULL, buffer, &bufferLen);
|
hres = AssocQueryString(ASSOCF_VERIFY|ASSOCF_INIT_IGNOREUNKNOWN, ASSOCSTR_COMMAND, ext, NULL, buffer, &bufferLen);
|
||||||
|
|
||||||
isAssoCommandExisting = (hres == S_OK) // check if association exist and no error
|
isAssoCommandExisting = (hres == S_OK) // check if association exist and no error
|
||||||
&& (buffer != NULL) // check if buffer is not NULL
|
|
||||||
&& (wcsstr(buffer, TEXT("notepad++.exe")) == NULL); // check association with notepad++
|
&& (wcsstr(buffer, TEXT("notepad++.exe")) == NULL); // check association with notepad++
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -491,7 +491,7 @@ LRESULT Notepad_plus::init(HWND hwnd)
|
|||||||
|
|
||||||
int numLangs = ::GetMenuItemCount(hLangMenu);
|
int numLangs = ::GetMenuItemCount(hLangMenu);
|
||||||
const int bufferSize = 100;
|
const int bufferSize = 100;
|
||||||
TCHAR buffer[bufferSize];
|
TCHAR buffer[bufferSize] = { '\0' };
|
||||||
const TCHAR* lexerNameW = wmc.char2wchar(externalLangContainer._name.c_str(), CP_ACP);
|
const TCHAR* lexerNameW = wmc.char2wchar(externalLangContainer._name.c_str(), CP_ACP);
|
||||||
|
|
||||||
int x = 0;
|
int x = 0;
|
||||||
@ -609,7 +609,7 @@ LRESULT Notepad_plus::init(HWND hwnd)
|
|||||||
willBeShown = nppGUI._toolbarShow;
|
willBeShown = nppGUI._toolbarShow;
|
||||||
|
|
||||||
// To notify plugins that toolbar icons can be registered
|
// To notify plugins that toolbar icons can be registered
|
||||||
SCNotification scnN;
|
SCNotification scnN{};
|
||||||
scnN.nmhdr.code = NPPN_TBMODIFICATION;
|
scnN.nmhdr.code = NPPN_TBMODIFICATION;
|
||||||
scnN.nmhdr.hwndFrom = hwnd;
|
scnN.nmhdr.hwndFrom = hwnd;
|
||||||
scnN.nmhdr.idFrom = 0;
|
scnN.nmhdr.idFrom = 0;
|
||||||
@ -820,7 +820,7 @@ bool Notepad_plus::saveGUIParams()
|
|||||||
|
|
||||||
// When window is maximized GetWindowPlacement returns window's last non maximized coordinates.
|
// When window is maximized GetWindowPlacement returns window's last non maximized coordinates.
|
||||||
// Save them so that those will be used when window is restored next time.
|
// Save them so that those will be used when window is restored next time.
|
||||||
WINDOWPLACEMENT posInfo;
|
WINDOWPLACEMENT posInfo{};
|
||||||
posInfo.length = sizeof(WINDOWPLACEMENT);
|
posInfo.length = sizeof(WINDOWPLACEMENT);
|
||||||
::GetWindowPlacement(_pPublicInterface->getHSelf(), &posInfo);
|
::GetWindowPlacement(_pPublicInterface->getHSelf(), &posInfo);
|
||||||
|
|
||||||
@ -2948,11 +2948,13 @@ bool removeUnwantedTrailingCharFromUrl (TCHAR const *text, int* length)
|
|||||||
{
|
{
|
||||||
if (text [j] == closingParenthesis [i])
|
if (text [j] == closingParenthesis [i])
|
||||||
count++;
|
count++;
|
||||||
if (text [j] == openingParenthesis [i])
|
if (text[j] == openingParenthesis[i])
|
||||||
|
{
|
||||||
if (count > 0)
|
if (count > 0)
|
||||||
count--;
|
count--;
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (count != 0)
|
if (count != 0)
|
||||||
return false;
|
return false;
|
||||||
@ -5937,10 +5939,6 @@ void Notepad_plus::prepareBufferChangedDialog(Buffer * buffer)
|
|||||||
|
|
||||||
void Notepad_plus::notifyBufferChanged(Buffer * buffer, int mask)
|
void Notepad_plus::notifyBufferChanged(Buffer * buffer, int mask)
|
||||||
{
|
{
|
||||||
// To avoid to crash while MS-DOS style is set as default language,
|
|
||||||
// Checking the validity of current instance is necessary.
|
|
||||||
if (!this) return;
|
|
||||||
|
|
||||||
NppParameters& nppParam = NppParameters::getInstance();
|
NppParameters& nppParam = NppParameters::getInstance();
|
||||||
const NppGUI & nppGUI = nppParam.getNppGUI();
|
const NppGUI & nppGUI = nppParam.getNppGUI();
|
||||||
|
|
||||||
|
@ -123,11 +123,9 @@ LRESULT Notepad_plus_Window::runProc(HWND hwnd, UINT message, WPARAM wParam, LPA
|
|||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
if (this)
|
return _notepad_plus_plus_core.process(hwnd, message, wParam, lParam);
|
||||||
return _notepad_plus_plus_core.process(hwnd, message, wParam, lParam);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Used by NPPM_GETFILENAMEATCURSOR
|
// Used by NPPM_GETFILENAMEATCURSOR
|
||||||
@ -572,7 +570,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
|
|||||||
BufferID id = _pEditView->getCurrentBufferID();
|
BufferID id = _pEditView->getCurrentBufferID();
|
||||||
|
|
||||||
// Notify plugins that current file is about to be closed
|
// Notify plugins that current file is about to be closed
|
||||||
SCNotification scnN;
|
SCNotification scnN{};
|
||||||
scnN.nmhdr.code = NPPN_DOCORDERCHANGED;
|
scnN.nmhdr.code = NPPN_DOCORDERCHANGED;
|
||||||
scnN.nmhdr.hwndFrom = reinterpret_cast<void *>(lParam);
|
scnN.nmhdr.hwndFrom = reinterpret_cast<void *>(lParam);
|
||||||
scnN.nmhdr.idFrom = reinterpret_cast<uptr_t>(id);
|
scnN.nmhdr.idFrom = reinterpret_cast<uptr_t>(id);
|
||||||
@ -678,7 +676,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
|
|||||||
generic_string pluginMessage { nppParam.getCmdLineParams()._pluginMessage };
|
generic_string pluginMessage { nppParam.getCmdLineParams()._pluginMessage };
|
||||||
if (!pluginMessage.empty())
|
if (!pluginMessage.empty())
|
||||||
{
|
{
|
||||||
SCNotification scnN;
|
SCNotification scnN{};
|
||||||
scnN.nmhdr.code = NPPN_CMDLINEPLUGINMSG;
|
scnN.nmhdr.code = NPPN_CMDLINEPLUGINMSG;
|
||||||
scnN.nmhdr.hwndFrom = hwnd;
|
scnN.nmhdr.hwndFrom = hwnd;
|
||||||
scnN.nmhdr.idFrom = reinterpret_cast<uptr_t>(pluginMessage.c_str());
|
scnN.nmhdr.idFrom = reinterpret_cast<uptr_t>(pluginMessage.c_str());
|
||||||
@ -820,7 +818,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
|
|||||||
|
|
||||||
case NPPM_INTERNAL_PLUGINSHORTCUTMOTIFIED:
|
case NPPM_INTERNAL_PLUGINSHORTCUTMOTIFIED:
|
||||||
{
|
{
|
||||||
SCNotification scnN;
|
SCNotification scnN{};
|
||||||
scnN.nmhdr.code = NPPN_SHORTCUTREMAPPED;
|
scnN.nmhdr.code = NPPN_SHORTCUTREMAPPED;
|
||||||
scnN.nmhdr.hwndFrom = reinterpret_cast<void *>(lParam); // ShortcutKey structure
|
scnN.nmhdr.hwndFrom = reinterpret_cast<void *>(lParam); // ShortcutKey structure
|
||||||
scnN.nmhdr.idFrom = (uptr_t)wParam; // cmdID
|
scnN.nmhdr.idFrom = (uptr_t)wParam; // cmdID
|
||||||
@ -1269,7 +1267,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
|
|||||||
if (message == NPPM_TRIGGERTABBARCONTEXTMENU)
|
if (message == NPPM_TRIGGERTABBARCONTEXTMENU)
|
||||||
{
|
{
|
||||||
// open here tab menu
|
// open here tab menu
|
||||||
NMHDR nmhdr;
|
NMHDR nmhdr{};
|
||||||
nmhdr.code = NM_RCLICK;
|
nmhdr.code = NM_RCLICK;
|
||||||
|
|
||||||
nmhdr.hwndFrom = (whichView == MAIN_VIEW)?_mainDocTab.getHSelf():_subDocTab.getHSelf();
|
nmhdr.hwndFrom = (whichView == MAIN_VIEW)?_mainDocTab.getHSelf():_subDocTab.getHSelf();
|
||||||
@ -2046,7 +2044,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
|
|||||||
_pDocMap->setSyntaxHiliting();
|
_pDocMap->setSyntaxHiliting();
|
||||||
|
|
||||||
// Notify plugins of update to styles xml
|
// Notify plugins of update to styles xml
|
||||||
SCNotification scnN;
|
SCNotification scnN{};
|
||||||
scnN.nmhdr.code = NPPN_WORDSTYLESUPDATED;
|
scnN.nmhdr.code = NPPN_WORDSTYLESUPDATED;
|
||||||
scnN.nmhdr.hwndFrom = hwnd;
|
scnN.nmhdr.hwndFrom = hwnd;
|
||||||
scnN.nmhdr.idFrom = (uptr_t) _pEditView->getCurrentBufferID();
|
scnN.nmhdr.idFrom = (uptr_t) _pEditView->getCurrentBufferID();
|
||||||
@ -2084,7 +2082,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SCNotification scnN;
|
SCNotification scnN{};
|
||||||
scnN.nmhdr.code = NPPN_BEFORESHUTDOWN;
|
scnN.nmhdr.code = NPPN_BEFORESHUTDOWN;
|
||||||
scnN.nmhdr.hwndFrom = hwnd;
|
scnN.nmhdr.hwndFrom = hwnd;
|
||||||
scnN.nmhdr.idFrom = 0;
|
scnN.nmhdr.idFrom = 0;
|
||||||
|
@ -320,7 +320,7 @@ BufferID Notepad_plus::doOpen(const generic_string& fileName, bool isRecursive,
|
|||||||
|
|
||||||
// Notify plugins that current file is about to load
|
// Notify plugins that current file is about to load
|
||||||
// Plugins can should use this notification to filter SCN_MODIFIED
|
// Plugins can should use this notification to filter SCN_MODIFIED
|
||||||
SCNotification scnN;
|
SCNotification scnN{};
|
||||||
scnN.nmhdr.code = NPPN_FILEBEFORELOAD;
|
scnN.nmhdr.code = NPPN_FILEBEFORELOAD;
|
||||||
scnN.nmhdr.hwndFrom = _pPublicInterface->getHSelf();
|
scnN.nmhdr.hwndFrom = _pPublicInterface->getHSelf();
|
||||||
scnN.nmhdr.idFrom = 0;
|
scnN.nmhdr.idFrom = 0;
|
||||||
@ -334,7 +334,7 @@ BufferID Notepad_plus::doOpen(const generic_string& fileName, bool isRecursive,
|
|||||||
BufferID buffer;
|
BufferID buffer;
|
||||||
if (isSnapshotMode)
|
if (isSnapshotMode)
|
||||||
{
|
{
|
||||||
buffer = MainFileManager.loadFile(longFileName, NULL, encoding, backupFileName, fileNameTimestamp);
|
buffer = MainFileManager.loadFile(longFileName, static_cast<Document>(NULL), encoding, backupFileName, fileNameTimestamp);
|
||||||
|
|
||||||
if (buffer != BUFFER_INVALID)
|
if (buffer != BUFFER_INVALID)
|
||||||
{
|
{
|
||||||
@ -342,7 +342,7 @@ BufferID Notepad_plus::doOpen(const generic_string& fileName, bool isRecursive,
|
|||||||
if (isSnapshotMode)
|
if (isSnapshotMode)
|
||||||
{
|
{
|
||||||
// To notify plugins that a snapshot dirty file is loaded on startup
|
// To notify plugins that a snapshot dirty file is loaded on startup
|
||||||
SCNotification scnN2;
|
SCNotification scnN2{};
|
||||||
scnN2.nmhdr.hwndFrom = 0;
|
scnN2.nmhdr.hwndFrom = 0;
|
||||||
scnN2.nmhdr.idFrom = (uptr_t)buffer;
|
scnN2.nmhdr.idFrom = (uptr_t)buffer;
|
||||||
scnN2.nmhdr.code = NPPN_SNAPSHOTDIRTYFILELOADED;
|
scnN2.nmhdr.code = NPPN_SNAPSHOTDIRTYFILELOADED;
|
||||||
@ -354,7 +354,7 @@ BufferID Notepad_plus::doOpen(const generic_string& fileName, bool isRecursive,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
buffer = MainFileManager.loadFile(longFileName, NULL, encoding);
|
buffer = MainFileManager.loadFile(longFileName, static_cast<Document>(NULL), encoding);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (buffer != BUFFER_INVALID)
|
if (buffer != BUFFER_INVALID)
|
||||||
@ -540,7 +540,7 @@ bool Notepad_plus::doSave(BufferID id, const TCHAR * filename, bool isCopy)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
SCNotification scnN;
|
SCNotification scnN{};
|
||||||
// Notify plugins that current file is about to be saved
|
// Notify plugins that current file is about to be saved
|
||||||
if (!isCopy)
|
if (!isCopy)
|
||||||
{
|
{
|
||||||
@ -685,7 +685,7 @@ void Notepad_plus::doClose(BufferID id, int whichOne, bool doDeleteBackup)
|
|||||||
Buffer * buf = MainFileManager.getBufferByID(id);
|
Buffer * buf = MainFileManager.getBufferByID(id);
|
||||||
|
|
||||||
// Notify plugins that current file is about to be closed
|
// Notify plugins that current file is about to be closed
|
||||||
SCNotification scnN;
|
SCNotification scnN{};
|
||||||
scnN.nmhdr.code = NPPN_FILEBEFORECLOSE;
|
scnN.nmhdr.code = NPPN_FILEBEFORECLOSE;
|
||||||
scnN.nmhdr.hwndFrom = _pPublicInterface->getHSelf();
|
scnN.nmhdr.hwndFrom = _pPublicInterface->getHSelf();
|
||||||
scnN.nmhdr.idFrom = (uptr_t)id;
|
scnN.nmhdr.idFrom = (uptr_t)id;
|
||||||
@ -779,7 +779,7 @@ void Notepad_plus::doClose(BufferID id, int whichOne, bool doDeleteBackup)
|
|||||||
generic_string Notepad_plus::exts2Filters(const generic_string& exts, int maxExtsLen) const
|
generic_string Notepad_plus::exts2Filters(const generic_string& exts, int maxExtsLen) const
|
||||||
{
|
{
|
||||||
const TCHAR *extStr = exts.c_str();
|
const TCHAR *extStr = exts.c_str();
|
||||||
TCHAR aExt[MAX_PATH];
|
TCHAR aExt[MAX_PATH] = { '\0' };
|
||||||
generic_string filters(TEXT(""));
|
generic_string filters(TEXT(""));
|
||||||
|
|
||||||
int j = 0;
|
int j = 0;
|
||||||
@ -1783,7 +1783,7 @@ bool Notepad_plus::fileRename(BufferID id)
|
|||||||
bufferID = _pEditView->getCurrentBufferID();
|
bufferID = _pEditView->getCurrentBufferID();
|
||||||
Buffer * buf = MainFileManager.getBufferByID(bufferID);
|
Buffer * buf = MainFileManager.getBufferByID(bufferID);
|
||||||
|
|
||||||
SCNotification scnN;
|
SCNotification scnN{};
|
||||||
scnN.nmhdr.code = NPPN_FILEBEFORERENAME;
|
scnN.nmhdr.code = NPPN_FILEBEFORERENAME;
|
||||||
scnN.nmhdr.hwndFrom = _pPublicInterface->getHSelf();
|
scnN.nmhdr.hwndFrom = _pPublicInterface->getHSelf();
|
||||||
scnN.nmhdr.idFrom = (uptr_t)bufferID;
|
scnN.nmhdr.idFrom = (uptr_t)bufferID;
|
||||||
@ -1890,7 +1890,7 @@ bool Notepad_plus::fileDelete(BufferID id)
|
|||||||
|
|
||||||
if (goAhead)
|
if (goAhead)
|
||||||
{
|
{
|
||||||
SCNotification scnN;
|
SCNotification scnN{};
|
||||||
scnN.nmhdr.code = NPPN_FILEBEFOREDELETE;
|
scnN.nmhdr.code = NPPN_FILEBEFOREDELETE;
|
||||||
scnN.nmhdr.hwndFrom = _pPublicInterface->getHSelf();
|
scnN.nmhdr.hwndFrom = _pPublicInterface->getHSelf();
|
||||||
scnN.nmhdr.idFrom = (uptr_t)bufferID;
|
scnN.nmhdr.idFrom = (uptr_t)bufferID;
|
||||||
|
@ -78,7 +78,7 @@ public:
|
|||||||
|
|
||||||
void addBufferReference(BufferID id, ScintillaEditView * identifer); //called by Scintilla etc indirectly
|
void addBufferReference(BufferID id, ScintillaEditView * identifer); //called by Scintilla etc indirectly
|
||||||
|
|
||||||
BufferID loadFile(const TCHAR * filename, Document doc = NULL, int encoding = -1, const TCHAR *backupFileName = NULL, FILETIME fileNameTimestamp = {}); //ID == BUFFER_INVALID on failure. If Doc == NULL, a new file is created, otherwise data is loaded in given document
|
BufferID loadFile(const TCHAR * filename, Document doc = static_cast<Document>(NULL), int encoding = -1, const TCHAR *backupFileName = nullptr, FILETIME fileNameTimestamp = {}); //ID == BUFFER_INVALID on failure. If Doc == NULL, a new file is created, otherwise data is loaded in given document
|
||||||
BufferID newEmptyDocument();
|
BufferID newEmptyDocument();
|
||||||
//create Buffer from existing Scintilla, used from new Scintillas. If dontIncrease = true, then the new document number isnt increased afterwards.
|
//create Buffer from existing Scintilla, used from new Scintillas. If dontIncrease = true, then the new document number isnt increased afterwards.
|
||||||
//usefull for temporary but neccesary docs
|
//usefull for temporary but neccesary docs
|
||||||
@ -174,9 +174,9 @@ public:
|
|||||||
|
|
||||||
bool isDirty() const { return _isDirty; }
|
bool isDirty() const { return _isDirty; }
|
||||||
|
|
||||||
bool isReadOnly() const { return (_isUserReadOnly || _isFileReadOnly); };
|
bool isReadOnly() const { return (_isUserReadOnly || _isFileReadOnly); }
|
||||||
|
|
||||||
bool isUntitled() const { return (_currentStatus == DOC_UNNAMED); }
|
bool isUntitled() const { return ((_currentStatus & DOC_UNNAMED) == DOC_UNNAMED); }
|
||||||
|
|
||||||
bool getFileReadOnly() const { return _isFileReadOnly; }
|
bool getFileReadOnly() const { return _isFileReadOnly; }
|
||||||
|
|
||||||
|
@ -33,10 +33,10 @@ void SmartHighlighter::highlightViewWithWord(ScintillaEditView * pHighlightView,
|
|||||||
auto originalEndPos = pHighlightView->execute(SCI_GETTARGETEND);
|
auto originalEndPos = pHighlightView->execute(SCI_GETTARGETEND);
|
||||||
|
|
||||||
// Get the range of text visible and highlight everything in it
|
// Get the range of text visible and highlight everything in it
|
||||||
auto firstLine = pHighlightView->execute(SCI_GETFIRSTVISIBLELINE);
|
intptr_t firstLine = pHighlightView->execute(SCI_GETFIRSTVISIBLELINE);
|
||||||
auto nbLineOnScreen = pHighlightView->execute(SCI_LINESONSCREEN);
|
intptr_t nbLineOnScreen = pHighlightView->execute(SCI_LINESONSCREEN);
|
||||||
auto nbLines = min(nbLineOnScreen, MAXLINEHIGHLIGHT) + 1;
|
intptr_t nbLines = min(nbLineOnScreen, MAXLINEHIGHLIGHT) + 1;
|
||||||
auto lastLine = firstLine + nbLines;
|
intptr_t lastLine = firstLine + nbLines;
|
||||||
size_t startPos = 0;
|
size_t startPos = 0;
|
||||||
intptr_t endPos = 0;
|
intptr_t endPos = 0;
|
||||||
auto currentLine = firstLine;
|
auto currentLine = firstLine;
|
||||||
|
@ -1718,8 +1718,8 @@ void StringDlg::HandlePaste(HWND hEdit)
|
|||||||
|
|
||||||
void StylerDlg::move2CtrlRight(HWND hwndDlg, int ctrlID, HWND handle2Move, int handle2MoveWidth, int handle2MoveHeight)
|
void StylerDlg::move2CtrlRight(HWND hwndDlg, int ctrlID, HWND handle2Move, int handle2MoveWidth, int handle2MoveHeight)
|
||||||
{
|
{
|
||||||
POINT p;
|
POINT p{};
|
||||||
RECT rc;
|
RECT rc{};
|
||||||
::GetWindowRect(::GetDlgItem(hwndDlg, ctrlID), &rc);
|
::GetWindowRect(::GetDlgItem(hwndDlg, ctrlID), &rc);
|
||||||
|
|
||||||
p.x = rc.right + NppParameters::getInstance()._dpiManager.scaleX(5);
|
p.x = rc.right + NppParameters::getInstance()._dpiManager.scaleX(5);
|
||||||
@ -1764,7 +1764,7 @@ intptr_t CALLBACK StylerDlg::dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPA
|
|||||||
for (size_t j = 0 ; j < int(sizeof(fontSizeStrs))/(3*sizeof(TCHAR)) ; ++j)
|
for (size_t j = 0 ; j < int(sizeof(fontSizeStrs))/(3*sizeof(TCHAR)) ; ++j)
|
||||||
::SendMessage(hFontSizeCombo, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(fontSizeStrs[j]));
|
::SendMessage(hFontSizeCombo, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(fontSizeStrs[j]));
|
||||||
|
|
||||||
TCHAR size[10];
|
TCHAR size[10] = { '\0' };
|
||||||
if (style._fontSize == -1)
|
if (style._fontSize == -1)
|
||||||
size[0] = '\0';
|
size[0] = '\0';
|
||||||
else
|
else
|
||||||
@ -1883,13 +1883,13 @@ intptr_t CALLBACK StylerDlg::dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPA
|
|||||||
if (i != 0)
|
if (i != 0)
|
||||||
{
|
{
|
||||||
const size_t intStrLen = 3;
|
const size_t intStrLen = 3;
|
||||||
TCHAR intStr[intStrLen];
|
TCHAR intStr[intStrLen] = { '\0' };
|
||||||
auto lbTextLen = ::SendDlgItemMessage(hwnd, LOWORD(wParam), CB_GETLBTEXTLEN, i, 0);
|
auto lbTextLen = ::SendDlgItemMessage(hwnd, LOWORD(wParam), CB_GETLBTEXTLEN, i, 0);
|
||||||
if (static_cast<size_t>(lbTextLen) > intStrLen - 1)
|
if (static_cast<size_t>(lbTextLen) > intStrLen - 1)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
::SendDlgItemMessage(hwnd, LOWORD(wParam), CB_GETLBTEXT, i, reinterpret_cast<LPARAM>(intStr));
|
::SendDlgItemMessage(hwnd, LOWORD(wParam), CB_GETLBTEXT, i, reinterpret_cast<LPARAM>(intStr));
|
||||||
if ((!intStr) || (!intStr[0]))
|
if (!intStr[0])
|
||||||
style._fontSize = -1;
|
style._fontSize = -1;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user