Add NewLineByDefault toggle
This commit is contained in:
parent
b7966b5d4e
commit
69bbdd0a1b
@ -52,6 +52,7 @@ type UserPreferences struct {
|
|||||||
DisableDownloads bool `yaml:"disable_downloads"`
|
DisableDownloads bool `yaml:"disable_downloads"`
|
||||||
DisableNotifications bool `yaml:"disable_notifications"`
|
DisableNotifications bool `yaml:"disable_notifications"`
|
||||||
DisableShowURLs bool `yaml:"disable_show_urls"`
|
DisableShowURLs bool `yaml:"disable_show_urls"`
|
||||||
|
NewLineByDefault bool `yaml:"new_line_by_default"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Config contains the main config of gomuks.
|
// Config contains the main config of gomuks.
|
||||||
|
@ -699,6 +699,7 @@ var toggleMsg = map[string]ToggleMessage{
|
|||||||
"notifications": SimpleToggleMessage("desktop notifications"),
|
"notifications": SimpleToggleMessage("desktop notifications"),
|
||||||
"unverified": SimpleToggleMessage("sending messages to unverified devices"),
|
"unverified": SimpleToggleMessage("sending messages to unverified devices"),
|
||||||
"showurls": SimpleToggleMessage("show URLs in text format"),
|
"showurls": SimpleToggleMessage("show URLs in text format"),
|
||||||
|
"newline": SimpleToggleMessage("use <enter> to create new line and <alt+enter> to send"),
|
||||||
}
|
}
|
||||||
|
|
||||||
func makeUsage() string {
|
func makeUsage() string {
|
||||||
@ -743,6 +744,8 @@ func cmdToggle(cmd *Command) {
|
|||||||
val = &cmd.Config.SendToVerifiedOnly
|
val = &cmd.Config.SendToVerifiedOnly
|
||||||
case "showurls":
|
case "showurls":
|
||||||
val = &cmd.Config.Preferences.DisableShowURLs
|
val = &cmd.Config.Preferences.DisableShowURLs
|
||||||
|
case "newline":
|
||||||
|
val = &cmd.Config.Preferences.NewLineByDefault
|
||||||
default:
|
default:
|
||||||
cmd.Reply("Unknown toggle %s. Use /toggle without arguments for a list of togglable things.", thing)
|
cmd.Reply("Unknown toggle %s. Use /toggle without arguments for a list of togglable things.", thing)
|
||||||
return
|
return
|
||||||
|
@ -374,7 +374,7 @@ func (view *RoomView) OnKeyEvent(event mauview.KeyEvent) bool {
|
|||||||
msgView.AddScrollOffset(-msgView.Height() / 2)
|
msgView.AddScrollOffset(-msgView.Height() / 2)
|
||||||
return true
|
return true
|
||||||
case tcell.KeyEnter:
|
case tcell.KeyEnter:
|
||||||
if event.Modifiers()&tcell.ModShift == 0 && event.Modifiers()&tcell.ModCtrl == 0 {
|
if (event.Modifiers()&tcell.ModShift == 0 && event.Modifiers()&tcell.ModCtrl == 0) == (view.config.Preferences.NewLineByDefault) {
|
||||||
view.InputSubmit(view.input.GetText())
|
view.InputSubmit(view.input.GetText())
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user