mrichar1 / clipster

clipster - python clipboard manager
GNU Affero General Public License v3.0
242 stars 26 forks source link

Search only matches beginning of clipboard entries #36

Open sebastianst opened 7 years ago

sebastianst commented 7 years ago

Only the beginning of clipboard entries is matched when typing a word in the clipboard history window. Searching should match anywhere inside the entries, not just the beginning.

Related to this, there's no way to jump to the next match of a search (or is there?).

mrichar1 commented 7 years ago

Hi,

I have to admit that I didn't realise that the selection widget actually offered search capabilities - it looks like this is enabled by default when you create the TreeView object!

Having had a quick play around, I've figured out how to create a custom search function, which does case-insensitive x in y rather than y.startswith(x) comparison:

...snip...
tree = Gtk.TreeView(model)
tree.set_search_equal_func(self.search_selection, tree)
...snip...

@staticmethod
def search_selection(model, column, key, iterator, data):
        return not key.lower() in model[iterator][0].lower()

However I'd like to tidy up the whole search interface in the UI to add things like prev/next match buttons, case-sensitivity toggle, starts with/contains toggles etc. Since it's there, we might as well make it useful!

I'll see about doing some work on this in the near future - but of course you're welcome to take a look yourself if you like!

magnetophon commented 7 years ago

@sebastianst A workaround is to use clipster together with rofi, which has fuzzy matching: clipster -o -n 0 -0 | rofi -i -dmenu -sep '\x00' -eh 2 -p paste: | sed -ze 's/\n$//' | clipster

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.