imgcat sometimes doesn't work in new panes
What Operating System(s) are you seeing this problem on?
Linux X11
WezTerm version
wezterm 20220427-144728-efcc4b48
Did you try the latest nightly build to see if the issue is better (or worse!) than your current version?
Yes, and I updated the version box above to show the version of the nightly that I tried
Describe the bug
I have tabs enabled and a ssh domain, so that I can get tmux-like remote-persistence happening, but hopefully with the benefit of image display support. After #1237 was fixed I circled back around to give this use-case another try. I found that image display works fine initially, but sometimes newly created panes would just return to the command prompt without showing the image. Initially I thought it was related to disconnecting and reconnecting to a pre-existing persistent session, but that does not seem to be the case.
To Reproduce
- Configure an
ssh_domainin your wezterm.lua (say foo) - Connect to the remote host
wezterm connect foo - Display an image
wezterm imgcat test.png(should work, assuming you have a test.png) - Create a new pane
- Display an image
wezterm imgcat test.png(should also work, but may not) - Close the wezterm window
- Reconnect to the remote host
wezterm connect foo - In one of the previously created panes, display an image
wezterm imgcat test.png(should also work) - Create a new pane
- Display an image
wezterm imgcat test.png(often does not work)
Configuration
local wezterm = require("wezterm");
local hostname = wezterm.hostname();
local irows = 55;
local icols = 191;
if hostname == "noir" then
irows = 65;
icols = 191;
end
wezterm.on("toggle-ligature", function(window, pane)
local overrides = window:get_config_overrides() or {}
if not overrides.harfbuzz_features then
-- If we haven't overridden it yet, then override with ligatures disabled
overrides.harfbuzz_features = {"calt=0", "clig=0", "liga=0"}
else
-- else we did already, and we should disable out override now
overrides.harfbuzz_features = nil
end
window:set_config_overrides(overrides)
end)
return {
ssh_domains = {
{
name = "noir",
remote_address = "noir",
username = "len",
},
{
name = "tron",
remote_address = "tron",
username = "len",
},
},
--
-- Behavior
--
check_for_updates = false,
disable_default_key_bindings = true,
exit_behavior = "Close",
enable_tab_bar = true,
leader = { key="`"}, -- use this when I'm using wezterm like tmux
-- leader = { key="`", mods = "CTRL"}, -- use this to effectively disable keys when using tmux
keys = {
{ key = "`", mods = "LEADER|CTRL", action=wezterm.action{SendString="`"}},
{ key = "-", mods = "LEADER", action=wezterm.action{SplitVertical={domain="CurrentPaneDomain"}}},
{ key = "\\",mods = "LEADER", action=wezterm.action{SplitHorizontal={domain="CurrentPaneDomain"}}},
{ key = "c", mods = "LEADER", action=wezterm.action{SpawnTab="CurrentPaneDomain"}},
{ key = "h", mods = "LEADER", action=wezterm.action{SplitVertical={domain="CurrentPaneDomain",args={"htop"}}}},
{ key = "\t", mods = "LEADER", action="ActivateLastTab"},
{ key = "1", mods = "LEADER", action=wezterm.action{ActivateTab=0}},
{ key = "2", mods = "LEADER", action=wezterm.action{ActivateTab=1}},
{ key = "3", mods = "LEADER", action=wezterm.action{ActivateTab=2}},
{ key = "4", mods = "LEADER", action=wezterm.action{ActivateTab=3}},
{ key = "5", mods = "LEADER", action=wezterm.action{ActivateTab=4}},
{ key = "6", mods = "LEADER", action=wezterm.action{ActivateTab=5}},
{ key = "7", mods = "LEADER", action=wezterm.action{ActivateTab=6}},
{ key = "8", mods = "LEADER", action=wezterm.action{ActivateTab=7}},
{ key = "9", mods = "LEADER", action=wezterm.action{ActivateTab=8}},
{ key = "l", mods = "LEADER", action=wezterm.action{EmitEvent="toggle-ligature"}},
{ key = "n", mods = "LEADER", action=wezterm.action{ActivateTabRelative=1}},
{ key = "p", mods = "LEADER", action=wezterm.action{ActivateTabRelative=-1}},
{ key = "&", mods = "LEADER|SHIFT", action=wezterm.action{CloseCurrentTab={confirm=true}}},
{ key = "x", mods = "LEADER", action=wezterm.action{CloseCurrentPane={confirm=true}}},
},
enable_kitty_graphics = true,
--
-- Appearance
--
--font = wezterm.font("JetBrains Mono"),
font = wezterm.font("Hack FC Ligatured"),
font_size = 12,
initial_rows = irows,
initial_cols = icols,
tab_bar_at_bottom = true,
window_padding = { left = 0, right = 0, bottom = 0, top = 0,},
use_fancy_tab_bar = false,
-- Appearance of "fancy" tab bar?
window_frame = {
inactive_titlebar_bg = "#111111",
-- active_titlebar_bg = "#33aa55",
-- inactive_tab_edge = "#ff4455",
},
-- Appearance of non-fancy tab bar
colors = {
selection_fg = "#cccccc",
selection_bg = "#444488",
tab_bar = {
-- The color of the strip that goes along the top of the window
-- (does not apply when fancy tab bar is in use)
background = "black",
active_tab = {
bg_color = "#00cc00",
fg_color = "black",
-- Specify whether you want "Half", "Normal" or "Bold" intensity for the
-- label shown for this tab.
-- The default is "Normal"
intensity = "Normal",
},
inactive_tab = {
bg_color = "#005500",
fg_color = "black",
},
inactive_tab_hover = {
bg_color = "#008800",
fg_color = "black",
},
-- The new tab button that let you create new tabs
new_tab = {
bg_color = "#999900",
fg_color = "black",
},
new_tab_hover = {
bg_color = "#dddd00",
fg_color = "black",
}
}
}
}
Expected Behavior
Newly created panes should also support image display.
Logs
$ wezterm connect tron
16:36:45.578 ERROR wezterm_client::client > going to run wezterm cli --prefer-mux proxy
16:36:46.141 INFO wezterm_gui::termwindow > OpenGL initialized! GeForce GTX 1060 6GB/PCIe/SSE2 4.6.0 NVIDIA 390.144 is_context_loss_possible=false wezterm version: 20220427-144728-efcc4b48
Anything else?
No response
Is there anything interesting in the logs on the multiplexer server?
You can find its logs in $XDG_RUNTIME_DIR/wezterm
The only thing in the logs were several of these, which do sound like they could be relevant:
16:34:56.436 ERROR wezterm_term::terminalstate::iterm > set iterm2 image: computing ypos: NotNan constructed with NaN
(At this point I haven't looked to see if the timestamps match with when I was trying to display images)
That's very relevant! It sounds like there is something awry with calculating the y-position for the image, so it skips processing it. Is there correlation between the cursor y-position and things not working, for example? Does it only happen with a particular image?
Update: Yes those messages appear in the log when it cannot display an image.
It also doesn't seem to be related to reconnecting to a previous session - I just created a brand new remote session, sucessfully did an imgcat in one pane, then created a new pane, and had it fail when trying to display exactly the same image.
I killed all shells in the previous session and started a new one.
Brand new window (about 1/4 the size of my monitor), successfully did imgcat in four consecutively created panes. Then I resized the window to make it occupy more of my monitor, created a pane, and in that new pane imgcat can't show the image.
Interestingly, I then resized the window to make it smaller, and (a new invokation of) imgcat could show the image in that previously broken pane. (And even if I then make the window bigger again, it continues to function).
Potentially resolved by bc7acc18e02cdfee5d1ae72bf6b5d3b483479850
Duplicate of #3366
This should be resolved now in main.
It typically takes about an hour before commits are available as nightly builds for all platforms. Linux builds are the fastest to build and are often available within about 20 minutes. Windows and macOS builds take a bit longer.
Please take a few moments to try out the fix and let me know how that works out. You can find the nightly downloads for your system in the wezterm installation docs.
If you prefer to use packages provided by your distribution or package manager of choice and don't want to replace that with a nightly download, keep in mind that you can download portable packages (eg: a .dmg file on macOS, a .zip file on Windows and an .AppImage file on Linux) that can be run without permanently installing or replacing an existing package, and can then simply be deleted once you no longer need them.
If you are eager and can build from source then you may be able to try this out more quickly.
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.