fix(tui): text selection is sometimes not cleared when click+release without dragging (#1993)
This commit is contained in:
@@ -134,15 +134,18 @@ func (m *messagesComponent) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
case tea.MouseReleaseMsg:
|
case tea.MouseReleaseMsg:
|
||||||
if m.selection != nil && len(m.clipboard) > 0 {
|
if m.selection != nil {
|
||||||
content := strings.Join(m.clipboard, "\n")
|
|
||||||
m.selection = nil
|
m.selection = nil
|
||||||
m.clipboard = []string{}
|
if len(m.clipboard) > 0 {
|
||||||
return m, tea.Sequence(
|
content := strings.Join(m.clipboard, "\n")
|
||||||
m.renderView(),
|
m.clipboard = []string{}
|
||||||
app.SetClipboard(content),
|
return m, tea.Sequence(
|
||||||
toast.NewSuccessToast("Copied to clipboard"),
|
m.renderView(),
|
||||||
)
|
app.SetClipboard(content),
|
||||||
|
toast.NewSuccessToast("Copied to clipboard"),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
return m, m.renderView()
|
||||||
}
|
}
|
||||||
case tea.WindowSizeMsg:
|
case tea.WindowSizeMsg:
|
||||||
effectiveWidth := msg.Width - 4
|
effectiveWidth := msg.Width - 4
|
||||||
|
|||||||
Reference in New Issue
Block a user