-
Notifications
You must be signed in to change notification settings - Fork 12
accept M RET on all input with vertico #694
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
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,7 +3,7 @@ | |
| ;; Author: Bob Weiner | ||
| ;; | ||
| ;; Orig-Date: 04-Feb-89 | ||
| ;; Last-Mod: 22-Feb-25 at 16:18:02 by Bob Weiner | ||
| ;; Last-Mod: 16-Mar-25 at 00:15:09 by Mats Lidell | ||
| ;; | ||
| ;; SPDX-License-Identifier: GPL-3.0-or-later | ||
| ;; | ||
|
|
@@ -256,8 +256,7 @@ Its default value is `smart-scroll-down'. To disable it, set it to | |
| ;; If in the minibuffer and reading an argument with vertico | ||
| ;; run the vertico command on {M-RET} which accepts the first | ||
| ;; line of minibuffer input, rather than any candidate. | ||
| ((and hargs:reading-type | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why don't we just add an appropriate check for whether the vertico-mode variable is true or not and dispatch as needed (defer to vertico) rather than touching the hargs:reading-type clause? |
||
| (> (minibuffer-depth) 0) | ||
| ((and (> (minibuffer-depth) 0) | ||
| (eq (selected-window) (minibuffer-window)) | ||
| (not (bound-and-true-p ivy-mode)) | ||
| (and (bound-and-true-p vertico-mode) | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| ;;; hui-mouse-tests.el --- unit tests for hui-mouse -*- lexical-binding: t; -*- | ||
| ;; | ||
| ;; Author: Mats Lidell | ||
| ;; | ||
| ;; Orig-Date: 15-Mar-25 at 22:39:37 | ||
| ;; Last-Mod: 16-Mar-25 at 01:14:39 by Mats Lidell | ||
| ;; | ||
| ;; SPDX-License-Identifier: GPL-3.0-or-later | ||
| ;; | ||
| ;; Copyright (C) 2025 Free Software Foundation, Inc. | ||
| ;; See the "HY-COPY" file for license information. | ||
| ;; | ||
| ;; This file is part of GNU Hyperbole. | ||
|
|
||
| ;;; Commentary: | ||
| ;; | ||
| ;; Unit tests for "../hui-mouse.el". | ||
|
|
||
| ;;; Code: | ||
|
|
||
| (require 'ert) | ||
| (require 'el-mock) | ||
|
|
||
| (defun hui-mouse-tests--hkey-get-action () | ||
| "Return the action given by the predicate that is true. | ||
| See `hkey-execute' for where this type of lookup is used." | ||
| (let ((hkey-forms hkey-alist) | ||
| pred-value hkey-actions hkey-form pred) | ||
| (while (and (null pred-value) (setq hkey-form (car hkey-forms))) | ||
| (if (setq hkey-actions (cdr hkey-form) | ||
| pred (car hkey-form) | ||
| pred-value (hypb:eval-debug pred)) | ||
| nil | ||
| (setq hkey-forms (cdr hkey-forms)))) | ||
| hkey-actions)) | ||
|
|
||
| ;; FIXME: Add more predicate cases from hkey-alist. | ||
| (ert-deftest hui-mouse-tests--hkey-alist () | ||
| "Verify that given predicate values triggers the proper action." | ||
| ;; Treemacs | ||
| (let ((major-mode 'treemacs-mode)) | ||
| (should (equal (hui-mouse-tests--hkey-get-action) | ||
| (cons '(smart-treemacs) '(smart-treemacs))))) | ||
|
|
||
| ;; dired-sidebar-mode | ||
| (let ((major-mode 'dired-sidebar-mode)) | ||
| (should (equal (hui-mouse-tests--hkey-get-action) | ||
| (cons '(smart-dired-sidebar) '(smart-dired-sidebar))))) | ||
|
|
||
| ;; Vertico | ||
| (defvar ivy-mode) | ||
| (defvar vertico-mode) | ||
| (let ((ivy-mode nil) | ||
| (vertico-mode t)) | ||
| (mocklet (((minibuffer-depth) => 1) | ||
| ((selected-window) => t) | ||
| ((minibuffer-window) => t) | ||
| (vertico--command-p => t)) | ||
| (should (equal (hui-mouse-tests--hkey-get-action) | ||
| (cons '(vertico-exit-input) '(vertico-exit-input))))))) | ||
|
|
||
| (provide 'hui-mouse-tests) | ||
|
|
||
| ;; This file can't be byte-compiled without the `el-mock' package | ||
| ;; which is not a dependency of Hyperbole. | ||
| ;; | ||
| ;; Local Variables: | ||
| ;; no-byte-compile: t | ||
| ;; End: | ||
|
|
||
| ;;; hui-mouse-tests.el ends here |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’m fine with everything here except the first line. We’ll have to think about how this could impact other things, i.e. the above line was put there for a reason.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can hargs:reading-type and vertico-mode be non-nil at the same time? If I remember correct they can not so the check on hargs:reading-type effectively ignores vertico reading the input.
Anyway I'm far from sure here. Could be a case where vertico is prompting for input where we want the action key to kick in instead? So I added a test case for hkey-alist so we can verify that different scenarios are handled properly. If we can identify the case we can add tests for that so we can verify that both scenarios works as expected.