Added title setting (Requires tcell pull!) and optimized tab display. (#575)

* Added title setting (Requires tcell pull!) and optimized tab display.

* Changed tcell call to screen.

* Fixed bad reference for getting Buffer name.
This commit is contained in:
CaptainMcClellan
2017-03-02 11:27:49 -06:00
committed by Zachary Yedidia
parent 89acc703f5
commit 57c030d3b9
2 changed files with 6 additions and 1 deletions

View File

@@ -2,6 +2,7 @@ package main
import ( import (
"sort" "sort"
"path/filepath"
"github.com/zyedidia/tcell" "github.com/zyedidia/tcell"
) )
@@ -89,7 +90,9 @@ func TabbarString() (string, map[int]int) {
} else { } else {
str += " " str += " "
} }
str += t.views[t.CurView].Buf.GetName() //To address issue 556.2
_, name := filepath.Split(t.views[t.CurView].Buf.GetName())
str += name
if i == curTab { if i == curTab {
str += "]" str += "]"
} else { } else {

View File

@@ -976,6 +976,8 @@ func (v *View) DisplayCursor(x, y int) {
// Display renders the view, the cursor, and statusline // Display renders the view, the cursor, and statusline
func (v *View) Display() { func (v *View) Display() {
//Set title to the name of the current buffer
screen.SetTitle("micro: " + v.Buf.GetName())
v.DisplayView() v.DisplayView()
// Don't draw the cursor if it is out of the viewport or if it has a selection // Don't draw the cursor if it is out of the viewport or if it has a selection
if (v.Cursor.Y-v.Topline < 0 || v.Cursor.Y-v.Topline > v.Height-1) || v.Cursor.HasSelection() { if (v.Cursor.Y-v.Topline < 0 || v.Cursor.Y-v.Topline > v.Height-1) || v.Cursor.HasSelection() {