From da03aa355f6c1c74cb8f50b62ac8cb03934c1ff5 Mon Sep 17 00:00:00 2001 From: Alexey Yerin Date: Tue, 16 Feb 2021 13:39:53 +0300 Subject: [PATCH] Add option to quote when replying --- config.example.ini | 4 ++++ config.go | 3 +++ messagebox.go | 10 ++++++++++ 3 files changed, 17 insertions(+) diff --git a/config.example.ini b/config.example.ini index 5833e2b..c5a3bc7 100644 --- a/config.example.ini +++ b/config.example.ini @@ -49,6 +49,10 @@ timeline=home # default=true notification-feed=true +# If you want to quote original message when replying +# default=false +quote-reply=false + [media] # Your image viewer # default=xdg-open diff --git a/config.go b/config.go index 72cbc57..20ea47d 100644 --- a/config.go +++ b/config.go @@ -23,6 +23,7 @@ type GeneralConfig struct { DateRelative int StartTimeline TimelineType NotificationFeed bool + QuoteReply bool } type StyleConfig struct { @@ -189,6 +190,8 @@ func parseGeneral(cfg *ini.File) GeneralConfig { general.NotificationFeed = cfg.Section("general").Key("notification-feed").MustBool(true) + general.QuoteReply = cfg.Section("general").Key("quote-reply").MustBool(false) + return general } diff --git a/messagebox.go b/messagebox.go index d482f26..e1a5107 100644 --- a/messagebox.go +++ b/messagebox.go @@ -220,6 +220,16 @@ func (m *MessageBox) EditText() { users = append(users, "@"+men.Acct) } t = strings.Join(users, " ") + + if m.app.Config.General.QuoteReply { + tootText, _ := cleanTootHTML(s.Content) + + t += "\n" + for _, line := range strings.Split(tootText, "\n") { + t += "> " + line + "\n" + } + t += "\n" + } } text, err := openEditor(m.app.UI.Root, t) if err != nil {