1
0
Fork 0

Implemented args passthrough for WM Close

This commit is contained in:
マリウス 2023-01-04 21:42:35 -05:00
parent 587bab0859
commit d0574d40e3
No known key found for this signature in database
GPG Key ID: 272ED814BF63261F
1 changed files with 2 additions and 2 deletions

View File

@ -62,12 +62,12 @@ func (wm *WM) CloseFocused() (bool, []tea.Cmd) {
return wm.Close(wm.Focused())
}
func (wm *WM) Close(id string) (bool, []tea.Cmd) {
func (wm *WM) Close(id string, args ...cmd.Arg) (bool, []tea.Cmd) {
var tcmds []tea.Cmd
for i := len(wm.stack) - 1; i >= 0; i-- {
if wm.stack[i].ID == id {
wm.stack = append(wm.stack[:i], wm.stack[i+1:]...)
tcmds = append(tcmds, cmd.New(cmd.WinClose, id).Tea())
tcmds = append(tcmds, cmd.New(cmd.WinClose, id, args...).Tea())
wm.ctx.Loading = false
nrOpen := wm.GetNumberOpen()