-
Notifications
You must be signed in to change notification settings - Fork 344
Description
This continues the conversation from #1767 (comment).
When I run lf
r34 with the following config file, I get the following message printed to the console (visible after quitting lf
):
$ lf
listen: send: no such client id is connected
Config file:
cmd recol ${{
w=$(tput cols)
if [ $w -le 30 ]; then
set nopreview
lf -remote "send $id set ratios 1"
elif [ $w -le 50 ]; then
lf -remote "send $id set ratios 1:1"
elif [ $w -le 65 ]; then
lf -remote "send $id set ratios 3:4"
elif [ $w -le 95 ]; then # Was 160
lf -remote "send $id set ratios 2:3:4"
set preview
else
lf -remote "send $id set ratios 2:2:3:4"
set preview
fi
}}
cmd on-redraw :recol
cmd on-init :recol
Commenting out on-redraw
fixes the issue to a degree, but I would like recol
to be called on terminal size change.
I think the issue is that the first on-redraw
happens too early. Perhaps it should happen after on-init
.
A separate problem is that, even if on-redraw
is commented out, lf
already draws the interface by the time on-init
is called. So, you get a flash of its original setup before it gets replaced by the result of the recol
.
Workaround
I think there's a workaround of changing the on-init
to
cmd on-init : set user_enable_recol true; recol
# Or, equivalently,
cmd on-init :{{
set user_enable_recol true
recol
}}
and checking the value of $lf_user_enable_recol
inside cmd recol
.
This does not fix the flash of the wrong number of columns before lf
redraws.
Update: More precisely, here is the diff that seems to be a working workaround:
--- lfrc-bug 2025-02-11 18:14:14
+++ lfrc-workaround 2025-02-11 18:25:22
@@ -1,5 +1,9 @@
cmd recol ${{
+ if [ "${lf_user_allow_recol-no}" = no ]; then
+ exit 0
+ fi
+
w=$(tput cols)
if [ $w -le 30 ]; then
set nopreview
@@ -17,4 +21,4 @@
fi
}}
cmd on-redraw :recol
-cmd on-init :recol
+cmd on-init :set user_allow_recol true; recol
Workaround 2
Or, I can set noautoquit
, and then this message is printed only once no matter how many times I start lf
. Update: Also, this solves the visual refresh problem.