X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=cmd%2Fmicro%2Fstatusline.go;h=d346a033852e0fd4a370896fa2b6fdf0f61038aa;hb=71af765b4e4f368c4bbbcb3947f3497e17271b62;hp=e339cf194264175ef445e204f231f9778120a46a;hpb=c1db99a5a5f241584978f9fec89ee097bf2f2b5d;p=micro.git diff --git a/cmd/micro/statusline.go b/cmd/micro/statusline.go index e339cf19..d346a033 100644 --- a/cmd/micro/statusline.go +++ b/cmd/micro/statusline.go @@ -1,6 +1,7 @@ package main import ( + "path" "strconv" ) @@ -14,13 +15,20 @@ type Statusline struct { // Display draws the statusline to the screen func (sline *Statusline) Display() { + if messenger.hasPrompt && !GetGlobalOption("infobar").(bool) { + return + } + // We'll draw the line at the lowest line in the view y := sline.view.Height + sline.view.y file := sline.view.Buf.GetName() + if sline.view.Buf.Settings["basename"].(bool) { + file = path.Base(file) + } // If the buffer is dirty (has been modified) write a little '+' - if sline.view.Buf.IsModified { + if sline.view.Buf.Modified() { file += " +" } @@ -36,12 +44,28 @@ func (sline *Statusline) Display() { // Add the filetype file += " " + sline.view.Buf.FileType() + file += " " + sline.view.Buf.Settings["fileformat"].(string) + rightText := "" - if len(helpBinding) > 0 { - rightText = helpBinding + " for help " - if sline.view.Type == vtHelp { - rightText = helpBinding + " to close help " + if !sline.view.Buf.Settings["hidehelp"].(bool) { + if len(kmenuBinding) > 0 { + if globalSettings["keymenu"].(bool) { + rightText += kmenuBinding + ": hide bindings" + } else { + rightText += kmenuBinding + ": show bindings" + } } + if len(helpBinding) > 0 { + if len(kmenuBinding) > 0 { + rightText += ", " + } + if sline.view.Type == vtHelp { + rightText += helpBinding + ": close help" + } else { + rightText += helpBinding + ": open help" + } + } + rightText += " " } statusLineStyle := defStyle.Reverse(true) @@ -51,6 +75,12 @@ func (sline *Statusline) Display() { // Maybe there is a unicode filename? fileRunes := []rune(file) + + if sline.view.Type == vtTerm { + fileRunes = []rune(sline.view.term.title) + rightText = "" + } + viewX := sline.view.x if viewX != 0 { screen.SetContent(viewX, y, ' ', nil, statusLineStyle)