From 57c030d3b99aa0fa1d7c2e92b41601171a575391 Mon Sep 17 00:00:00 2001 From: CaptainMcClellan Date: Thu, 2 Mar 2017 11:27:49 -0600 Subject: [PATCH] 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. --- cmd/micro/tab.go | 5 ++++- cmd/micro/view.go | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/cmd/micro/tab.go b/cmd/micro/tab.go index bbdd7eb0..be1f364f 100644 --- a/cmd/micro/tab.go +++ b/cmd/micro/tab.go @@ -2,6 +2,7 @@ package main import ( "sort" + "path/filepath" "github.com/zyedidia/tcell" ) @@ -89,7 +90,9 @@ func TabbarString() (string, map[int]int) { } else { 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 { str += "]" } else { diff --git a/cmd/micro/view.go b/cmd/micro/view.go index 1c3b42ba..10e724ce 100644 --- a/cmd/micro/view.go +++ b/cmd/micro/view.go @@ -976,6 +976,8 @@ func (v *View) DisplayCursor(x, y int) { // Display renders the view, the cursor, and statusline func (v *View) Display() { + //Set title to the name of the current buffer + screen.SetTitle("micro: " + v.Buf.GetName()) v.DisplayView() // 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() {