]> git.eshelyaron.com Git - emacs.git/commitdiff
Add support for dropping plain text on Haiku
authorPo Lu <luangruo@yahoo.com>
Wed, 16 Mar 2022 13:24:18 +0000 (13:24 +0000)
committerPo Lu <luangruo@yahoo.com>
Wed, 16 Mar 2022 13:28:53 +0000 (13:28 +0000)
* haiku-win.el (haiku-dnd-handle-drag-n-drop-event): Handle
`text/plain'.

lisp/term/haiku-win.el

index 322f1a18de66e89f34d2f249e3b67934391da078..3b3f2f0874e8f8fe7c2b4b6dffad93cb20498c0b 100644 (file)
@@ -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)