diff --git a/COMMANDS.md b/COMMANDS.md index ac670af..6da9ca7 100644 Binary files a/COMMANDS.md and b/COMMANDS.md differ diff --git a/actions/defaults/defaultactions.go b/actions/defaults/defaultactions.go index 7097dc3..28f406e 100644 --- a/actions/defaults/defaultactions.go +++ b/actions/defaults/defaultactions.go @@ -43,6 +43,7 @@ func init() { actions.RegisterAction("SaveOrQuit", SaveOrExit) actions.RegisterAction("Paste", Paste) actions.RegisterAction("ResetTagline", ResetTagline) + actions.RegisterAction("Tagline", Tagline) // Change the renderer by name actions.RegisterAction("Renderer", SwitchRenderer) @@ -105,6 +106,10 @@ func ResetTagline(args string, buff *demodel.CharBuffer, v demodel.Viewport) { buff.ResetTagline() } +func Tagline(args string, buff *demodel.CharBuffer, v demodel.Viewport) { + buff.SetTagline(args) +} + func SwitchRenderer(args string, buff *demodel.CharBuffer, v demodel.Viewport) { r := renderer.GetNamedRenderer(args) if r == nil || v == nil { diff --git a/demodel/charbuffer.go b/demodel/charbuffer.go index d51ca1e..5a809f9 100644 --- a/demodel/charbuffer.go +++ b/demodel/charbuffer.go @@ -27,6 +27,14 @@ func (c *CharBuffer) ResetTagline() error { return nil } +func (c *CharBuffer) SetTagline(val string) error { + c.Tagline = &CharBuffer{Buffer: []byte(c.Filename)} + c.AppendTag(" | " + val) + c.Tagline.Dot.Start = uint(len(c.Tagline.Buffer)) + c.Tagline.Dot.End = c.Tagline.Dot.Start + return nil +} + func getSnarfSaveDir() string { u, err := user.Current() if err != nil {