From 6af06c9dfec03e923589d34187ba8358e3423d5c Mon Sep 17 00:00:00 2001 From: Robin Jarry Date: Sun, 5 Feb 2023 23:23:02 +0100 Subject: statusline: move files to lib/state These modules will not handle statusline rendering after next commit. Move them in lib/state to make next commit easier to review. Signed-off-by: Robin Jarry Acked-by: Tim Culverhouse --- lib/state/texter.go | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 lib/state/texter.go (limited to 'lib/state/texter.go') diff --git a/lib/state/texter.go b/lib/state/texter.go new file mode 100644 index 00000000..21cf3627 --- /dev/null +++ b/lib/state/texter.go @@ -0,0 +1,73 @@ +package state + +import "strings" + +type Texter interface { + Connected() string + Disconnected() string + Passthrough() string + Sorting() string + Threading() string + FormatFilter(string) string + FormatSearch(string) string +} + +type text struct{} + +func (t text) Connected() string { + return "Connected" +} + +func (t text) Disconnected() string { + return "Disconnected" +} + +func (t text) Passthrough() string { + return "passthrough" +} + +func (t text) Sorting() string { + return "sorting" +} + +func (t text) Threading() string { + return "threading" +} + +func (t text) FormatFilter(s string) string { + return s +} + +func (t text) FormatSearch(s string) string { + return s +} + +type icon struct{} + +func (i icon) Connected() string { + return "โœ“" +} + +func (i icon) Disconnected() string { + return "โœ˜" +} + +func (i icon) Passthrough() string { + return "โž”" +} + +func (i icon) Sorting() string { + return "โš™" +} + +func (i icon) Threading() string { + return "๐Ÿงต" +} + +func (i icon) FormatFilter(s string) string { + return strings.ReplaceAll(s, "filter", "๐Ÿ”ฆ") +} + +func (i icon) FormatSearch(s string) string { + return strings.ReplaceAll(s, "search", "๐Ÿ”Ž") +} -- cgit