~taiite/public-inbox

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
1

[PATCH senpai] Make mouse support optional

Details
Message ID
<20210427182235.9995-1-yyp@disroot.org>
DKIM signature
pass
Download raw message
Patch: +14 -1
To not break existing users, mouse is enabled by default but you have an
option to disable it with "mouse: false" in your
/.confg/senpai/senpai.yaml.
---
 app.go           | 6 ++++++
 config.go        | 1 +
 doc/senpai.5.scd | 3 +++
 ui/ui.go         | 5 ++++-
 4 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/app.go b/app.go
index 650a4d8..5a57c01 100644
--- a/app.go
+++ b/app.go
@@ -52,12 +52,18 @@ func NewApp(cfg Config) (app *App, err error) {
		}
	}

	mouse := true
	if cfg.Mouse != nil {
		mouse = *cfg.Mouse
	}

	app.win, err = ui.New(ui.Config{
		NickColWidth: cfg.NickColWidth,
		ChanColWidth: cfg.ChanColWidth,
		AutoComplete: func(cursorIdx int, text []rune) []ui.Completion {
			return app.completions(cursorIdx, text)
		},
		Mouse: mouse,
	})
	if err != nil {
		return
diff --git a/config.go b/config.go
index dde65de..fcd4cc3 100644
--- a/config.go
+++ b/config.go
@@ -16,6 +16,7 @@ type Config struct {
	NoTLS    bool `yaml:"no-tls"`

	NoTypings bool `yaml:"no-typings"`
	Mouse     *bool

	Highlights   []string
	OnHighlight  string `yaml:"on-highlight"`
diff --git a/doc/senpai.5.scd b/doc/senpai.5.scd
index b0d27ec..1218f73 100644
--- a/doc/senpai.5.scd
+++ b/doc/senpai.5.scd
@@ -68,6 +68,9 @@ Some settings are required, the others are optional.
	Prevent senpai from sending typing notifications which let others know when
	you are typing a message.  Defaults to false.

*mouse*
	Enable or disable mouse support.  Defaults to true.

*debug*
	Dump all sent and received data to the home buffer, useful for debugging.
	By default, false.
diff --git a/ui/ui.go b/ui/ui.go
index 86608d1..9f730a3 100644
--- a/ui/ui.go
+++ b/ui/ui.go
@@ -12,6 +12,7 @@ type Config struct {
	NickColWidth int
	ChanColWidth int
	AutoComplete func(cursorIdx int, text []rune) []Completion
	Mouse bool
}

type UI struct {
@@ -40,7 +41,9 @@ func New(config Config) (ui *UI, err error) {
	if err != nil {
		return
	}
	ui.screen.EnableMouse()
	if ui.screen.HasMouse() && config.Mouse {
		ui.screen.EnableMouse()
	}
	ui.screen.EnablePaste()

	w, h := ui.screen.Size()
-- 
2.31.1
Details
Message ID
<20210428102515.20dc4c63@vroom.localdomain>
In-Reply-To
<20210427182235.9995-1-yyp@disroot.org> (view parent)
DKIM signature
pass
Download raw message
On Tue, 27 Apr 2021 21:22:35 +0300, Alexey Yerin wrote:
> To not break existing users, mouse is enabled by default but you have
> an option to disable it with "mouse: false" in your
> /.confg/senpai/senpai.yaml.

Thanks, at some point when most options are laid off the config will
need some kind of cleanup (eg. to use emersion's scfg instead of
yaml, and to make options consistent) and defaults will be modifiable.
Reply to thread Export thread (mbox)