File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -73,12 +73,14 @@ with a newline separator."
7373
7474(defun ai-code--get-clipboard-text ()
7575 " Return the current clipboard contents as a plain string, or nil if unavailable."
76- (let ((selection (when (fboundp 'gui-get-selection )
77- (or (gui-get-selection 'CLIPBOARD 'UTF8_STRING )
78- (gui-get-selection 'CLIPBOARD 'STRING ))))
79- (kill-text (condition-case nil
80- (current-kill 0 t )
81- (error nil ))))
76+ (let* ((selection (when (fboundp 'gui-get-selection )
77+ (or (let ((text (gui-get-selection 'CLIPBOARD 'UTF8_STRING )))
78+ (and (stringp text) (not (string-empty-p text)) text))
79+ (let ((text (gui-get-selection 'CLIPBOARD 'STRING )))
80+ (and (stringp text) (not (string-empty-p text)) text)))))
81+ (kill-text (condition-case nil
82+ (current-kill 0 t )
83+ (error nil ))))
8284 (let ((text (or selection kill-text)))
8385 (when (stringp text)
8486 (substring-no-properties text)))))
You can’t perform that action at this time.
0 commit comments