| 1 |
package state |
| 2 |
|
| 3 |
import ( |
| 4 |
"strings" |
| 5 |
|
| 6 |
"git.sr.ht/~rjarry/aerc/config" |
| 7 |
) |
| 8 |
|
| 9 |
type texterInterface interface { |
| 10 |
Connected() string |
| 11 |
Disconnected() string |
| 12 |
Passthrough() string |
| 13 |
Sorting() string |
| 14 |
Threading() string |
| 15 |
Visual() string |
| 16 |
FormatFilter(string) string |
| 17 |
FormatSearch(string) string |
| 18 |
} |
| 19 |
|
| 20 |
type text struct{} |
| 21 |
|
| 22 |
var txt text |
| 23 |
|
| 24 |
func (t text) Connected() string { |
| 25 |
return "Connected" |
| 26 |
} |
| 27 |
|
| 28 |
func (t text) Disconnected() string { |
| 29 |
return "Disconnected" |
| 30 |
} |
| 31 |
|
| 32 |
func (t text) Passthrough() string { |
| 33 |
return "passthrough" |
| 34 |
} |
| 35 |
|
| 36 |
func (t text) Sorting() string { |
| 37 |
return "sorting" |
| 38 |
} |
| 39 |
|
| 40 |
func (t text) Threading() string { |
| 41 |
return "threading" |
| 42 |
} |
| 43 |
|
| 44 |
func (t text) Visual() string { |
| 45 |
return "visual" |
| 46 |
} |
| 47 |
|
| 48 |
func (t text) FormatFilter(s string) string { |
| 49 |
return s |
| 50 |
} |
| 51 |
|
| 52 |
func (t text) FormatSearch(s string) string { |
| 53 |
return s |
| 54 |
} |
| 55 |
|
| 56 |
type icon struct{} |
| 57 |
|
| 58 |
var icn icon |
| 59 |
|
| 60 |
func (i icon) Connected() string { |
| 61 |
return "โ" |
| 62 |
} |
| 63 |
|
| 64 |
func (i icon) Disconnected() string { |
| 65 |
return "โ" |
| 66 |
} |
| 67 |
|
| 68 |
func (i icon) Passthrough() string { |
| 69 |
return "โ" |
| 70 |
} |
| 71 |
|
| 72 |
func (i icon) Sorting() string { |
| 73 |
return "โ" |
| 74 |
} |
| 75 |
|
| 76 |
func (i icon) Threading() string { |
| 77 |
return "๐งต" |
| 78 |
} |
| 79 |
|
| 80 |
func (i icon) Visual() string { |
| 81 |
return "๐ถ" |
| 82 |
} |
| 83 |
|
| 84 |
func (i icon) FormatFilter(s string) string { |
| 85 |
return strings.ReplaceAll(s, "filter", "๐ฆ") |
| 86 |
} |
| 87 |
|
| 88 |
func (i icon) FormatSearch(s string) string { |
| 89 |
return strings.ReplaceAll(s, "search", "๐") |
| 90 |
} |
| 91 |
|
| 92 |
func texter() texterInterface { |
| 93 |
switch strings.ToLower(config.Statusline().DisplayMode) { |
| 94 |
case "icon": |
| 95 |
return &icn |
| 96 |
default: |
| 97 |
return &txt |
| 98 |
} |
| 99 |
} |