Skip to content

Commit 636471c

Browse files
authored
Merge pull request #2375 from fastfetch-cli/dev
Release v2.64.2
2 parents 021ece1 + cbc84fd commit 636471c

10 files changed

Lines changed: 146 additions & 61 deletions

File tree

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
# 2.64.2
2+
3+
Bugfixes:
4+
* Fixes image rendering being wiped quickly (#2374)
5+
* Regression from v2.64.0
6+
* Fixes ASCII logo being overwritten in `--dynamic-interval` mode
7+
* Regression from v2.64.0
8+
9+
Logos:
10+
* Updates OpenWrt and adds a small variant (#2376)
11+
* The old one is renamed to `openwrt_old`
12+
113
# 2.64.1
214

315
Features:

CMakeLists.txt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
cmake_minimum_required(VERSION 3.12.0) # target_link_libraries with OBJECT libs & project homepage url
22

33
project(fastfetch
4-
VERSION 2.64.1
4+
VERSION 2.64.2
55
LANGUAGES C
66
DESCRIPTION "Fast neofetch-like system information tool"
77
HOMEPAGE_URL "https://github.com/fastfetch-cli/fastfetch"
@@ -1638,6 +1638,11 @@ function(ff_lib_enable VARNAME PKGCONFIG_NAMES CMAKE_NAME) # [CMAKE_TARGET_NAME]
16381638
set(${VARNAME}_LIBRARIES ${_FF_CMAKE_TARGET})
16391639
endif()
16401640
endif()
1641+
1642+
if(NOT BINARY_LINK_TYPE STREQUAL "dlopen")
1643+
# INTERFACE_LINK_LIBRARIES doesn't expose libvarname.a
1644+
target_link_libraries(libfastfetch PRIVATE ${_FF_CMAKE_TARGET})
1645+
endif()
16411646
endif()
16421647
else()
16431648
set(${VARNAME}_INCLUDE_DIRS ${${CMAKE_NAME}_INCLUDE_DIRS})
@@ -1691,8 +1696,8 @@ ff_lib_enable(DRM
16911696
"Libdrm"
16921697
)
16931698
ff_lib_enable(VA
1694-
"libva"
1695-
"Libva"
1699+
"libva-drm"
1700+
"Libva-drm"
16961701
)
16971702
ff_lib_enable(VDPAU
16981703
"vdpau"

src/common/impl/lua.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ static yyjson_mut_val* lua2yyjson(lua_State* L, int idx, yyjson_mut_doc* doc, in
99
if (__builtin_expect(depth > 15, false)) {
1010
yyjson_mut_doc_free(doc);
1111
lua_pushlstring(
12-
L, "yyjson: recursion depth exceeded; possible circular reference",
13-
strlen("yyjson: recursion depth exceeded; possible circular reference")
14-
);
12+
L, "yyjson: recursion depth exceeded; possible circular reference", strlen("yyjson: recursion depth exceeded; possible circular reference"));
1513
lua_error(L); // noreturn
1614
__builtin_unreachable();
1715
}
@@ -140,7 +138,7 @@ static int yyjsonEncode(lua_State* L) {
140138
}
141139
}
142140

143-
const char* ffLuaLoadState() {
141+
const char* ffLuaLoadState(void) {
144142
if (luaData.inited) {
145143
if (luaData.L == NULL) {
146144
return "Lua library is not available";
@@ -180,6 +178,8 @@ const char* ffLuaLoadState() {
180178
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(liblua, luaopen_string)
181179
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(liblua, luaopen_table)
182180
#endif
181+
182+
#if !FF_DISABLE_DLOPEN
183183
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(liblua, luaData, luaL_checkany)
184184
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(liblua, luaData, luaL_loadbufferx)
185185
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(liblua, luaData, luaL_tolstring)
@@ -208,6 +208,7 @@ const char* ffLuaLoadState() {
208208
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(liblua, luaData, lua_tolstring)
209209
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(liblua, luaData, lua_tonumberx)
210210
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(liblua, luaData, lua_type)
211+
#endif
211212

212213
lua_State* L = ffluaL_newstate();
213214
if (L == NULL) {

src/common/lua.h

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,19 @@
33
#include "fastfetch.h"
44

55
#if FF_HAVE_LUA
6-
// Hack. LUA_API is defined as extern which prevents us from implementing the functions ourselves.
7-
#include <luaconf.h>
8-
#undef LUA_API
9-
#undef LUALIB_API
10-
#undef LUAMOD_API
11-
#define LUA_API static inline
12-
#define LUALIB_API LUA_API
13-
#define LUAMOD_API LUA_API
14-
15-
#pragma GCC diagnostic ignored "-Wunused-function"
6+
#if !FF_DISABLE_DLOPEN
7+
// Hack. LUA_API is defined as extern which prevents us from implementing the functions ourselves.
8+
#include <luaconf.h>
9+
#undef LUA_API
10+
#undef LUALIB_API
11+
#undef LUAMOD_API
12+
#define LUA_API static inline
13+
#define LUALIB_API LUA_API
14+
#define LUAMOD_API LUA_API
15+
16+
#pragma GCC diagnostic ignored "-Wunused-function"
17+
#endif
18+
1619
#include <lua.h>
1720
#include <lauxlib.h>
1821
#include <lualib.h>
@@ -24,6 +27,7 @@
2427
#include "common/library.h"
2528

2629
extern struct FFLuaData {
30+
#if !FF_DISABLE_DLOPEN
2731
FF_LIBRARY_SYMBOL(luaL_checkany)
2832
FF_LIBRARY_SYMBOL(luaL_loadbufferx)
2933
FF_LIBRARY_SYMBOL(luaL_tolstring)
@@ -52,13 +56,13 @@ extern struct FFLuaData {
5256
FF_LIBRARY_SYMBOL(lua_tolstring)
5357
FF_LIBRARY_SYMBOL(lua_tonumberx)
5458
FF_LIBRARY_SYMBOL(lua_type)
59+
#endif
5560

5661
lua_State* L;
5762
bool inited;
5863
} luaData;
5964

60-
const char* ffLuaLoadState();
61-
65+
#if !FF_DISABLE_DLOPEN
6266
FF_A_ALWAYS_INLINE void(lua_settop)(lua_State* L, int idx) {
6367
return luaData.fflua_settop(L, idx);
6468
}
@@ -148,11 +152,11 @@ FF_A_ALWAYS_INLINE int(lua_rawgeti)(lua_State* L, int idx, lua_Integer n) {
148152
}
149153

150154
FF_A_ALWAYS_INLINE
151-
#if LUA_VERSION_NUM > 503
155+
#if LUA_VERSION_NUM > 503
152156
lua_Unsigned
153-
#else
157+
#else
154158
size_t
155-
#endif
159+
#endif
156160
(lua_rawlen)(lua_State* L, int idx) {
157161
return luaData.fflua_rawlen(L, idx);
158162
}
@@ -176,5 +180,8 @@ FF_A_ALWAYS_INLINE lua_Number(lua_tonumberx)(lua_State* L, int idx, int* isnum)
176180
FF_A_ALWAYS_INLINE int(lua_type)(lua_State* L, int idx) {
177181
return luaData.fflua_type(L, idx);
178182
}
183+
#endif
184+
185+
const char* ffLuaLoadState(void);
179186

180187
#endif

src/fastfetch.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -765,9 +765,12 @@ static void run(FFdata* data) {
765765
}
766766

767767
if (instance.state.dynamicInterval > 0) {
768+
ffLogoPrintRemaining(); // `logoLineCacheClear` inside so that ffLogoPrintLine will use `\e[nC` to move the cursor to the right position instead of reprinting the logo
769+
fputs("\e[J", stdout); // Clear from cursor to the end of the screen to prevent artifacts when the new output is shorter than the previous one
768770
fflush(stdout);
769771
ffTimeSleep(instance.state.dynamicInterval);
770-
fputs("\e[H", stdout);
772+
fputs("\e[H", stdout); // Move cursor to the top left corner to overwrite the previous output
773+
instance.state.keysHeight = 0; // Reset keysHeight so `ffLogoPrintRemaining` will recalculate it
771774
} else {
772775
break;
773776
}

src/logo/ascii/o.inc

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,34 @@ static const FFlogo O[] = {
291291
{
292292
.names = { "openwrt" },
293293
.lines = FASTFETCH_DATATEXT_LOGO_OPENWRT,
294+
.colors = {
295+
FF_COLOR_FG_DEFAULT,
296+
FF_COLOR_FG_BLUE,
297+
},
298+
.colorKeys = FF_COLOR_FG_BLUE,
299+
.colorTitle = FF_COLOR_FG_DEFAULT,
300+
},
301+
#endif
302+
#ifdef FASTFETCH_DATATEXT_LOGO_OPENWRT_SMALL
303+
// OpenWrtSmall
304+
{
305+
.names = { "openwrt_small" },
306+
.type = FF_LOGO_LINE_TYPE_SMALL_BIT,
307+
.lines = FASTFETCH_DATATEXT_LOGO_OPENWRT_SMALL,
308+
.colors = {
309+
FF_COLOR_FG_DEFAULT,
310+
FF_COLOR_FG_BLUE,
311+
},
312+
.colorKeys = FF_COLOR_FG_BLUE,
313+
.colorTitle = FF_COLOR_FG_DEFAULT,
314+
},
315+
#endif
316+
#ifdef FASTFETCH_DATATEXT_LOGO_OPENWRT_OLD
317+
// OpenWrtOld
318+
{
319+
.names = { "openwrt_old" },
320+
.type = FF_LOGO_LINE_TYPE_ALTER_BIT,
321+
.lines = FASTFETCH_DATATEXT_LOGO_OPENWRT_OLD,
294322
.colors = {
295323
FF_COLOR_FG_BLUE,
296324
},

src/logo/ascii/o/openwrt.txt

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
1-
_______
2-
| |.-----.-----.-----.
3-
| - || _ | -__| |
4-
|_______|| __|_____|__|__|
5-
|__|
6-
________ __
7-
| | | |.----.| |_
8-
| | | || _|| _|
9-
|________||__| |____|
1+
..,,..
2+
,;odOMMMMMMMMObo:.
3+
,odOMMMMMO""''""OMMMMMObo.
4+
.dMMMM" .,,. "OMMMb,
5+
'0" ,;ddMMMMMMMMbb:. "0'
6+
oOMMMMO""''""OMMMMOo
7+
$2;. $1'0" .,,. "0' $2.:
8+
.OMM* $1.odMMMMMMbo. $2*MMO.
9+
MMMO $1"0"````"0" $2OMMM
10+
iOMM $1.oo. $2MMMi
11+
OMMl $1:MMMM: $2lMMO
12+
iMMM $1'oo' $2MMMi
13+
OMMb $2dMMO
14+
'OMMO. ,OMMO'
15+
"MMMb. ,dMMM"
16+
"MMMMbgo-,,-ogdMMMM"
17+
"*MMMMMMMMMM*"
18+
`'""'`

src/logo/ascii/o/openwrt_old.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
_______
2+
| |.-----.-----.-----.
3+
| - || _ | -__| |
4+
|_______|| __|_____|__|__|
5+
|__|
6+
________ __
7+
| | | |.----.| |_
8+
| | | || _|| _|
9+
|________||__| |____|

src/logo/ascii/o/openwrt_small.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
..,..
2+
,odM"""""Mbo,
3+
`.odMMMMMbo.`
4+
$2d,$1" ,mmm, "$2,b
5+
iM $1" . " $2Mi
6+
Ml $1dMb $2lM
7+
'M, $1' $2.M'
8+
"0b. ,d0"
9+
`"WWWWW"`

src/logo/logo.c

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ static bool updateLogoPath(void) {
461461
return true;
462462
}
463463

464-
#if !FF_MODULE_DISABLE_MEDIA
464+
#if !FF_MODULE_DISABLE_MEDIA
465465
if (ffStrbufIgnCaseEqualS(&options->source, "media-cover")) {
466466
const FFMediaResult* media = ffDetectMedia(true);
467467
if (media->cover.length == 0) {
@@ -470,7 +470,7 @@ static bool updateLogoPath(void) {
470470
ffStrbufSet(&options->source, &media->cover);
471471
return true;
472472
}
473-
#endif
473+
#endif
474474

475475
FF_STRBUF_AUTO_DESTROY fullPath = ffStrbufCreateA(128);
476476
if (ffPathExpandEnv(options->source.chars, &fullPath) && ffPathExists(fullPath.chars, FF_PATHTYPE_FILE)) {
@@ -639,7 +639,7 @@ void ffLogoPrint(void) {
639639
}
640640

641641
if (!ffStrbufEndsWithIgnCaseS(&options->source, ".txt")) {
642-
#if !FF_MODULE_DISABLE_TERMINAL
642+
#if !FF_MODULE_DISABLE_TERMINAL
643643
const FFTerminalResult* terminal = ffDetectTerminal();
644644

645645
bool supportsIterm2 = ffStrbufEqualS(&terminal->prettyName, "iTerm");
@@ -655,15 +655,15 @@ void ffLogoPrint(void) {
655655
ffStrbufIgnCaseEqualS(&terminal->processName, "wezterm") ||
656656
ffStrbufIgnCaseEqualS(&terminal->processName, "wayst") ||
657657
ffStrbufIgnCaseEqualS(&terminal->processName, "ghostty") ||
658-
#ifdef __APPLE__
658+
#ifdef __APPLE__
659659
ffStrbufIgnCaseEqualS(&terminal->processName, "WarpTerminal") ||
660-
#else
660+
#else
661661
ffStrbufIgnCaseEqualS(&terminal->processName, "warp") ||
662-
#endif
662+
#endif
663663
false;
664-
#else
664+
#else
665665
bool supportsKitty = false;
666-
#endif
666+
#endif
667667

668668
// Try to load the logo as an image. If it succeeds, print it and return.
669669
if (logoPrintImageIfExists(supportsKitty ? FF_LOGO_TYPE_IMAGE_KITTY : FF_LOGO_TYPE_IMAGE_CHAFA, false)) {
@@ -685,37 +685,39 @@ void ffLogoPrint(void) {
685685
}
686686

687687
void ffLogoPrintLine(void) {
688-
uint32_t printedLineWidth = 0;
689688
FFLogoLineCacheState* cache = &instance.state.logoLineCache;
690689
FFOptionsLogo* logo = &instance.config.logo;
691690

692-
if (cache->lines.length > 0 && (logo->position == FF_LOGO_POSITION_LEFT || logo->position == FF_LOGO_POSITION_RIGHT) && cache->nextLine < cache->lines.length) {
693-
FFLogoCachedLine* line = FF_LIST_GET(FFLogoCachedLine, cache->lines, cache->nextLine);
691+
if (cache->lines.length > 0) {
692+
// Line cache is enabled. Always move cursor with whitespaces to make lolcat happy
693+
if (cache->nextLine < cache->lines.length) {
694+
// Print logo line and move cursor
695+
FFLogoCachedLine* line = FF_LIST_GET(FFLogoCachedLine, cache->lines, cache->nextLine);
694696

695-
if (logo->position == FF_LOGO_POSITION_RIGHT && line->chars.length > 0) {
696-
printf("\033[9999999C\033[%uD", cache->rightOffset);
697-
ffStrbufWriteTo(&line->chars, stdout);
698-
fputs("\033[G", stdout);
699-
} else {
700-
ffStrbufWriteTo(&line->chars, stdout);
701-
printedLineWidth = line->width;
702-
}
697+
if (logo->position == FF_LOGO_POSITION_RIGHT) {
698+
printf("\033[9999999C\033[%uD", cache->rightOffset);
699+
ffStrbufWriteTo(&line->chars, stdout);
703700

704-
++cache->nextLine;
705-
}
701+
fputs("\033[G", stdout);
702+
} else {
703+
ffStrbufWriteTo(&line->chars, stdout);
706704

707-
if (instance.state.logoWidth > 0) {
708-
if (instance.config.logo.position == FF_LOGO_POSITION_LEFT) {
709-
uint32_t remaining = instance.state.logoWidth;
710-
remaining = printedLineWidth < remaining ? remaining - printedLineWidth : 0;
711-
ffPrintCharTimes(' ', remaining);
712-
} else {
713-
printf("\033[%uC", instance.state.logoWidth);
705+
uint32_t remaining = instance.state.logoWidth;
706+
remaining = line->width < remaining ? remaining - line->width : 0;
707+
ffPrintCharTimes(' ', remaining);
708+
}
709+
++cache->nextLine;
710+
} else if (logo->position == FF_LOGO_POSITION_LEFT) {
711+
// Move cursor to the start position
712+
ffPrintCharTimes(' ', instance.state.logoWidth);
714713
}
714+
} else if (instance.state.logoWidth > 0) {
715+
printf("\033[%uC", instance.state.logoWidth);
715716
}
716717

717-
if (instance.state.dynamicInterval > 0) {
718+
if (instance.state.dynamicInterval > 0 && logo->position == FF_LOGO_POSITION_LEFT) {
718719
fputs("\033[K", stdout); // Clear to the end of the line
720+
// Note that we don't clear the line when the logo is on the right, as it will also clear the logo itself
719721
}
720722

721723
++instance.state.keysHeight;

0 commit comments

Comments
 (0)