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

#11: Findbar arrow sensitivity #687

Closed

Conversation

hollyschilling
Copy link

Added changes to the sensitivity of next and previous buttons when no results are found.

Added changes to the sensitivity of next and previous buttons when no results are found.
@hollyschilling
Copy link
Author

@jeremypw What linter and config is being used?

@jeremypw
Copy link
Collaborator

@hollyschilling The linter is vala-lint with the default configuration. You can download and install locally from https://github.com/vala-lang/vala-lint. You can then check you code locally before committing.

@jeremypw
Copy link
Collaborator

Further info on elementary code style, which the linter enforces can be found here: https://docs.elementary.io/develop/writing-apps/code-style

There should probably be info about linting locally there but as yet it has not been added.

@hollyschilling
Copy link
Author

I'm sorry to keep bugging you for simple questions, but I'm having an error with the linting that I can't understand. Specifically, I received and error stating:

  117.26    error   Expected variable name in underscore_convention   naming-convention

The referenced line of code is bool initialFound = next_search ();. I can't understand why this declaration would be preceded with an underscore. For context, the line is in a try block, in a lambda, in the constructor. What is the rule that is triggering this to get that error?

@lenemter
Copy link
Member

@hollyschilling in Vala variables are named using snake_case, and initialFound should be initial_found

Copy link
Collaborator

@jeremypw jeremypw left a comment

Choose a reason for hiding this comment

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

I have suggested some corrections to remaining lint.

src/Widgets/SearchToolbar.vala Outdated Show resolved Hide resolved
src/Widgets/SearchToolbar.vala Outdated Show resolved Hide resolved
src/Widgets/SearchToolbar.vala Show resolved Hide resolved
src/Widgets/SearchToolbar.vala Outdated Show resolved Hide resolved
src/Widgets/SearchToolbar.vala Outdated Show resolved Hide resolved
src/Widgets/SearchToolbar.vala Show resolved Hide resolved
@jeremypw
Copy link
Collaborator

A side-effect of this change is that if, after the search, the terminal produces output containing the search term then the navigation buttons remain insensitive even if the cyclic search button is toggled. The search term has to be modified or re-entered in order to initiate a new search. A more convenient way of refreshing the search would be good. At least if the cyclic search button is toggled then the sensitivity of the navigation buttons should be revisited.

@hollyschilling
Copy link
Author

I completely agree that this is potentially undesirable behavior. Is there an event emitted from the terminal that would indicate that additional content has been added?

There are a few such edge cases that are not handled well. I feel that adding messaging to indicate that the end of search has been reached would be appropriate.

@jeremypw
Copy link
Collaborator

Is there an event emitted from the terminal that would indicate that additional content has been added?

There is Vte.Terminal.content-changed signal. But you may need to throttle that so that a large number of searches are not performed unnecessarily when the content is changing rapidly. Maybe better leave that for another PR.

Copy link
Collaborator

@jeremypw jeremypw left a comment

Choose a reason for hiding this comment

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

Another small bug is that if cyclic search is OFF and you navigate to the last found term so that the next button becomes insensitive and then toggle cyclic search ON then the sensitivity of the next button does not change - it should become sensitive.

A fix for this would be to emit a search-changed signal whenever the cyclic search is toggled.

src/Widgets/SearchToolbar.vala Outdated Show resolved Hide resolved
@jeremypw
Copy link
Collaborator

I looked into completing this but found that because of the way the terminal widget does search one hit at a time (unlike Code which searches for all hits within scope) it is extremely difficult/impossible to set the search arrow sensitivities correctly all the time. I do not think it is worth spending more time on it tbh.

@jeremypw jeremypw closed this Oct 17, 2024
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.

3 participants