diff options
| author | adamdottv <[email protected]> | 2025-06-23 11:20:44 -0500 |
|---|---|---|
| committer | adamdottv <[email protected]> | 2025-06-23 11:20:44 -0500 |
| commit | 61f057337a30012a2e8e47a667f7b8ba02c0d033 (patch) | |
| tree | afd1a49eb3059429b436cf52a9ea47c994c13d10 | |
| parent | 0b261054a2bff8f1f8ccc15c7932069b009a2f51 (diff) | |
| download | opencode-61f057337a30012a2e8e47a667f7b8ba02c0d033.tar.gz opencode-61f057337a30012a2e8e47a667f7b8ba02c0d033.zip | |
fix: markdown wrapping issue
| -rw-r--r-- | packages/tui/internal/components/chat/message.go | 2 | ||||
| -rw-r--r-- | packages/tui/internal/tui/tui.go | 7 |
2 files changed, 7 insertions, 2 deletions
diff --git a/packages/tui/internal/components/chat/message.go b/packages/tui/internal/components/chat/message.go index 2142e1bb1..86ce25bdd 100644 --- a/packages/tui/internal/components/chat/message.go +++ b/packages/tui/internal/components/chat/message.go @@ -228,7 +228,7 @@ func renderText(message client.MessageInfo, text string, author string) string { textWidth := max(lipgloss.Width(text), lipgloss.Width(info)) markdownWidth := min(textWidth, width-padding-4) // -4 for the border and padding if message.Role == client.Assistant { - markdownWidth = width - padding - 4 + markdownWidth = width - padding - 4 - 2 } content := toMarkdown(text, markdownWidth, t.BackgroundPanel()) content = strings.Join([]string{content, info}, "\n") diff --git a/packages/tui/internal/tui/tui.go b/packages/tui/internal/tui/tui.go index 6e90b02af..68ce29a58 100644 --- a/packages/tui/internal/tui/tui.go +++ b/packages/tui/internal/tui/tui.go @@ -189,7 +189,7 @@ func (a appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) { updated, cmd := a.messages.Update(msg) a.messages = updated.(chat.MessagesComponent) cmds = append(cmds, cmd) - return a, tea.Batch(cmds...) + return a, tea.Batch(cmds...) case tea.BackgroundColorMsg: styles.Terminal = &styles.TerminalInfo{ BackgroundIsDark: msg.IsDark(), @@ -487,6 +487,11 @@ func (a appModel) executeCommand(command commands.Command) (tea.Model, tea.Cmd) a.editor = updated.(chat.EditorComponent) cmds = append(cmds, cmd) case commands.InputNewlineCommand: + cmds = append(cmds, toast.NewInfoToast("Press enter to submit")) + cmds = append(cmds, toast.NewWarningToast("Press shift+enter to submit and create a new line")) + cmds = append(cmds, toast.NewErrorToast("Press shift+enter to submit and create a new line")) + cmds = append(cmds, toast.NewSuccessToast("Press shift+enter to submit and create a new line")) + updated, cmd := a.editor.Newline() a.editor = updated.(chat.EditorComponent) cmds = append(cmds, cmd) |
