Shizcow / dmenu-rs

A pixel perfect port of dmenu, rewritten in Rust with extensive plugin support
GNU General Public License v3.0
202 stars 9 forks source link

Autoselect plugin #30

Closed asdf8dfafjk closed 4 years ago

asdf8dfafjk commented 4 years ago

Add autoselect flag which would autoselect if there is only one current match

Shizcow commented 4 years ago

On this line, #[override_default] makes it so postprocess_matches is always overridden, even when the autoselect flag is not specified. I'm guessing you meant #[override_flag(flag = autoselect)] so that it's only active when --autoselect is passed?

Shizcow commented 4 years ago

Doing this will take out the need to check CLAP_FLAGS, and take out the relevant import.

asdf8dfafjk commented 4 years ago

Just replacing that single line #[override_default] with #[override_flag(flag = autoselect)] gives me

error[E0599]: no method named `postprocess_matches` found for mutable reference `&mut drw::Drw` in the current scope
  --> build/../dmenu/item.rs:99:26
   |
99 |     let items_to_draw = drw.postprocess_matches(pre_processed_items)?;
   |                             ^^^^^^^^^^^^^^^^^^^ method not found in `&mut drw::Drw`

I don't know much about this error- wondering if you have a quick pointer to what might be wrong?

Shizcow commented 4 years ago

I think I've found the issue, and it's not due to your code. #[override_flag(flag = autoselect)] does work if you make clean and then make. I believe what's happening is overrider isn't updating its watchlist when plugin files are changed. This is a build issue, so I'll sort it out shortly.

As a workaround in the meantime, use #[override_flag(flag = autoselect)] and then make clean to get the watchlist fixed, before testing changes. That should sort things out enough to get this figured out.

Shizcow commented 4 years ago

I've pushed a fix to the issue I just mentioned to the develop branch. If you rebase (or re-fork or whatever) to get the changes down to your local branch the build issue should be resolved.

Thanks for your patience.

asdf8dfafjk commented 4 years ago

I did the change you asked for.

Shizcow commented 4 years ago

Looks good. Thanks for your contribution.