wez / wezterm

A GPU-accelerated cross-platform terminal emulator and multiplexer written by @wez and implemented in Rust
https://wezfurlong.org/wezterm/
Other
17.17k stars 775 forks source link

Incorrect paint (not waiting for output) with lldb #5489

Closed artagnon closed 4 months ago

artagnon commented 4 months ago

What Operating System(s) are you seeing this problem on?

macOS

Which Wayland compositor or X11 Window manager(s) are you using?

No response

WezTerm version

20240520-135708-b8f94c47

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

It's hard to explain exactly, but I've recorded the buggy lldb session here:

https://asciinema.org/a/ST2nBRj5Lk1mSDS65UXeoK61O

Basically, once a print command is invoked, it should print the result before showing the (lldb) prompt again. Instead, it has polluted the (lldb) prompt with the output.

The bug is very debilitating, and is a major blocker for any C/C++ development. I will have to switch back to iTerm until this bug is resolved.

To Reproduce

Attempt to dump a string in lldb.

Configuration

local wezterm = require 'wezterm'
local mux = wezterm.mux
local config = wezterm.config_builder()

local cache_dir = os.getenv('HOME') .. '/.cache/wezterm/'
local window_size_cache_path = cache_dir .. 'window_size_cache.txt'

wezterm.on('gui-startup', function()
  os.execute('mkdir ' .. cache_dir)

  local window_size_cache_file = io.open(window_size_cache_path, 'r')
  if window_size_cache_file ~= nil then
    _, _, width, height = string.find(window_size_cache_file:read(), '(%d+),(%d+)')
    mux.spawn_window{ width = tonumber(width), height = tonumber(height) }
    window_size_cache_file:close()
  else
    local tab, pane, window = mux.spawn_window{}
    window:gui_window():maximize()
  end
end)

wezterm.on('window-resized', function(window, pane)
  local window_size_cache_file = io.open(window_size_cache_path, 'r')
  local tab_size = pane:tab():get_size()
  cols = tab_size['cols']
  rows = tab_size['rows'] + 2 -- Without adding the 2 here, the window doesn't maximize
  contents = string.format('%d,%d', cols, rows)
  window_size_cache_file:write(contents)
  window_size_cache_file:close()
end)

config.default_prog = { '/opt/homebrew/bin/fish', '-l' }
config.color_scheme = 'Sonokai (Gogh)'
config.keys = {
  {
    key = 'w',
    mods = 'CMD',
    action = wezterm.action.CloseCurrentTab { confirm = false },
  },
}
config.window_close_confirmation = 'NeverPrompt'
return config

Expected Behavior

Print the lldb output on a separate line, before giving the next (lldb) prompt.

Logs

wezterm version: 20240520-135708-b8f94c47 aarch64-apple-darwin Window Environment: macOS 14.5 (23F79) Lua Version: Lua 5.4 OpenGL: Apple M2 4.1 Metal - 88.1

Anything else?

No response

artagnon commented 4 months ago

This seems to be a regression in the latest version of lldb, or a bug in the printer, and I'm able to reproduce the issue on iTerm. Sorry for the noise.

github-actions[bot] commented 3 months ago

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.