-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Issue 5237: Show "no results" for Find in Files #5371
Conversation
@cosmosgenius I made a first pass through your code and it looks pretty good! My first question is actually for @larz0 -- I like how this code now uses the red border around search field to indicate no results, but is that enough? Seems like it should also display "no results". |
_hideSearchResults(); | ||
|
||
if(dialog instanceof FindInFilesDialog){ | ||
dialog.getDialogTextField().addClass('no-results'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After search with no results, the red border (i.e. 'no-results' class) should go away as soon as I start typing as new search string.
Ok let's do this: When the user starts typing a new search switch it back to: |
if (!currentQueryExpr) { | ||
return; | ||
} | ||
StatusBar.showBusyIndicator(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to be a long time before the busy indicator is shown. It looks like this was not introduced with this code, but it would be great if you could take a look at it. If you can't figure it out, then we can open a separate issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would it be good if i move it inside the keydown handler for the dialog
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could try it. I'm wondering if it's more of a painting problem.
Dialog allows typing during search phase. The text is not updated until search is complete so it's hard to see, but I can see edits briefly when dialog is being dismissed. Text field should be disabled when search is in progress. |
|
||
|
||
if(dialog instanceof FindInFilesDialog){ | ||
dialog._close(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's safe to set dialog = null;
after dialog is closed, right? If so, it should be done to free memory sooner.
Done with initial code review. Thanks for taking on this change. It's a bigger change than it first seemed, but this will make searching much better. |
I apologize for the late comments on this pull request, but I had a crazy idea about this. For me, another annoying thing about Find in Files is that sometimes I search for something in the code, do whatever, think I'm done and close the results panel. Later (sometimes only a few milliseconds), I realize there's something else I wanted to do. Unfortunately, the data is now lost -- which is a shame since the results panel data is now updated as you edit your code. So, I'd like a way to re-open the FiF results to see the previous search. What does that have to do with this pull request? I thought of this following workflow that may change what's been done so far in this PR:
Maybe need a way to see results panel without dialog open at top? @larz0 @cosmosgenius @TomMalbran Any thoughts on this? |
@redmunds I remember @RaymondLim mentioned something about tabbed search panel with previous search results. Maybe we could wait for that? We can open the panel via a view search history icon in the modal bar or shortcut. |
The tab label could show just the searched text up to a number of characters and the full info could go below the tab. |
@larz0 I forgot about the tabbed interface (that I'm sure we'll have at some point). I think that solves the "want to see previous results" case because there less need to close the panel when they're sharing space. We might also want to preserve the previous results when the panel is closed, but I think that can wait until we have a tabbed panel. In anticipation of a |
If we want to show the panel on search we should move the search input on the panel so it feels like they're connected and stop the eyes from pogo-sticking. |
…r message display for no result
Seems like a lot of design changes. From the discussion it seems now all the responses to the user will be done on the search panel instead of the dialog, which would be in the disabled state when the search is going on. And now rather than destroying the previous results we would store it and show it the next time FiF is opened. |
Definitely seems like a bit of scope creep :) I haven't followed this PR, but could we accept this as is and add the other idea to the backlog? |
@cosmosgenius Sorry. I mentioned it because I thought it could actually simplify this, but I only made it more confusing. Let's continue with the original plan. |
i liked the part about keep the previous results and showing them when next time FiF is opened. I'll try implementing it and see how it goes. I'll update on this. |
@cosmosgenius This PR pretty close to being done. Let's finish this PR, and then submit that as a new PR. |
…g of text field when search is going on
How would i cancel an already initiated search?? I guess it wont be required as currently text field is disabled when search is in progress, but would like to know on how we could achieve the same. Other than this i am done. |
Currently, there is no mechanism for cancelling a search, but it would be easy to add. The |
This looks pretty good. We're finishing off Sprint 32, so I won't be able to merge this for a few days. |
|
||
if (dialog) { | ||
dialog.getDialogTextField().addClass('no-results') | ||
.removeAttr('disabled') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use double quotes on these 2 lines.
I'm still seeing a JSLint error: |
This branch seems to have introduced a problem when you initiate a Find in Files with an empty search argument. The wait cursor and disabled modalbar never go away. |
Done with second code review. This is looking good. Just 1 bug and a little cleanup. |
that._close(null); | ||
} else if (event.keyCode === KeyEvent.DOM_VK_RETURN) { | ||
StatusBar.showBusyIndicator(true); | ||
that.getDialogTextField().attr('disabled', 'disabled'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use double quotes here.
Same for lines 242 and 245.
I moved the query null check to _getQueryRegExp. Seem when the reg ex is invalid the same getting stuck situation is happening. |
If we press "enter key" for three to four times for a "noresult search" it doesn't respond to "enter or esc" keys anymore. Only after some interaction it works (like any other key or mouse click on input box). I couldn't figure out why it is happening. It seems something related to brackets-core. |
Where are you doing that? |
Added Trello Card to Icebox for side discussion: https://trello.com/c/KY4eJL7V/1038-find-in-files-preserve-previous-results This was squashed into #5477. Closing this one. |
This is for #5237.
Removed the promise from dialog and create a function doSearch() which is called from the keydown event handler.
Moved "dialog" object to module scope so that function _showSearchResults can directly handle it.
Adding a css class "no-results" to the input box when no results are present.