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

Associate popover with foldermanager #1396

Merged
merged 2 commits into from
Jan 6, 2024

Conversation

jeremypw
Copy link
Collaborator

@jeremypw jeremypw commented Jan 4, 2024

  • Point popover to the folder manager since that is where it is searching
  • Show folder manager temporarily if it is hidden when popover is shown (else points to random position)

I am not sure about this one. The issue I am trying to address is where the popover should point if the foldermanager or searchbar is hidden. Feel free to reject.

@jeremypw jeremypw requested a review from colinkiama January 4, 2024 18:56
Copy link
Member

@colinkiama colinkiama left a comment

Choose a reason for hiding this comment

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

I think that it's a good idea but it's really distracting as it is now because of how the popover keeps shrinking and growing from the centre.

On my machine I've tried to manually set the pointed_to property of the popover so that the popover is near the top of the sidebar:
Screenshot from 2024-01-04 21 29 53

The popover grows and shrinks from the top now however, the initial position of the popover is wrong if the app starts with the sidebar hidden:
Screenshot from 2024-01-04 21 49 18

Change I made to achieve this:

public FuzzySearchPopover (Gee.HashMap<string, Services.SearchProject> pps, Scratch.MainWindow window) {
    Object (
        modal: true,
        relative_to: window.sidebar,
        constrain_to: Gtk.PopoverConstraint.WINDOW,
        width_request: 500,
        current_window: window,
        position: Gtk.PositionType.LEFT,
        pointing_to: Gdk.Rectangle () { x = window.sidebar.get_allocated_width (), y = 36 }
    );

    //...

I think that if the issue with the initial position is solved then this is okay to merge

@jeremypw
Copy link
Collaborator Author

jeremypw commented Jan 5, 2024

@colinkiama Thanks for looking at this. I considered pointing to a fixed rectangle but as you say it does not work so well if the sidebar is hidden. We could point to the left-hand edge of the window or move the rectangle before showing the popover (but that feels hacky). I'll work on this some more.

@jeremypw jeremypw marked this pull request as draft January 5, 2024 10:10
@jeremypw jeremypw marked this pull request as ready for review January 6, 2024 16:45
@jeremypw
Copy link
Collaborator Author

jeremypw commented Jan 6, 2024

@colinkiama I have changed it so that the popover points to the top left corner of the document now, whether or not the sidebar is open. Its not ideal but I do not think it worth doing more at this stage. It will have to be reworked anyway when moved to main code and/or ported to Gtk4. In Gtk4 there is more control over the positioning and appearance of popovers.

Screenshot from 2024-01-06 16 51 01
Screenshot from 2024-01-06 16 52 21

Copy link
Member

@colinkiama colinkiama left a comment

Choose a reason for hiding this comment

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

I agree

@colinkiama colinkiama merged commit 8c550d6 into fuzzy-finder Jan 6, 2024
6 checks passed
@colinkiama colinkiama deleted the jeremypw/fuzzy-finder-popover branch January 6, 2024 17:51
jeremypw added a commit that referenced this pull request Jan 10, 2024
* Added a fuzzy search modal

* Fixed indent

* Use accent color for selection

* Listen to git change

* Use async fuzzy finder and ignore paths from .gitignore

* Resize dialog

* Added scrolling by up/down arrows

* Check project content on each search to get all changes

* Add basic debouncing and cancellation for each search query

* Add cancellable checks to all loops during fuzzy search

* Increase fuzzy search results update speed

* Fix long delay before fuzzy finder dialog opens

- Fuzzy finder paths indexed when plugin is activated
- Fuzy finder dialog now opens instantly

* Fix vala-lint errors in fuzzy-search plugin directory

* Prevent fuzzy search dialog from opening if there are no projects opened

* Clicking on fuzzy search results loads the clicked result

* Fuzzy search results across multiple projects are disambiguated using the project name before file path

* Update fuzzy search debug logs

* Improve Fuzzy Search Accuracy

- Combine file name and file paths in fuzzy finder

* Ignore dot-prefixed directories in fuzzy search

* Update debug messaging for fuzzy search

* Fix code style warnings in fuzzy search plugin

* Update license and copyright info for Fuzzy Finder plugin

* Add end method to project path parsing async call

* Fix vala-lint errors

* Improve fuzzy matching

- Fix issue how matches are added to list of matches
- Stop using a combined score. Prefer filename based matches when available
- Stop including directory separator in separator bonus

* Change fuzzy search keyboard shortcut to 'ALT + F'

* Remove unused GitManager signals

* Files that cannot be opened in Code are filtered out of fuzzy search

* Render fuzzy search items with list boxes

* Add mouser hover styling to fuzzy search items

* Handle Fuzzy Search key presses with EventControllerKey

* Now using popover to show fuzzy search

* Add title label to fuzzy search popover

* Remove unused window size and positining code

* Prevent focus on fuzzy item results

* Fuzzy search results for current project are prioritised

* Expose fuzzy find function and accelerator in sidebar action menu (#1395)

* Add Fuzzy Find menuitem to sidebar

* Consistently use "Find Project Files"

* Move SearchProject to separate file

* Fix lint

* Remove menuitem on deactivation of "Find Project Files" plugin

* Associate popover with foldermanager (#1396)

* Associate popover with foldermanager
* Remove deprecated PopoverConstraint

* Add folder_item_change plugin manager hook in preparation for background indexing

* Allow search project parsing to be cancellable

* Create indexer and add methods for adding and removing files and directories to search project class

* Use fuzzy search indexer for fuzzy search results

* Update indexer debug logs

* Update license info and comments in Fuzzy Search Project

* Remove old fuzzy search indexer testing logs

---------

Co-authored-by: Marvin Ahlgrimm <[email protected]>
Co-authored-by: Jeremy Wootten <[email protected]>
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.

2 participants