fix: Fix creating manual windows

master
Ivan 2 years ago committed by GitHub
parent 5d4e5488aa
commit 1f039b175e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -198,7 +198,7 @@ func (smug Smug) Start(config *Config, options *Options, context Context) error
}
}
if !options.InsideCurrentSession {
if !options.InsideCurrentSession && !sessionExists {
err := smug.tmux.KillWindow(sessionName + defaultWindowName)
if err != nil {
return err
@ -209,8 +209,13 @@ func (smug Smug) Start(config *Config, options *Options, context Context) error
}
}
if len(windows) == 0 && len(config.Windows) > 0 && !options.Detach {
return smug.switchOrAttach(sessionName+config.Windows[0].Name, attach, context.InsideTmuxSession)
if len(config.Windows) > 0 && !options.Detach {
w := config.Windows[0].Name
if len(options.Windows) > 0 {
w = options.Windows[0]
}
return smug.switchOrAttach(sessionName+w, attach, context.InsideTmuxSession)
}
return nil

@ -151,6 +151,7 @@ var testTable = map[string]struct {
"tmux select-layout -t xyz even-horizontal",
"tmux kill-window -t ses:smug_def",
"tmux move-window -r -s ses: -t ses:",
"tmux attach -d -t ses:win2",
},
[]string{
"tmux kill-window -t ses:win2",

Loading…
Cancel
Save