Skip to content

Commit

Permalink
prompt-buffer.lisp: remove element-in-view-port code
Browse files Browse the repository at this point in the history
frequently scrolls and breaks minibuffer
by limiting the size of the 'minibuffer entries' we can mitigate the
problem in a simpler way
  • Loading branch information
jmercouris committed Jan 29, 2021
1 parent d392486 commit 2eeafba
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions source/prompt-buffer.lisp
Expand Up @@ -288,17 +288,7 @@ The new webview HTML content is set as the MINIBUFFER's `content'."
(str:join (string #\newline)
(loop for i from current-source-index to last-source-index
for source = (nth i sources)
collect (source->html source)))))
(defun element-in-view-port-p (element) ; TODO: Factor with `add-element-hints'.
(ps:let* ((rect (ps:chain element (get-bounding-client-rect))))
(if (and (>= (ps:chain rect top) 0)
(>= (ps:chain rect left) 0)
(<= (ps:chain rect right) (ps:chain window inner-width))
(<= (ps:chain rect bottom) (ps:chain window inner-height)))
t nil)))
(unless (element-in-view-port-p (ps:chain document (get-element-by-id "selection")))
(ps:chain document (get-element-by-id "selection")
(scroll-into-view t))))))
collect (source->html source))))))))

(let* ((source (current-source prompt-buffer))
(suggestions (prompter:suggestions source))
Expand Down

0 comments on commit 2eeafba

Please sign in to comment.