Replies: 3 comments
-
|
Touchscreen support is not implemented right now, see 66e2c47. Help adding this is welcome. I haven't looked into this yet, in particular on Android, since support for that is relatively new. |
Beta Was this translation helpful? Give feedback.
-
|
Hello, I've also noticed this issue while using Emacs on Android. So I tried writing the following code: (defun my-vertico-touchscreen-begin (begin-event)
(interactive "e")
(let* ((begin-posn (cdadr begin-event))
(begin-window (posn-window begin-posn))
(begin-xy (posn-x-y begin-posn))
(moved nil))
(with-selected-window begin-window
(let ((begin-scroll-pos vertico--scroll))
(while
(let ((ev (read-event)))
(pcase (car-safe ev)
('touchscreen-update
(let* ((update-xy (touch-screen-relative-xy (cdaadr ev) begin-window))
(dx (- (car update-xy) (car begin-xy)))
(dy (- (cdr update-xy) (cdr begin-xy))))
(when (and (not moved)
(>= (+ (* dx dx) (* dy dy)) 2))
(setq moved t))
(when moved
(let* ((dline (/ dy (default-line-height)))
(new-scroll-pos (- begin-scroll-pos dline)))
(cond
((< new-scroll-pos vertico--scroll)
(vertico--goto (+ new-scroll-pos vertico-scroll-margin)))
((> new-scroll-pos vertico--scroll)
(vertico--goto (+ new-scroll-pos vertico-count
(- vertico-scroll-margin))))))
(vertico--exhibit)))
t)
('touchscreen-end
(unless moved
(vertico--goto (vertico-mouse--index begin-event))
(vertico-exit))
nil))))))))
(defun my-vertico-touch-setup ()
(interactive)
(vertico-mouse-mode)
(define-key vertico-mouse-map (kbd "<touchscreen-begin>")
#'my-vertico-touchscreen-begin))In my limited testing, both scrolling by swiping and selection by tapping seem to work correctly in my environment. There might still be things that need improvement, but I thought it might be helpful to share this. ;; Apologies if the English sounds strange — it's machine translated. |
Beta Was this translation helpful? Give feedback.
-
|
My level of elisp-fu is unfortunately not good enough to come up with a solution by myself, but thanks a lot @misohena , your solution seems to work indeed. I have some glitches though, but it may very well be related to the rest of my config. This will let me use vertico on mobile already, thanks! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
First, thanks for your work on vertico :)
I'm a beginner with Emacs, and I'm using it on Linux (v29 and 30) and Android (native build v30).
The native Emacs completion framework can be used with a touchscreen to scroll through and select candidates, but it does so in a separate buffer. I tried using
vertico-mouse.el, and it works very well on Linux, but not at all with Android's touchscreen, neither scrolling nor tapping, whether in the minibuffer or invertico-buffer. I have tested this withemacs -Q,M-x package-install vertico,M-x vertico-mode,M-x vertico-mouse-mode(ensuring thatcontext-menu-modeis disabled).I don't really know how to troubleshoot, but for scrolling, I am guessing (perhaps naively) that it might be due to the fact that
vertico-mouse.eldirectly mapsmwheel-scroll-up-functionandmwheel-scroll-down-functiontovertico--goto. Would it be as simple as adding a mapping betweentouchscreen-scroll window dx dy(Touchscreen Events in Emacs manual) andvertico-goto? what would the code look like?For tapping, I don't really understand if
touch-screen-track-tapshould be mapped tovertico-mouse--clickor iftouch-screen-track-tapis already supposed to default tomouse-1- in which case it should work out of the box and I may have another problem.I'm also open to suggestions for other completion frameworks that may be supporting my use case, with a preference with displaying candidates in the minibuffer (
icomplete-modesupports touchscreen actions in a buffer, butivy-modedoesn't support them in the minibuffer).Thanks!
Beta Was this translation helpful? Give feedback.
All reactions