Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Noticable delay on split pane navigation #6436

Open
mister-choo opened this issue Nov 25, 2024 · 3 comments
Open

[Bug]: Noticable delay on split pane navigation #6436

mister-choo opened this issue Nov 25, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@mister-choo
Copy link

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

Linux X11

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

DE: GNOME 46.0
WM: Mutter

WezTerm version

wezterm 20241119-101432-4050072d

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

Navigating from nvim pane to wezterm pane happens with about 2 sec delay

To Reproduce

nvim config

local root = vim.fn.fnamemodify('./.repro', ':p')

-- set stdpaths to use .repro
for _, name in ipairs({ 'config', 'data', 'state', 'cache' }) do
  vim.env[('XDG_%s_HOME'):format(name:upper())] = root .. '/' .. name
end

-- bootstrap lazy
local lazypath = root .. '/plugins/lazy.nvim'
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({
    'git',
    'clone',
    '--filter=blob:none',
    '--single-branch',
    'https://github.com/folke/lazy.nvim.git',
    lazypath,
  })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  -- do not remove the colorscheme! it makes testing nicer
  'folke/tokyonight.nvim',
  'mrjones2014/smart-splits.nvim',
  -- add any other pugins here
}

require('lazy').setup(plugins, {
  root = root .. '/plugins',
})

require('smart-splits').setup({
  -- add any options here
})

vim.keymap.set('n', '<C-Left>', require('smart-splits').move_cursor_left)
vim.keymap.set('n', '<C-Down>', require('smart-splits').move_cursor_down)
vim.keymap.set('n', '<C-Up>', require('smart-splits').move_cursor_up)
vim.keymap.set('n', '<C-Right>', require('smart-splits').move_cursor_right)

-- add anything else here
vim.opt.termguicolors = true
-- do not remove the colorscheme! it makes testing nicer
vim.cmd([[colorscheme tokyonight]])

Configuration

wezterm config:

local wezterm = require 'wezterm'
local config = {}
if wezterm.config_builder then
    config = wezterm.config_builder()
end

local function is_vim(pane)
    return pane:get_user_vars().IS_NVIM == 'true'
    -- return false
end

local direction_keys = {
    LeftArrow = 'Left',
    DownArrow = 'Down',
    UpArrow = 'Up',
    RightArrow = 'Right',
}

config.leader = { key = "a", mods = "CTRL" }

local function split_nav(key)
    return {
        key = key,
        mods = 'CTRL',
        action = wezterm.action_callback(function(win, pane)
            if is_vim(pane) then
                win:perform_action({ SendKey = { key = key, mods = 'CTRL' }, }, pane)
            else
                win:perform_action({ ActivatePaneDirection = direction_keys[key] }, pane)
            end
        end),
    }
end

config.keys = {
    {
        key = "v",
        mods = "LEADER",
        action = wezterm.action { SplitHorizontal = {
            domain = "CurrentPaneDomain" } }
    },
    split_nav('LeftArrow'),
    split_nav('RightArrow'),
    split_nav('DownArrow'),
    split_nav('UpArrow'),
}

return config

Expected Behavior

Navigation from wezterm pane to nvim pane to take the same amount of time as from nvim pane to wezterm

Logs

There is no output

Anything else?

No response

@mister-choo mister-choo added the bug Something isn't working label Nov 25, 2024
@mister-choo mister-choo changed the title [Bug]: Noticable delay on split pane navigation[Bug]: Noticable delay on split pane navigation [Bug]: Noticable delay on split pane navigation Nov 25, 2024
@mister-choo
Copy link
Author

Made a good effort to find an existing issue, but looks like there isn't one. In smart-splits discussions on the topic it was suggested that some of the wezterm cli operations can be slow, which causes this.

@mister-choo
Copy link
Author

Investigated this some more and looks like it's a problem with fish:
$ time wezterm cli activate-pane-direction Right


Executed in 122.03 millis fish external
usr time 3.97 millis 439.00 micros 3.53 millis
sys time 13.34 millis 79.00 micros 13.26 millis

In different shells there isn't a delay and time command add some strange time which isn't usr or sys time

@mister-choo
Copy link
Author

After I fixed startup time on fish command started executing in more manageable 4 millis. Why could that be the case? It seems shell startup time affects the wezterm cli time, even if it was started as a subprocess

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant