File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ All notable changes to this project will be documented in this file.
55## [ Unreleased]
66
77- Fix: Correctly center floating terminal when no borders are used.
8+ - Fix: Skip showing terminal if buffer is no longer valid or it doesn't exist.
89- Set terminal window as ` nolist ` .
910- Add ` fixed_height ` & ` fixed_width ` options to control whether terminal size should be preserved on new splits.
1011- Do not ignore wildcard patterns when expanding ` dir ` .
Original file line number Diff line number Diff line change 3434--- @param term Terminal
3535--- @param layout layout ?
3636function M .show (term , layout )
37- if not M .is_open (term ) then
37+ if not M .is_open (term ) and term . _state . bufnr and vim . api . nvim_buf_is_valid ( term . _state . bufnr ) then
3838 layout = layout or term ._state .layout
3939 local window = nil
4040 if vim .tbl_contains (NEW_WINDOW_LAYOUTS , layout ) then
Original file line number Diff line number Diff line change @@ -112,6 +112,18 @@ describe(".open", function()
112112 assert .equal (" right" , win_config .split )
113113 end )
114114
115+ it (" does nothing if buffer is missing" , function ()
116+ local term = Terminal :new ():start ()
117+ term :cleanup ()
118+
119+ local ok = pcall (function ()
120+ open .show (term )
121+ end )
122+
123+ assert .is_true (ok )
124+ assert .is_nil (term :get_state (" window" ))
125+ end )
126+
115127 it (" errors if layout is invalid" , function ()
116128 local term = Terminal :new ()
117129
You can’t perform that action at this time.
0 commit comments