]> git.lizzy.rs Git - micro.git/blobdiff - cmd/micro/statusline.go
Rename to tabstospaces for consistency
[micro.git] / cmd / micro / statusline.go
index f02d499f9d960828b1723dd25580e1712195a12a..10ec08196e4ff0e80dd5abb3677c3161ee55afc9 100644 (file)
@@ -17,14 +17,14 @@ func (sline *Statusline) Display() {
        // We'll draw the line at the lowest line in the view
        y := sline.view.height
 
-       file := sline.view.buf.name
+       file := sline.view.Buf.Name
        // If the name is empty, use 'No name'
        if file == "" {
                file = "No name"
        }
 
        // If the buffer is dirty (has been modified) write a little '+'
-       if sline.view.buf.IsDirty() {
+       if sline.view.Buf.IsModified {
                file += " +"
        }
 
@@ -32,15 +32,18 @@ func (sline *Statusline) Display() {
        // but users will be used to (1,1) (first line,first column)
        // We use GetVisualX() here because otherwise we get the column number in runes
        // so a '\t' is only 1, when it should be tabSize
-       columnNum := strconv.Itoa(sline.view.cursor.GetVisualX() + 1)
-       lineNum := strconv.Itoa(sline.view.cursor.y + 1)
+       columnNum := strconv.Itoa(sline.view.Cursor.GetVisualX() + 1)
+       lineNum := strconv.Itoa(sline.view.Cursor.y + 1)
 
        file += " (" + lineNum + "," + columnNum + ")"
 
        // Add the filetype
-       file += " " + sline.view.buf.filetype
+       file += " " + sline.view.Buf.FileType
 
-       centerText := "Press Ctrl-h for help"
+       rightText := "Ctrl-g for help "
+       if helpOpen {
+               rightText = "Ctrl-g to close help "
+       }
 
        statusLineStyle := defStyle.Reverse(true)
        if style, ok := colorscheme["statusline"]; ok {
@@ -52,8 +55,8 @@ func (sline *Statusline) Display() {
        for x := 0; x < sline.view.width; x++ {
                if x < len(fileRunes) {
                        screen.SetContent(x, y, fileRunes[x], nil, statusLineStyle)
-               } else if x >= sline.view.width/2-len(centerText)/2 && x < len(centerText)+sline.view.width/2-len(centerText)/2 {
-                       screen.SetContent(x, y, []rune(centerText)[x-sline.view.width/2+len(centerText)/2], nil, statusLineStyle)
+               } else if x >= sline.view.width-len(rightText) && x < len(rightText)+sline.view.width-len(rightText) {
+                       screen.SetContent(x, y, []rune(rightText)[x-sline.view.width+len(rightText)], nil, statusLineStyle)
                } else {
                        screen.SetContent(x, y, ' ', nil, statusLineStyle)
                }