File tree Expand file tree Collapse file tree
pkg/tui/components/messages Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -859,6 +859,14 @@ func (m *model) extractSelectedText() string {
859859 var lineText string
860860 switch i {
861861 case startLine :
862+ if startLine == endLine {
863+ startIdx := displayWidthToRuneIndex (line , startCol )
864+ endIdx := min (displayWidthToRuneIndex (line , endCol ), len (runes ))
865+ if startIdx < len (runes ) && startIdx < endIdx {
866+ lineText = strings .TrimSpace (string (runes [startIdx :endIdx ]))
867+ }
868+ break
869+ }
862870 // First line: from startCol to end
863871 startIdx := displayWidthToRuneIndex (line , startCol )
864872 if startIdx < len (runes ) {
@@ -888,7 +896,7 @@ func (m *model) copySelectionToClipboard() tea.Cmd {
888896 return nil
889897 }
890898
891- selectedText := m .extractSelectedText ()
899+ selectedText := strings . TrimSpace ( m .extractSelectedText () )
892900 if selectedText == "" {
893901 return nil
894902 }
You can’t perform that action at this time.
0 commit comments