diff --git a/config/config.go b/config/config.go index 9a3de04..243bfe1 100644 --- a/config/config.go +++ b/config/config.go @@ -52,6 +52,7 @@ type UserPreferences struct { DisableDownloads bool `yaml:"disable_downloads"` DisableNotifications bool `yaml:"disable_notifications"` DisableShowURLs bool `yaml:"disable_show_urls"` + NewLineByDefault bool `yaml:"new_line_by_default"` } // Config contains the main config of gomuks. diff --git a/ui/commands.go b/ui/commands.go index 5006147..49770a2 100644 --- a/ui/commands.go +++ b/ui/commands.go @@ -699,6 +699,7 @@ var toggleMsg = map[string]ToggleMessage{ "notifications": SimpleToggleMessage("desktop notifications"), "unverified": SimpleToggleMessage("sending messages to unverified devices"), "showurls": SimpleToggleMessage("show URLs in text format"), + "newline": SimpleToggleMessage("use to create new line and to send"), } func makeUsage() string { @@ -743,6 +744,8 @@ func cmdToggle(cmd *Command) { val = &cmd.Config.SendToVerifiedOnly case "showurls": val = &cmd.Config.Preferences.DisableShowURLs + case "newline": + val = &cmd.Config.Preferences.NewLineByDefault default: cmd.Reply("Unknown toggle %s. Use /toggle without arguments for a list of togglable things.", thing) return diff --git a/ui/room-view.go b/ui/room-view.go index c3d14f9..9098826 100644 --- a/ui/room-view.go +++ b/ui/room-view.go @@ -374,7 +374,7 @@ func (view *RoomView) OnKeyEvent(event mauview.KeyEvent) bool { msgView.AddScrollOffset(-msgView.Height() / 2) return true 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()) return true }