Browse Source

make char configurable

pull/45/head
Rasmus Lindroth 5 years ago
parent
commit
bfbca11619
  1. 7
      config.go
  2. 2
      main.go
  3. 9
      messagebox.go

7
config.go

@ -29,6 +29,7 @@ type GeneralConfig struct {
StartTimeline TimelineType
NotificationFeed bool
QuoteReply bool
CharLimit int
}
type StyleConfig struct {
@ -236,8 +237,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)
general.CharLimit = cfg.Section("general").Key("char-limit").MustInt(500)
return general
}
@ -462,6 +463,10 @@ notification-feed=true
# default=false
quote-reply=false
# If you're on an instance with a custom character limit you can set it here
# default=500
char-limit=500
[media]
# Your image viewer
# default=xdg-open

2
main.go

@ -9,7 +9,7 @@ import (
"github.com/gdamore/tcell/v2"
)
const version string = "0.0.24"
const version string = "0.0.25"
func main() {
newUser := false

9
messagebox.go

@ -114,13 +114,6 @@ func (m *MessageBox) Down() {
}
func (m *MessageBox) Post() {
charsLeft := m.TootLength()
if charsLeft < 0 {
m.app.UI.CmdBar.ShowError(fmt.Sprintf("Reached char limit, make your toot shorter. Length %d\n", charsLeft))
return
}
toot := m.currentToot
send := mastodon.Toot{
Status: strings.TrimSpace(toot.Text),
@ -172,7 +165,7 @@ func (m *MessageBox) TootLength() int {
if m.currentToot.Sensitive {
totalCount += spoilerCount
}
charsLeft := 500 - totalCount
charsLeft := m.app.Config.General.CharLimit - totalCount
return charsLeft
}

Loading…
Cancel
Save