summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPo Lu <luangruo@yahoo.com>2022-03-16 13:24:18 +0000
committerPo Lu <luangruo@yahoo.com>2022-03-16 13:28:53 +0000
commit79f3d9c8f317113b03de094f7989352724621154 (patch)
treef35005e9275e2032218179b2a9991ef1fd90f137
parent3de3f12b9402c731aca1a583a15fc6245efea136 (diff)
downloademacs-79f3d9c8f317113b03de094f7989352724621154.tar.gz
Add support for dropping plain text on Haiku
* haiku-win.el (haiku-dnd-handle-drag-n-drop-event): Handle `text/plain'.
-rw-r--r--lisp/term/haiku-win.el11
1 files changed, 10 insertions, 1 deletions
diff --git a/lisp/term/haiku-win.el b/lisp/term/haiku-win.el
index 322f1a18de6..3b3f2f0874e 100644
--- a/lisp/term/haiku-win.el
+++ b/lisp/term/haiku-win.el
@@ -137,7 +137,16 @@ If TYPE is nil, return \"text/plain\"."
(dolist (filename (cddr (assoc "refs" string)))
(dnd-handle-one-url window 'private
(concat "file:" filename)))))
- (t (message "Don't know how to drop: %s" event)))))
+ ((assoc "text/plain" string)
+ (with-selected-window window
+ (raise-frame)
+ (dolist (text (cddr (assoc "text/plain" string)))
+ (goto-char (posn-point (event-start event)))
+ (dnd-insert-text window 'private
+ (if (multibyte-string-p text)
+ text
+ (decode-coding-string text 'undecided))))))
+ (t (message "Don't know how to drop any of: %s" (mapcar #'car string))))))
(define-key special-event-map [drag-n-drop]
'haiku-dnd-handle-drag-n-drop-event)