mirror of
https://github.com/rizonesoft/Notepad3.git
synced 2026-06-11 21:03:05 +08:00
+fix: correction to LineSpace evaluation TEXT files
This commit is contained in:
parent
6013df7ffa
commit
f009a104f4
@ -64,11 +64,11 @@ Inline-IME Color=fore:#4EF64D
|
||||
[Text Files]
|
||||
Default=font:$Text; size:11
|
||||
Margins and Line Numbers=font:Consolas; size:-1; fore:#DEDEDE; back:#454545
|
||||
Extra Line Spacing (Size)=size:+1
|
||||
Extra Line Spacing (Size)=size:2
|
||||
[ANSI Art]
|
||||
Default=font:Lucida Console; thin; size:11; smoothing:aliased
|
||||
Margins and Line Numbers=font:Lucida Console; size:-2; fore:#DEDEDE; back:#454545
|
||||
Extra Line Spacing (Size)=size:-2
|
||||
Margins and Line Numbers=font:Lucida Console; size:-1; fore:#DEDEDE; back:#454545
|
||||
Extra Line Spacing (Size)=size:-1
|
||||
[Apache Config Files]
|
||||
Comment=fore:#DBF873
|
||||
String=fore:#F651F6
|
||||
|
||||
@ -71,7 +71,7 @@ EDITLEXER lexTEXT =
|
||||
&KeyWords_NULL,{
|
||||
{ {STYLE_DEFAULT}, IDS_LEX_STR_63126, L"Default", L"font:$Text; size:11", L"" },
|
||||
{ {STYLE_LINENUMBER}, IDS_LEX_STD_MARGIN, L"Margins and Line Numbers", L"font:Consolas; size:-1", L"" },
|
||||
{ {STYLE_BRACELIGHT}, IDS_LEX_STD_X_SPC, L"Extra Line Spacing (Size)", L"size:+1", L"" },
|
||||
{ {STYLE_BRACELIGHT}, IDS_LEX_STD_X_SPC, L"Extra Line Spacing (Size)", L"size:2", L"" },
|
||||
EDITLEXER_SENTINEL
|
||||
}
|
||||
};
|
||||
@ -85,7 +85,7 @@ EDITLEXER lexANSI =
|
||||
{ {STYLE_LINENUMBER}, IDS_LEX_STD_MARGIN, L"Margins and Line Numbers", L"font:Lucida Console; size:-2", L"" },
|
||||
{ {STYLE_BRACELIGHT}, IDS_LEX_STD_BRACE, L"Matching Braces", L"", L"" },
|
||||
{ {STYLE_BRACEBAD}, IDS_LEX_STD_BRACE_FAIL, L"Matching Braces Error", L"", L"" },
|
||||
{ {STYLE_CONTROLCHAR}, IDS_LEX_STD_X_SPC, L"Extra Line Spacing (Size)", L"size:-2", L"" },
|
||||
{ {STYLE_CONTROLCHAR}, IDS_LEX_STD_X_SPC, L"Extra Line Spacing (Size)", L"size:-1", L"" },
|
||||
EDITLEXER_SENTINEL
|
||||
}
|
||||
};
|
||||
|
||||
37
src/Styles.c
37
src/Styles.c
@ -1656,7 +1656,14 @@ void Style_SetLexer(HWND hwnd, PEDITLEXER pLexNew)
|
||||
size_t const cnt = ReadVectorFromString(Globals.fvCurFile.wchMultiEdgeLines, edgeColumns, COUNTOF(edgeColumns), 0, LONG_LINES_MARKER_LIMIT, 0, true);
|
||||
Style_SetMultiEdgeLine(edgeColumns, cnt);
|
||||
|
||||
Style_SetExtraLineSpace(hwnd, pCurrentStandard->Styles[STY_X_LN_SPACE].szValue, 0);
|
||||
|
||||
int iLnSpc = 0;
|
||||
if (Style_StrGetSizeIntEx(pCurrentStandard->Styles[STY_X_LN_SPACE].szValue, &iLnSpc)) {
|
||||
Style_SetExtraLineSpace(iLnSpc);
|
||||
}
|
||||
else {
|
||||
Style_SetExtraLineSpace(0);
|
||||
}
|
||||
|
||||
if (SciCall_GetIndentationGuides() != SC_IV_NONE) {
|
||||
Style_SetIndentGuides(hwnd, true);
|
||||
@ -1682,9 +1689,10 @@ void Style_SetLexer(HWND hwnd, PEDITLEXER pLexNew)
|
||||
pCurrentStandard->Styles[STY_BRACE_BAD].szValue, fBaseFontSize);
|
||||
}
|
||||
|
||||
int const curSpc = (SciCall_GetExtraAscent() + SciCall_GetExtraDescent()) >> 1;
|
||||
Style_SetExtraLineSpace(hwnd, s_pLexCurrent->Styles[STY_CTRL_CHR].szValue, curSpc);
|
||||
|
||||
iLnSpc = 0; // do not inherit from base
|
||||
if (Style_StrGetSizeIntEx(s_pLexCurrent->Styles[4].szValue, &iLnSpc)) {
|
||||
Style_SetExtraLineSpace(iLnSpc);
|
||||
}
|
||||
}
|
||||
else if (s_pLexCurrent == &lexTEXT) {
|
||||
|
||||
@ -1693,7 +1701,10 @@ void Style_SetLexer(HWND hwnd, PEDITLEXER pLexNew)
|
||||
Style_CopyStyles_IfNotDefined(pCurrentStandard->Styles[STY_MARGIN].szValue, wchStylesBuffer, COUNTOF(wchStylesBuffer));
|
||||
Style_SetMargin(hwnd, wchStylesBuffer);
|
||||
|
||||
Style_SetExtraLineSpace(hwnd, s_pLexCurrent->Styles[STY_BRACE_OK].szValue, 0);
|
||||
iLnSpc = (SciCall_GetExtraAscent() + SciCall_GetExtraDescent()) >> 1; // inherit from base
|
||||
if (Style_StrGetSizeIntEx(s_pLexCurrent->Styles[2].szValue, &iLnSpc)) {
|
||||
Style_SetExtraLineSpace(iLnSpc);
|
||||
}
|
||||
|
||||
} else if (s_pLexCurrent->lexerID != SCLEX_NULL) {
|
||||
|
||||
@ -2835,19 +2846,15 @@ void Style_SetIndentGuides(HWND hwnd,bool bShow)
|
||||
//
|
||||
// Style_SetExtraLineSpace()
|
||||
//
|
||||
void Style_SetExtraLineSpace(HWND hwnd, LPWSTR lpszStyle, int iValue)
|
||||
void Style_SetExtraLineSpace(int iValue)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(hwnd);
|
||||
|
||||
int iAscent = 0, iDescent = 0;
|
||||
if (Style_StrGetSizeIntEx(lpszStyle, &iValue)) {
|
||||
if ((iValue % 2) != 0) {
|
||||
iAscent++;
|
||||
iValue--;
|
||||
}
|
||||
iAscent += (iValue >> 1);
|
||||
iDescent += (iValue >> 1);
|
||||
if ((iValue % 2) != 0) {
|
||||
iAscent++;
|
||||
iValue--;
|
||||
}
|
||||
iAscent += (iValue >> 1);
|
||||
iDescent += (iValue >> 1);
|
||||
SciCall_SetExtraAscent(iAscent);
|
||||
SciCall_SetExtraDescent(iDescent);
|
||||
}
|
||||
|
||||
@ -82,7 +82,7 @@ void Style_ToggleUse2ndDefault(HWND hwnd);
|
||||
bool Style_GetUse2ndDefault();
|
||||
void Style_SetUse2ndDefault(bool);
|
||||
void Style_SetIndentGuides(HWND hwnd,bool);
|
||||
void Style_SetExtraLineSpace(HWND hwnd, LPWSTR lpszStyle, int iValue);
|
||||
void Style_SetExtraLineSpace(int iValue);
|
||||
bool Style_GetFileFilterStr(LPWSTR lpszFilter, int cchFilter, LPWSTR lpszDefExt, int cchExt, bool bSaveAs);
|
||||
bool Style_StrGetFontName(LPCWSTR lpszStyle,LPWSTR lpszFont,int cchFont);
|
||||
bool Style_StrGetFontQuality(LPCWSTR lpszStyle, LPWSTR lpszQuality, int cchQuality, int* iSciQuality_out);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user