Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve scrolling for long prompts #381

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ The format is based on [Keep a Changelog].
the available window width. When `auto-hscroll-mode` was set to
`current-line` it would introduce constant back and forth scrolling
issues and other values also wouldn't allow to use such a prompt
correctly ([#344], [#345], [#374], [#375], [#377], [#378], [#379]).
correctly ([#344], [#345], [#374], [#375], [#377], [#378], [#379],
[#381]).
* `selectrum-select-from-history` set variables
`selectrum-should-sort-p`, `selectrum-candidate-inserted-hook`,
`selectrum-candidate-selected-hook` and
Expand Down Expand Up @@ -269,6 +270,7 @@ The format is based on [Keep a Changelog].
[#378]: https://github.com/raxod502/selectrum/pull/378
[#379]: https://github.com/raxod502/selectrum/pull/379
[#380]: https://github.com/raxod502/selectrum/pull/380
[#381]: https://github.com/raxod502/selectrum/pull/381

## 3.0 (released 2020-10-20)
### Breaking changes
Expand Down
4 changes: 2 additions & 2 deletions selectrum.el
Original file line number Diff line number Diff line change
Expand Up @@ -723,9 +723,9 @@ the update."
(goto-char (max (point) (minibuffer-prompt-end)))
;; Scroll the minibuffer when current prompt exceeds window width.
(let* ((width (window-width)))
(if (< (point) (max (- width (/ width 4)) 1))
(if (< (point) (- width (/ width 3)))
(set-window-hscroll nil 0)
(set-window-hscroll nil (- (point) (/ width 4)))))
(set-window-hscroll nil (- (point) (/ width 3)))))
;; For some reason this resets and thus can't be set in setup hook.
(setq-local truncate-lines t)
(let ((inhibit-read-only t)
Expand Down