[PATCH senpai 1/3] Press Ctrl-C twice on blank input to quit
Export this patch
---
app.go | 7 +++++++
doc/senpai.1.scd | 1 +
2 files changed, 8 insertions(+)
diff --git a/app.go b/app.go
index 1144560..5973986 100644
--- a/app.go
+++ b/app.go
@@ -97,6 +97,7 @@ type App struct {
lastMessageTime time.Time
lastCloseTime time.Time
+ lastCtrlC time.Time
}
func NewApp(cfg Config) (app *App, err error) {
@@ -439,6 +440,12 @@ func (app *App) handleKeyEvent(ev *tcell.EventKey) {
case tcell.KeyCtrlC:
if app.win.InputClear() {
app.typing()
+ } else {
+ now := time.Now()
+ if now.Sub(app.lastCtrlC) < time.Second/2 {
+ commandDoQuit(app, []string{"ctrl-c"})
+ }
+ app.lastCtrlC = now
}
case tcell.KeyCtrlL:
app.win.Resize()
diff --git a/doc/senpai.1.scd b/doc/senpai.1.scd
index 76fee8a..8ff0d18 100644
--- a/doc/senpai.1.scd
+++ b/doc/senpai.1.scd
@@ -67,6 +67,7 @@ of messages are in the timeline:
*CTRL-C*
Clear input line.
+ Double tap on blank to quit.
*CTRL-U*, *PgUp*
Go up in the timeline.
--
2.30.2
[PATCH senpai 2/3] Make Ctrl-] toggle the member list, Ctrl-\ the channel list
Export this patch
---
app.go | 20 ++++++++++++++++++++
doc/senpai.1.scd | 6 ++++++
ui/ui.go | 4 ++++
3 files changed, 30 insertions(+)
diff --git a/app.go b/app.go
index 5973986..ccab3b5 100644
--- a/app.go
+++ b/app.go
@@ -521,6 +521,26 @@ func (app *App) handleKeyEvent(ev *tcell.EventKey) {
if ok {
app.typing()
}
+ case tcell.KeyCtrlRightSq:
+ if app.cfg.MemberColWidth == 0 {
+ app.cfg.MemberColWidth = 16
+ }
+ if app.win.Config().MemberColWidth == app.cfg.MemberColWidth {
+ app.win.Config().MemberColWidth = 0
+ } else {
+ app.win.Config().MemberColWidth = app.cfg.MemberColWidth
+ }
+ app.win.Resize()
+ case tcell.KeyCtrlBackslash:
+ if app.cfg.ChanColWidth == 0 {
+ app.cfg.ChanColWidth = 16
+ }
+ if app.win.Config().ChanColWidth == app.cfg.ChanColWidth {
+ app.win.Config().ChanColWidth = 0
+ } else {
+ app.win.Config().ChanColWidth = app.cfg.ChanColWidth
+ }
+ app.win.Resize()
case tcell.KeyBacktab:
ok := app.win.InputAutoComplete(-1)
if ok {
diff --git a/doc/senpai.1.scd b/doc/senpai.1.scd
index 8ff0d18..6014b17 100644
--- a/doc/senpai.1.scd
+++ b/doc/senpai.1.scd
@@ -107,6 +107,12 @@ of messages are in the timeline:
Trigger the auto-completion. Press several times to cycle through
completions.
+ *CTRL-]*
+ Show / hide the member list.
+
+ *CTRL-\\*
+ Toggle the channel list (column vs row mode).
+
*CTRL-L*
Refresh the window.
diff --git a/ui/ui.go b/ui/ui.go
index 7e02812..492411d 100644
--- a/ui/ui.go
+++ b/ui/ui.go
@@ -78,6 +78,10 @@ func New(config Config) (ui *UI, err error) {
return
}
+ func (ui *UI) Config() *Config {
+ return &ui.config
+ }
+
func (ui *UI) ShouldExit() bool {
return ui.exit.Load().(bool)
}
--
2.30.2
[PATCH senpai 3/3] Switch channels when click-dragging the channel column
Export this patch
---
app.go | 1 +
1 file changed, 1 insertion(+)
diff --git a/app.go b/app.go
index ccab3b5..84ba273 100644
--- a/app.go
+++ b/app.go
@@ -424,6 +424,7 @@ func (app *App) handleMouseEvent(ev *tcell.EventMouse) {
}
if ev.Buttons()&tcell.ButtonPrimary != 0 && x < app.cfg.ChanColWidth {
app.win.ClickBuffer(y + app.win.ChannelOffset())
+ app.win.GoToBufferNo(y + app.win.ChannelOffset())
}
if ev.Buttons() == 0 {
if x < app.cfg.ChanColWidth {
--
2.30.2