diff --git a/src/StyleLexers/styleLexStandard.c b/src/StyleLexers/styleLexStandard.c index 87d4bf9b1..c71176a16 100644 --- a/src/StyleLexers/styleLexStandard.c +++ b/src/StyleLexers/styleLexStandard.c @@ -41,7 +41,7 @@ SCLEX_NULL, IDS_LEX_STR_63266, L"2nd Default Text", L"txt; text; wtx; log; asc; /* 9 */ { {_STYLE_GETSTYLEID(STY_CARET)}, IDS_LEX_2ND_CARET, L"2nd Caret (Color, Size 1-3)", L"size:1; ovrbar", L"" }, /* 10 */ { {_STYLE_GETSTYLEID(STY_LONG_LN_MRK)}, IDS_LEX_2ND_LONG_LN, L"2nd Long Line Marker (Colors)", L"fore:#FFC000", L"" }, /* 11 */ { {_STYLE_GETSTYLEID(STY_X_LN_SPACE)}, IDS_LEX_2ND_X_SPC, L"2nd Extra Line Spacing (Size)", L"", L"" }, - /* 12 */ { {_STYLE_GETSTYLEID(STY_BOOK_MARK)}, IDS_LEX_2ND_BKMRK, L"2nd Bookmarks and Folding (Colors, Size)", L"size:+2; fore:#000000; back:#00DC00; alpha:100; charset:2; case:U", L"" }, + /* 12 */ { {_STYLE_GETSTYLEID(STY_BOOK_MARK)}, IDS_LEX_2ND_BKMRK, L"2nd Bookmarks and Folding (Colors, Size)", L"size:+2; charset:2; fore:#000000; back:#00DC00; case:U; alpha:100", L"" }, /* 13 */ { {_STYLE_GETSTYLEID(STY_MARK_OCC)}, IDS_LEX_STR_63263, L"2nd Mark Occurrences (Indicator)", L"fore:#000000; alpha:100; alpha2:220; indic_box", L"" }, /* 14 */ { {_STYLE_GETSTYLEID(STY_URL_HOTSPOT)}, IDS_LEX_STR_63265, L"2nd Hyperlink Hotspots", L"bold; fore:#FF0000", L"" }, /* 15 */ { {_STYLE_GETSTYLEID(STY_IME_COLOR)}, IDS_LEX_STR_63353, L"2nd Inline-IME Color", L"fore:#FF0000", L"" }, diff --git a/src/Styles.c b/src/Styles.c index ee27ce598..f04de01ed 100644 --- a/src/Styles.c +++ b/src/Styles.c @@ -676,7 +676,7 @@ bool Style_Export(HWND hwnd) DWORD Style_ExportToFile(const WCHAR* szFile, bool bForceAll) { - if (!szFile || szFile[0] == L'\0') { + if (StrIsEmpty(szFile)) { MsgBoxLng(MBWARN, IDS_MUI_SETTINGSNOTSAVED); return false; } @@ -684,6 +684,7 @@ DWORD Style_ExportToFile(const WCHAR* szFile, bool bForceAll) size_t const len = NUMLEXERS * AVG_NUM_OF_STYLES_PER_LEXER * 100; WCHAR* pIniSection = AllocMem(len * sizeof(WCHAR), HEAP_ZERO_MEMORY); if (pIniSection) { ZeroMemory(pIniSection, len * sizeof(WCHAR)); } + DWORD dwError = ERROR_NOT_ENOUGH_MEMORY; if (pIniSection) { @@ -765,6 +766,8 @@ DWORD Style_ExportToFile(const WCHAR* szFile, bool bForceAll) } ++i; } + + dwError = ERROR_SUCCESS; if (!WritePrivateProfileSection(g_pLexArray[iLexer]->pszName, pIniSection, szFile)) { dwError = GetLastError(); } @@ -1105,11 +1108,10 @@ void Style_SetLexer(HWND hwnd, PEDITLEXER pLexNew) int ovr_mask = CARETSTYLE_OVERSTRIKE_BLOCK; if (StrStr(pCurrentStandard->Styles[STY_CARET].szValue, L"ovrbar")) { - StringCchCat(wchSpecificStyle, COUNTOF(wchSpecificStyle), L"; ovrbar"); ovr_mask = CARETSTYLE_OVERSTRIKE_BAR; } - if (StrStr(pCurrentStandard->Styles[STY_CARET].szValue,L"block")) { + if (StrStr(pCurrentStandard->Styles[STY_CARET].szValue, L"block")) { StringCchCat(wchSpecificStyle, COUNTOF(wchSpecificStyle), L"; block"); SendMessage(hwnd, SCI_SETCARETSTYLE, (CARETSTYLE_BLOCK | ovr_mask), 0); } @@ -1122,10 +1124,14 @@ void Style_SetLexer(HWND hwnd, PEDITLEXER pLexNew) if (Style_StrGetSize(pCurrentStandard->Styles[STY_CARET].szValue, &fValue)) { iValue = clampi(float2int(fValue), 1, 3); // don't allow invisible 0 } + SendMessage(hwnd, SCI_SETCARETWIDTH, iValue, 0); + StringCchPrintf(wch, COUNTOF(wch), L"; size:%i", iValue); StringCchCat(wchSpecificStyle, COUNTOF(wchSpecificStyle), wch); - SendMessage(hwnd, SCI_SETCARETWIDTH, iValue, 0); + if (CARETSTYLE_OVERSTRIKE_BAR == ovr_mask) { + StringCchCat(wchSpecificStyle, COUNTOF(wchSpecificStyle), L"; ovrbar"); + } } if (StrStr(pCurrentStandard->Styles[STY_CARET].szValue,L"noblink")) { SendMessage(hwnd,SCI_SETCARETPERIOD,(WPARAM)0,0);