Skip to content

Commit 90dfc87

Browse files
committed
fix: add null safety for tmux pane id handling
Tmux pane ID can be nil when inside of floating pane
1 parent b646e89 commit 90dfc87

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

lua/tmux/layout/init.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ function M.is_border(direction)
7272

7373
local display = tmux.get_window_layout()
7474
local id = tmux.get_current_pane_id()
75-
local result = check_is_border(display, id, direction)
75+
local result = id and check_is_border(display, id, direction)
7676

7777
log.debug("is_border > ", result or "false")
7878

lua/tmux/wrapper/tmux.lua

+2-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ function M.get_buffer_names()
7575
end
7676

7777
function M.get_current_pane_id()
78-
return tonumber(get_tmux_pane():sub(2))
78+
local pane = get_tmux_pane()
79+
return pane and tonumber(pane:sub(2)) or nil
7980
end
8081

8182
function M.get_window_layout()

0 commit comments

Comments
 (0)