TerminalFont: fix mintty terminal font detection

This commit is contained in:
李通洲
2023-01-03 16:44:27 +08:00
parent a98c71aab4
commit 30f9bcbd22
3 changed files with 35 additions and 2 deletions
+1
View File
@@ -16,6 +16,7 @@ Logos:
Bugfixes:
* `--logo-type` now does accept `iterm` too (@CarterLi, #374)
* Fix mintty terminal font detection
Other:
* Fixed a Typo in iterm error message (@jessebot, #376)
+28
View File
@@ -77,6 +77,30 @@ static void initConfigDirs(FFstate* state)
ffStrbufEnsureEndsWithC(userHome, '/');
FF_ENSURE_ONLY_ONCE_IN_LIST(userHome)
#ifdef _WIN32
if(getenv("MSYSTEM") && getenv("HOME"))
{
// We are in MSYS2 / Git Bash
FFstrbuf* msysConfigHome = ffListAdd(&state->configDirs);
ffStrbufInitA(msysConfigHome, 64);
ffStrbufAppendS(msysConfigHome, getenv("HOME"));
ffStrbufReplaceAllC(msysConfigHome, '\\', '/');
ffStrbufEnsureEndsWithC(msysConfigHome, '/');
ffStrbufAppendS(msysConfigHome, ".config/");
FF_ENSURE_ONLY_ONCE_IN_LIST(msysConfigHome)
FFstrbuf* msysHome = ffListAdd(&state->configDirs);
ffStrbufInitA(msysHome, 64);
ffStrbufAppendS(msysHome, getenv("HOME"));
ffStrbufReplaceAllC(msysHome, '\\', '/');
ffStrbufEnsureEndsWithC(msysHome, '/');
FF_ENSURE_ONLY_ONCE_IN_LIST(msysHome)
}
#endif
#if !(defined(_WIN32) || defined(__APPLE__) || defined(__ANDROID__))
FFstrbuf xdgConfigDirs;
@@ -112,11 +136,15 @@ static void initConfigDirs(FFstate* state)
#endif
#ifndef _WIN32
FFstrbuf* systemConfig = ffListAdd(&state->configDirs);
ffStrbufInitA(systemConfig, 64);
ffStrbufAppendS(systemConfig, FASTFETCH_TARGET_DIR_ETC"/");
FF_ENSURE_ONLY_ONCE_IN_LIST(systemConfig)
#endif
#undef FF_ENSURE_ONLY_ONCE_IN_LIST
}
@@ -14,10 +14,14 @@ static void detectMintty(const FFinstance* instance, FFTerminalFontResult* termi
FF_STRBUF_AUTO_DESTROY fontSize;
ffStrbufInit(&fontSize);
ffParsePropFileHomeValues(instance, ".minttyrc", 2, (FFpropquery[]) {
if(!ffParsePropFileConfigValues(instance, "mintty/config", 2, (FFpropquery[]) {
{"Font=", &fontName},
{"FontHeight=", &fontSize}
});
}))
ffParsePropFileConfigValues(instance, ".minttyrc", 2, (FFpropquery[]) {
{"Font=", &fontName},
{"FontHeight=", &fontSize}
});
if(fontName.length == 0)
ffStrbufAppendS(&fontName, "Lucida Console");
if(fontSize.length == 0)