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

autocomplete: assume selection when there's only one candidate #277

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

adtac
Copy link

@adtac adtac commented Apr 12, 2023

This makes autocomplete behave like how it works in ranger. To test before and after, create a directory long directory chain $HOME/foo/bar/baz, type :cd fo and press Tab several times. Previously, joshuto would stop at foo, but now the first Tab will autocomplete foo/, the second will autocomplete foo/bar/, and so on.

I don't know any Rust, but the change seems to work. Feel free to cherry pick the commit and make changes to make it more idiomatic/cleaner/whatever.

The PR also includes a couple of other trivial improvements.

Copy link
Owner

@kamiyaa kamiyaa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM overall.

Just a few minor comments

@@ -248,7 +248,6 @@ impl std::str::FromStr for Command {
} else if command == CMD_DELETE_FILES {
let (mut permanently, mut background) = (false, false);
for arg in arg.split_whitespace() {
eprintln!("arg: {:?}", arg);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, thanks for catching this!

@@ -265,7 +265,7 @@ case "$mimetype" in
esac
```

`~/.config/joshuto/on_preview_removed.sh`:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any reason for this change?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both references to this script above ("Configuring Hook Scripts" and "The Hook Scripts") don't have the .sh. I blindly copy-pasted those instructions, but with the kitty modifications, but it took me a couple minutes to identify the typo.

@@ -215,6 +215,10 @@ impl<'a> TuiTextField<'a> {
let _ = terminal.hide_cursor();
return None;
}
Key::Ctrl('c') => {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants