summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--aerc.go6
-rw-r--r--commands/msgview/close.go21
-rw-r--r--commands/msgview/msgview.go16
-rw-r--r--commands/terminal/close.go5
-rw-r--r--config/binds.conf2
-rw-r--r--widgets/aerc.go2
6 files changed, 47 insertions, 5 deletions
diff --git a/aerc.go b/aerc.go
index ebf5068..25a8de6 100644
--- a/aerc.go
+++ b/aerc.go
@@ -12,6 +12,7 @@ import (
 	"git.sr.ht/~sircmpwn/aerc2/config"
 	"git.sr.ht/~sircmpwn/aerc2/commands"
 	"git.sr.ht/~sircmpwn/aerc2/commands/account"
+	"git.sr.ht/~sircmpwn/aerc2/commands/msgview"
 	"git.sr.ht/~sircmpwn/aerc2/commands/terminal"
 	libui "git.sr.ht/~sircmpwn/aerc2/lib/ui"
 	"git.sr.ht/~sircmpwn/aerc2/widgets"
@@ -24,6 +25,11 @@ func getCommands(selected libui.Drawable) []*commands.Commands {
 			account.AccountCommands,
 			commands.GlobalCommands,
 		}
+	case *widgets.MessageViewer:
+		return []*commands.Commands{
+			msgview.MessageViewCommands,
+			commands.GlobalCommands,
+		}
 	case *widgets.Terminal:
 		return []*commands.Commands{
 			terminal.TerminalCommands,
diff --git a/commands/msgview/close.go b/commands/msgview/close.go
new file mode 100644
index 0000000..404bb1c
--- /dev/null
+++ b/commands/msgview/close.go
@@ -0,0 +1,21 @@
+package msgview
+
+import (
+	"errors"
+
+	"git.sr.ht/~sircmpwn/aerc2/widgets"
+)
+
+func init() {
+	register("close", CommandClose)
+}
+
+func CommandClose(aerc *widgets.Aerc, args []string) error {
+	if len(args) != 1 {
+		return errors.New("Usage: close")
+	}
+	mv, _ := aerc.SelectedTab().(*widgets.MessageViewer)
+	aerc.RemoveTab(mv)
+	return nil
+}
+
diff --git a/commands/msgview/msgview.go b/commands/msgview/msgview.go
new file mode 100644
index 0000000..e3db828
--- /dev/null
+++ b/commands/msgview/msgview.go
@@ -0,0 +1,16 @@
+package msgview
+
+import (
+	"git.sr.ht/~sircmpwn/aerc2/commands"
+)
+
+var (
+	MessageViewCommands *commands.Commands
+)
+
+func register(name string, cmd commands.AercCommand) {
+	if MessageViewCommands == nil {
+		MessageViewCommands = commands.NewCommands()
+	}
+	MessageViewCommands.Register(name, cmd)
+}
diff --git a/commands/terminal/close.go b/commands/terminal/close.go
index 0a9d100..aee7f3e 100644
--- a/commands/terminal/close.go
+++ b/commands/terminal/close.go
@@ -14,10 +14,7 @@ func CommandClose(aerc *widgets.Aerc, args []string) error {
 	if len(args) != 1 {
 		return errors.New("Usage: close")
 	}
-	term, ok := aerc.SelectedTab().(*widgets.Terminal)
-	if !ok {
-		return errors.New("Error: not a terminal")
-	}
+	term, _ := aerc.SelectedTab().(*widgets.Terminal)
 	term.Close(nil)
 	aerc.RemoveTab(term)
 	return nil
diff --git a/config/binds.conf b/config/binds.conf
index 2037cec..520c731 100644
--- a/config/binds.conf
+++ b/config/binds.conf
@@ -32,7 +32,7 @@ c = :cf<space>
 $ = :term<space>
 | = :pipe<space>
 
-[msgview]
+[view]
 q = :close<Enter>
 | = :pipe<space>
 r = :reply<Enter>
diff --git a/widgets/aerc.go b/widgets/aerc.go
index a36db23..781cb2b 100644
--- a/widgets/aerc.go
+++ b/widgets/aerc.go
@@ -93,6 +93,8 @@ func (aerc *Aerc) getBindings() *config.KeyBindings {
 	switch aerc.SelectedTab().(type) {
 	case *AccountView:
 		return aerc.conf.Bindings.MessageList
+	case *MessageViewer:
+		return aerc.conf.Bindings.MessageView
 	case *Terminal:
 		return aerc.conf.Bindings.Terminal
 	default:
-09-07 15:08:54 -0700 committer Kartik Agaram <vc@akkartik.com> 2018-09-07 15:08:54 -0700 4536' href='/akkartik/mu/commit/html/subx/examples/ex8.subx.html?h=hlt&id=608a7fa8d0faf9a3e3d182d9eabe969804443aab'>608a7fa8 ^
3350c34a ^
608a7fa8 ^
14a38052 ^
c56d803c ^
60338448 ^
3350c34a ^

c56d803c ^




33352536 ^


c56d803c ^
33352536 ^
608a7fa8 ^
a0d3cac4 ^
14a38052 ^


d1c9392a ^
695f9bf8 ^
b1635a5c ^
33352536 ^

695f9bf8 ^
33352536 ^
695f9bf8 ^
a0d3cac4 ^
695f9bf8 ^
33352536 ^
695f9bf8 ^
33352536 ^

3350c34a ^
a0d3cac4 ^
2104d1a7 ^
a0d3cac4 ^







c52ae116 ^
6070c23e ^
a0d3cac4 ^




4a4a392d ^
a0d3cac4 ^






608a7fa8 ^



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123