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

geanyprj: sidebar easy search feature #176

Open
wants to merge 18 commits into
base: master
Choose a base branch
from

Conversation

Thannoy
Copy link
Contributor

@Thannoy Thannoy commented Nov 9, 2014

This branch insert two features in GeanyPrj plugin, both focused on sidebar listing project files.

Simpler keyboard-based item selection in file listing

When sidebar is focused, user can type extracts of a searched name to easily select first matching file. User can then use up and down arrow to select other matches and 'Enter' key to open it.

As opposite to previous treeview-default behavior, matches are searched anywhere in the filename and not only as a kind of "start-with" test. User can also type two words in order to highlight files containings both substrings in a case insensitive way.

Sidebar file listing filtering

An optional input box is added on top of file listing to hide non-matching items. User can then press down arrow key to jump in the filtered file listing and search/open one of them.

Configurability

Few new configuration keys has been added in GeanyPrj plugin configuration pane. Configurable items are:

  • search algorithm (Start-with ; Contains ; Contains-all ; Contains insensitive ; Contains-all insensitive)
  • filter algorithm (Start-with ; Contains ; Contains-all ; Contains insensitive ; Contains-all insensitive)
  • filter availiability

Limitations

Insensitive algorithm are not available on systems not offering strcasestr() function. In such systems, "Contains-all" is the default algorithm instead of "Contains-all insensitive".

Thannoy added 18 commits October 3, 2014 22:42
When sidebar has focus, user can type a text to auto-select
a matching entry in the list.

Default "start-with" matching was used.
This commit set a custom match function based on "strstr".
Default gtk treeview supports an easy fast-highlight feature.
User can type a text to highlight first item matching and can use
up ordown arrows to highlight previuos/next matching item.

Default match policy is a "has-prefix" match.
Previous commit replaced it with a case-sensitive search.

This commit updates previous one and defines five match algorithms:
* Legacy "start_with"
* Previous "contains"
* New "contains insensitive"
* New "contains all"
* New "contains all insensitive" [default]

"Contains all" policies helps highlighting an entry by typing
few space-separated words like "prj side c".

The only way to select a policy currently need a recompilation.
The use of a settings page would be interesting here but is not
implemented yet.

Note: this commit add a dependancy to _GNU_SOURCE strcasestr() which
may require a portability review.
Have autotools auto-detect strcasestr availability and
disable a few features if this function is not available
on the target system.
* Move kbdsearch_policy enum definition for it to be used by geanyprj.c
* Add getters and setters for the active policy in sidebar.c
* Add this policy to the geanyprj plugin settings
* Add some widgets to the plugin config dialog to choose policy
Previously, plugin global-settings were applied and saved in any case.

This commit tests which button has been used
to give those three buttons their logical behavior.
Explain user how to use sidebar fast-search feature.
sidebar is configured even if not shown,
hence this is not a bug to read its state when hidden.
Keep this branch up-to-date with master mainline.
HACKING file says plugin-specific dependancy checks should be
inserted "between the GP_ARG_DISABLE and GP_COMMIT_PLUGIN_STATUS calls."
but strcasestr check was inserted after those calls.
Still to be done:
* have the filter feture optional
* have the filter entry widget auto-clear on some events like open file
* have shortcuts to focus sidebar items
Sidebar filter is now configurable in the same way sidebar fast-search
is.
This commit add a clickable icon inside the sidebar filter gtk_entry
which helps clearing this field.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants