diff options
| author | Po Lu | 2022-03-16 15:18:02 +0800 |
|---|---|---|
| committer | Po Lu | 2022-03-16 15:20:10 +0800 |
| commit | 47dcf72dec63b4b4b9cc3b8444bbbfcb85e31d3e (patch) | |
| tree | 7ffbd116b73d80b6a67d229045a74d241e3dd23c | |
| parent | b1c6d5f2b766914807b8ee82a498bb25f40ea475 (diff) | |
| download | emacs-47dcf72dec63b4b4b9cc3b8444bbbfcb85e31d3e.tar.gz emacs-47dcf72dec63b4b4b9cc3b8444bbbfcb85e31d3e.zip | |
Fix tooltip text properties showing up in dragged text
* lisp/mouse.el (mouse-drag-and-drop-region): Directly call
x-show-tip and x-hide-tip instead of going through tooltip-show.
| -rw-r--r-- | lisp/mouse.el | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/lisp/mouse.el b/lisp/mouse.el index b650bea1bde..4eead399252 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el | |||
| @@ -3097,12 +3097,28 @@ is copied instead of being cut." | |||
| 3097 | (frame-pixel-width frame)) | 3097 | (frame-pixel-width frame)) |
| 3098 | (> (cdr location) | 3098 | (> (cdr location) |
| 3099 | (frame-pixel-height frame))))) | 3099 | (frame-pixel-height frame))))) |
| 3100 | (tooltip-hide) | 3100 | (x-hide-tip) |
| 3101 | (gui-set-selection 'XdndSelection value-selection) | 3101 | (gui-set-selection 'XdndSelection value-selection) |
| 3102 | (when (framep | 3102 | (let ((drag-action-or-frame |
| 3103 | (x-begin-drag '("UTF8_STRING" "STRING") 'XdndActionCopy | 3103 | (x-begin-drag '("UTF8_STRING" "STRING") |
| 3104 | (posn-window (event-end event)) t)) | 3104 | (if mouse-drag-and-drop-region-cut-when-buffers-differ |
| 3105 | (throw 'drag-again nil)) | 3105 | 'XdndActionMove |
| 3106 | 'XdndActionCopy) | ||
| 3107 | (posn-window (event-end event)) t))) | ||
| 3108 | (when (framep drag-action-or-frame) | ||
| 3109 | (throw 'drag-again nil)) | ||
| 3110 | |||
| 3111 | (when (eq drag-action-or-frame 'XdndActionMove) | ||
| 3112 | ;; Remove the dragged text from source buffer like | ||
| 3113 | ;; operation `cut'. | ||
| 3114 | (dolist (overlay mouse-drag-and-drop-overlays) | ||
| 3115 | (delete-region (overlay-start overlay) | ||
| 3116 | (overlay-end overlay)))) | ||
| 3117 | |||
| 3118 | (when (eq drag-action-or-frame 'XdndActionCopy) | ||
| 3119 | ;; Set back the dragged text as region on source buffer | ||
| 3120 | ;; like operation `copy'. | ||
| 3121 | (activate-mark))) | ||
| 3106 | (throw 'cross-program-drag nil)) | 3122 | (throw 'cross-program-drag nil)) |
| 3107 | 3123 | ||
| 3108 | (setq window-to-paste (posn-window (event-end event))) | 3124 | (setq window-to-paste (posn-window (event-end event))) |
| @@ -3161,8 +3177,12 @@ is copied instead of being cut." | |||
| 3161 | 3177 | ||
| 3162 | ;; Show a tooltip. | 3178 | ;; Show a tooltip. |
| 3163 | (if mouse-drag-and-drop-region-show-tooltip | 3179 | (if mouse-drag-and-drop-region-show-tooltip |
| 3164 | (tooltip-show text-tooltip) | 3180 | ;; Don't use tooltip-show since it has side effects |
| 3165 | (tooltip-hide)) | 3181 | ;; which change the text properties, and |
| 3182 | ;; `text-tooltip' can potentially be the text which | ||
| 3183 | ;; will be pasted. | ||
| 3184 | (x-show-tip text-tooltip) | ||
| 3185 | (x-hide-tip)) | ||
| 3166 | 3186 | ||
| 3167 | ;; Show cursor and highlight the original region. | 3187 | ;; Show cursor and highlight the original region. |
| 3168 | (when mouse-drag-and-drop-region-show-cursor | 3188 | (when mouse-drag-and-drop-region-show-cursor |
| @@ -3183,7 +3203,7 @@ is copied instead of being cut." | |||
| 3183 | (mouse-set-point event))))))) | 3203 | (mouse-set-point event))))))) |
| 3184 | 3204 | ||
| 3185 | ;; Hide a tooltip. | 3205 | ;; Hide a tooltip. |
| 3186 | (when mouse-drag-and-drop-region-show-tooltip (tooltip-hide)) | 3206 | (when mouse-drag-and-drop-region-show-tooltip (x-hide-tip)) |
| 3187 | 3207 | ||
| 3188 | ;; Check if modifier was pressed on drop. | 3208 | ;; Check if modifier was pressed on drop. |
| 3189 | (setq no-modifier-on-drop | 3209 | (setq no-modifier-on-drop |