[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 79f3d9c8f3 2/2: Add support for dropping plain text on Haiku
From: |
Po Lu |
Subject: |
master 79f3d9c8f3 2/2: Add support for dropping plain text on Haiku |
Date: |
Wed, 16 Mar 2022 09:30:08 -0400 (EDT) |
branch: master
commit 79f3d9c8f317113b03de094f7989352724621154
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>
Add support for dropping plain text on Haiku
* haiku-win.el (haiku-dnd-handle-drag-n-drop-event): Handle
`text/plain'.
---
lisp/term/haiku-win.el | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/lisp/term/haiku-win.el b/lisp/term/haiku-win.el
index 322f1a18de..3b3f2f0874 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)