diff --git a/PowerEditor/src/MISC/Common/Common.cpp b/PowerEditor/src/MISC/Common/Common.cpp index 3d12d42a..29753f8d 100644 --- a/PowerEditor/src/MISC/Common/Common.cpp +++ b/PowerEditor/src/MISC/Common/Common.cpp @@ -85,7 +85,9 @@ void folderBrowser(HWND parent, int outputCtrlID, const TCHAR *defaultStr) info.ulFlags = 0; info.lpfn = BrowseCallbackProc; TCHAR directory[MAX_PATH]; - ::GetDlgItemText(parent, outputCtrlID, directory, sizeof(directory)); + ::GetDlgItemText(parent, outputCtrlID, directory, _countof(directory)); + directory[_countof(directory) - 1] = '\0'; + if (!directory[0] && defaultStr) info.lParam = reinterpret_cast(defaultStr); else diff --git a/PowerEditor/src/ScitillaComponent/xmlMatchedTagsHighlighter.cpp b/PowerEditor/src/ScitillaComponent/xmlMatchedTagsHighlighter.cpp index 9a0da21b..2848dd78 100644 --- a/PowerEditor/src/ScitillaComponent/xmlMatchedTagsHighlighter.cpp +++ b/PowerEditor/src/ScitillaComponent/xmlMatchedTagsHighlighter.cpp @@ -144,7 +144,7 @@ bool XmlMatchedTagsHighlighter::getXmlMatchedTagsPos(XmlMatchedTagsPos &xmlTags) openFound = findText("<", searchStartPoint, 0, 0); styleAt = _pEditView->execute(SCI_GETSTYLEAT, openFound.start); searchStartPoint = openFound.start - 1; - } while(openFound.success && (styleAt == SCE_H_DOUBLESTRING || styleAt == SCE_H_DOUBLESTRING) && searchStartPoint > 0); + } while (openFound.success && (styleAt == SCE_H_DOUBLESTRING || styleAt == SCE_H_SINGLESTRING) && searchStartPoint > 0); if (openFound.success && styleAt != SCE_H_CDATA) { @@ -156,7 +156,7 @@ bool XmlMatchedTagsHighlighter::getXmlMatchedTagsPos(XmlMatchedTagsPos &xmlTags) closeFound = findText(">", searchStartPoint, caret, 0); styleAt = _pEditView->execute(SCI_GETSTYLEAT, closeFound.start); searchStartPoint = closeFound.end; - } while (closeFound.success && (styleAt == SCE_H_DOUBLESTRING || styleAt == SCE_H_DOUBLESTRING) && searchStartPoint <= caret); + } while (closeFound.success && (styleAt == SCE_H_DOUBLESTRING || styleAt == SCE_H_SINGLESTRING) && searchStartPoint <= caret); if (!closeFound.success) {