aboutsummaryrefslogtreecommitdiffstats
path: root/config/config.go
diff options
context:
space:
mode:
authorBence Ferdinandy <bence@ferdinandy.com>2022-10-19 13:21:41 +0200
committerRobin Jarry <robin@jarry.cc>2022-10-19 20:27:58 +0200
commitc3bb3aa2a8908eaeb201a740fb12d70968cc3bac (patch)
tree44cb8ade5dcbd03077b8a461f236b16149a25c9f /config/config.go
parent6eed15c579017099c31d73821e70bc363e0fe7b8 (diff)
downloadaerc-c3bb3aa2a8908eaeb201a740fb12d70968cc3bac.tar.gz
msgview: add separate date formatting
The ThisDayTimeFormat and friends are missing from the message view which just uses the message list's default setting. This might not be desirable since the amount of space available is different. Introduce separate settings for formatting dates in the message view. Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com> Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'config/config.go')
-rw-r--r--config/config.go93
1 files changed, 55 insertions, 38 deletions
diff --git a/config/config.go b/config/config.go
index 0de1780c..8b8d9d21 100644
--- a/config/config.go
+++ b/config/config.go
@@ -33,44 +33,48 @@ type GeneralConfig struct {
}
type UIConfig struct {
- AutoMarkRead bool `ini:"auto-mark-read"`
- IndexFormat string `ini:"index-format"`
- TimestampFormat string `ini:"timestamp-format"`
- ThisDayTimeFormat string `ini:"this-day-time-format"`
- ThisWeekTimeFormat string `ini:"this-week-time-format"`
- ThisYearTimeFormat string `ini:"this-year-time-format"`
- ShowHeaders []string `delim:","`
- RenderAccountTabs string `ini:"render-account-tabs"`
- PinnedTabMarker string `ini:"pinned-tab-marker"`
- SidebarWidth int `ini:"sidebar-width"`
- PreviewHeight int `ini:"preview-height"`
- EmptyMessage string `ini:"empty-message"`
- EmptyDirlist string `ini:"empty-dirlist"`
- MouseEnabled bool `ini:"mouse-enabled"`
- ThreadingEnabled bool `ini:"threading-enabled"`
- ForceClientThreads bool `ini:"force-client-threads"`
- ClientThreadsDelay time.Duration `ini:"client-threads-delay"`
- FuzzyComplete bool `ini:"fuzzy-complete"`
- NewMessageBell bool `ini:"new-message-bell"`
- Spinner string `ini:"spinner"`
- SpinnerDelimiter string `ini:"spinner-delimiter"`
- IconUnencrypted string `ini:"icon-unencrypted"`
- IconEncrypted string `ini:"icon-encrypted"`
- IconSigned string `ini:"icon-signed"`
- IconSignedEncrypted string `ini:"icon-signed-encrypted"`
- IconUnknown string `ini:"icon-unknown"`
- IconInvalid string `ini:"icon-invalid"`
- DirListFormat string `ini:"dirlist-format"`
- DirListDelay time.Duration `ini:"dirlist-delay"`
- DirListTree bool `ini:"dirlist-tree"`
- DirListCollapse int `ini:"dirlist-collapse"`
- Sort []string `delim:" "`
- NextMessageOnDelete bool `ini:"next-message-on-delete"`
- CompletionDelay time.Duration `ini:"completion-delay"`
- CompletionPopovers bool `ini:"completion-popovers"`
- StyleSetDirs []string `ini:"stylesets-dirs" delim:":"`
- StyleSetName string `ini:"styleset-name"`
- style StyleSet
+ AutoMarkRead bool `ini:"auto-mark-read"`
+ IndexFormat string `ini:"index-format"`
+ TimestampFormat string `ini:"timestamp-format"`
+ ThisDayTimeFormat string `ini:"this-day-time-format"`
+ ThisWeekTimeFormat string `ini:"this-week-time-format"`
+ ThisYearTimeFormat string `ini:"this-year-time-format"`
+ MessageViewTimestampFormat string `ini:"message-view-timestamp-format"`
+ MessageViewThisDayTimeFormat string `ini:"message-view-this-day-time-format"`
+ MessageViewThisWeekTimeFormat string `ini:"message-view-this-week-time-format"`
+ MessageViewThisYearTimeFormat string `ini:"message-view-this-year-time-format"`
+ ShowHeaders []string `delim:","`
+ RenderAccountTabs string `ini:"render-account-tabs"`
+ PinnedTabMarker string `ini:"pinned-tab-marker"`
+ SidebarWidth int `ini:"sidebar-width"`
+ PreviewHeight int `ini:"preview-height"`
+ EmptyMessage string `ini:"empty-message"`
+ EmptyDirlist string `ini:"empty-dirlist"`
+ MouseEnabled bool `ini:"mouse-enabled"`
+ ThreadingEnabled bool `ini:"threading-enabled"`
+ ForceClientThreads bool `ini:"force-client-threads"`
+ ClientThreadsDelay time.Duration `ini:"client-threads-delay"`
+ FuzzyComplete bool `ini:"fuzzy-complete"`
+ NewMessageBell bool `ini:"new-message-bell"`
+ Spinner string `ini:"spinner"`
+ SpinnerDelimiter string `ini:"spinner-delimiter"`
+ IconUnencrypted string `ini:"icon-unencrypted"`
+ IconEncrypted string `ini:"icon-encrypted"`
+ IconSigned string `ini:"icon-signed"`
+ IconSignedEncrypted string `ini:"icon-signed-encrypted"`
+ IconUnknown string `ini:"icon-unknown"`
+ IconInvalid string `ini:"icon-invalid"`
+ DirListFormat string `ini:"dirlist-format"`
+ DirListDelay time.Duration `ini:"dirlist-delay"`
+ DirListTree bool `ini:"dirlist-tree"`
+ DirListCollapse int `ini:"dirlist-collapse"`
+ Sort []string `delim:" "`
+ NextMessageOnDelete bool `ini:"next-message-on-delete"`
+ CompletionDelay time.Duration `ini:"completion-delay"`
+ CompletionPopovers bool `ini:"completion-popovers"`
+ StyleSetDirs []string `ini:"stylesets-dirs" delim:":"`
+ StyleSetName string `ini:"styleset-name"`
+ style StyleSet
// customize border appearance
BorderCharVertical rune `ini:"-"`
BorderCharHorizontal rune `ini:"-"`
@@ -695,6 +699,19 @@ func parseUiConfig(section *ini.Section, config *UIConfig) error {
config.CompletionDelay = dur
}
+ if config.MessageViewTimestampFormat == "" {
+ config.MessageViewTimestampFormat = config.TimestampFormat
+ }
+ if config.MessageViewThisDayTimeFormat == "" {
+ config.MessageViewThisDayTimeFormat = config.TimestampFormat
+ }
+ if config.MessageViewThisWeekTimeFormat == "" {
+ config.MessageViewThisWeekTimeFormat = config.TimestampFormat
+ }
+ if config.MessageViewThisDayTimeFormat == "" {
+ config.MessageViewThisDayTimeFormat = config.TimestampFormat
+ }
+
return nil
}