From bc42522f2958287f952145ae50b3e426b7b69e37 Mon Sep 17 00:00:00 2001 From: Petter Rodhelind Date: Fri, 5 Mar 2021 11:17:53 +0100 Subject: Only open 2-split if no file was given on startup. --- ui/tcell/tcell.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'ui/tcell/tcell.go') diff --git a/ui/tcell/tcell.go b/ui/tcell/tcell.go index e7c6009..9783a86 100644 --- a/ui/tcell/tcell.go +++ b/ui/tcell/tcell.go @@ -34,10 +34,6 @@ type Tcell struct{} func (t *Tcell) Init(e editor.Editor) error { ed = e - if ed.Len() == 0 { - ed.LoadBuffers([]string{"."}) - } - if err := initScreen(); err != nil { return err } @@ -50,6 +46,10 @@ func (t *Tcell) Init(e editor.Editor) error { return err } + if ed.Len() == 0 { + ed.LoadBuffers([]string{"."}) + } + if err := initWindows(); err != nil { return err } @@ -116,7 +116,9 @@ func initScreen() error { func initWorkspace() error { workspace = &Workspace{} // first resize event will set proper dimensions workspace.AddCol() - workspace.AddCol() + if ids, _ := ed.Buffers(); len(ids) == 0 { + workspace.AddCol() + } return nil } -- cgit v1.2.3