aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
Diffstat (limited to 'config')
-rw-r--r--config/aerc.conf13
-rw-r--r--config/ui.go38
2 files changed, 51 insertions, 0 deletions
diff --git a/config/aerc.conf b/config/aerc.conf
index 51c73a8f..17b9d216 100644
--- a/config/aerc.conf
+++ b/config/aerc.conf
@@ -163,6 +163,19 @@
#sidebar-width=22
#
+# Default split layout for message list tabs. The syntax is:
+#
+# [<direction>] <size>
+#
+# <direction> is optional and defaults to horizontal. It can take one
+# of the following values: h, horiz, horizontal, v, vert, vertical.
+#
+# <size> is a positive integer representing the size (in terminal cells)
+# of the message list window.
+#
+#message-list-split=
+
+#
# Message to display when viewing an empty folder.
#
# Default: (no messages)
diff --git a/config/ui.go b/config/ui.go
index 8b10c8a8..a6034d46 100644
--- a/config/ui.go
+++ b/config/ui.go
@@ -5,6 +5,7 @@ import (
"math"
"path"
"regexp"
+ "strconv"
"text/template"
"time"
@@ -32,6 +33,7 @@ type UIConfig struct {
MessageViewThisYearTimeFormat string `ini:"message-view-this-year-time-format"`
PinnedTabMarker string "ini:\"pinned-tab-marker\" default:\"`\""
SidebarWidth int `ini:"sidebar-width" default:"22"`
+ MessageListSplit SplitParams `ini:"message-list-split" parse:"ParseSplit"`
EmptyMessage string `ini:"empty-message" default:"(no messages)"`
EmptyDirlist string `ini:"empty-dirlist" default:"(no folders)"`
EmptySubject string `ini:"empty-subject" default:"(no subject)"`
@@ -233,6 +235,42 @@ func (*UIConfig) ParseIndexColumns(section *ini.Section, key *ini.Key) ([]*Colum
return ParseColumnDefs(key, section)
}
+type SplitDirection int
+
+const (
+ SPLIT_NONE SplitDirection = iota
+ SPLIT_HORIZONTAL
+ SPLIT_VERTICAL
+)
+
+type SplitParams struct {
+ Direction SplitDirection
+ Size int
+}
+
+func (*UIConfig) ParseSplit(section *ini.Section, key *ini.Key) (p SplitParams, err error) {
+ re := regexp.MustCompile(`^\s*(v(?:ert(?:ical)?)?|h(?:oriz(?:ontal)?)?)?\s+(\d+)\s*$`)
+ match := re.FindStringSubmatch(key.String())
+ if len(match) != 3 {
+ err = fmt.Errorf("bad option value")
+ return
+ }
+ p.Direction = SPLIT_HORIZONTAL
+ switch match[1] {
+ case "v", "vert", "vertical":
+ p.Direction = SPLIT_VERTICAL
+ case "h", "horiz", "horizontal":
+ p.Direction = SPLIT_HORIZONTAL
+ }
+ size, e := strconv.ParseUint(match[2], 10, 32)
+ if e != nil {
+ err = e
+ return
+ }
+ p.Size = int(size)
+ return
+}
+
const MANUAL_COMPLETE = math.MaxInt
func (*UIConfig) ParseCompletionMinChars(section *ini.Section, key *ini.Key) (int, error) {