Skip to content

Conversation

@jjw24
Copy link
Member

@jjw24 jjw24 commented Jul 9, 2021

Description
After changing the hotkey that triggers flow's query window, the query window that get triggered by new hotkey can not be used- unable to move up and down on the result list, unable to move the cursor on the query test box, the query text is not select if you have this option enabled, and query window's position is not in the same place as previous.

Changes

  • consolidated duplicate hotkey behaviour code into one class HotkeyMapper
  • added focus to custom query hotkey preview so can be used when previewing
  • behaviour should be the same for when a hot key/custom query hotkey is changed and when these hotkeys are loaded during startup

How to reproduce
Change hotkey. Trigger the query window, then unable to use it with the issues described above.

Tested with this PR:

  • changed hotkey and made sure new hotkey works afterwards
  • changed hotkey and check all 'Last Query Style' options are working afterwards
  • changed hotkey and set ignore hotkey in full screen mode
  • able to trigger Custom Query Hotkeys and query window position is correct

Close #166

@jjw24 jjw24 added the bug Something isn't working label Jul 9, 2021
@jjw24 jjw24 added this to the 1.8.0 milestone Jul 9, 2021
@jjw24 jjw24 self-assigned this Jul 9, 2021
@jjw24 jjw24 marked this pull request as draft July 9, 2021 12:07
@taooceros
Copy link
Member

taooceros commented Jul 11, 2021

Could you share which part fixes the bug? It is a bit confuse this commit includes quite a lot refactor.

No problem I get the idea of this fix.

Comment on lines 103 to 105
if (ShouldIgnoreHotkeys()) return;
mainViewModel.MainWindowVisibility = Visibility.Visible;
mainViewModel.ChangeQueryText(hotkey.ActionKeyword);
Copy link
Member

@taooceros taooceros Jul 11, 2021

Choose a reason for hiding this comment

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

Could you also add mainViewModel.LastQuerySelected = false; to here because I do have encountered it is selected sometime.

That doesn't fix the issue. I will handle that once you have finished all the change you want. It will only happen when the current query text is the same as the expected plugin keyword text, which won't trigger the onTextChanged event.

@jjw24
Copy link
Member Author

jjw24 commented Jul 11, 2021

Will do those changes tomorrow, haven't got around to finishing this at all this weekend.

@taooceros
Copy link
Member

By the way, do you think it would be better to change the use of the property LastQuerySelected. I think the usage is quite confusing.

@jjw24 jjw24 marked this pull request as ready for review July 14, 2021 11:09
@jjw24 jjw24 enabled auto-merge July 14, 2021 11:09
@jjw24
Copy link
Member Author

jjw24 commented Jul 14, 2021

By the way, do you think it would be better to change the use of the property LastQuerySelected. I think the usage is quite confusing.

how is it confusing? i use it all the time, it makes sure the previous query is highlighted so i can start typing after triggered the window.

@jjw24
Copy link
Member Author

jjw24 commented Jul 14, 2021

@taooceros ready to go, please review 😄

@taooceros taooceros added the review in progress Indicates that a review is in progress for this PR label Jul 14, 2021
@taooceros
Copy link
Member

By the way, do you think it would be better to change the use of the property LastQuerySelected. I think the usage is quite confusing.

how is it confusing? i use it all the time, it makes sure the previous query is highlighted so i can start typing after triggered the window.

It is confusing because when we don't want to select last query, we need to mark it as true to fake a selected. When we want the model to select last time query, we mark it false. Maybe a property like (Should)SelectLastQuery may be clearer.

Copy link
Member

@taooceros taooceros left a comment

Choose a reason for hiding this comment

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

Do you think we shall change the select query property?

Comment on lines +125 to +127
catch
{
}
Copy link
Member

Choose a reason for hiding this comment

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

We can remove the catch

Copy link
Member Author

Choose a reason for hiding this comment

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

cant remove it, catch is needed to go to return false at the bottom, you can just use catch but you duplicate code for no benefit, so may be just leave it?

Comment on lines 25 to 26
if (handler != null)
handler(this, EventArgs.Empty);
Copy link
Member

Choose a reason for hiding this comment

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

I like this way handler?.Invoke(this, EventArgs.Empty), but either is fine.

<system:String x:Key="enable">Enable</system:String>
<system:String x:Key="disable">Disable</system:String>
<system:String x:Key="actionKeywords">Action keyword:</system:String>
<system:String x:Key="actionKeywords">Query</system:String>
Copy link
Member

Choose a reason for hiding this comment

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

image
Is this reference to this? I think Query may be a bit confusing here.

Copy link
Member Author

Choose a reason for hiding this comment

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

good catch, i didnt realise that is hooked up to Action keyword field

@jjw24
Copy link
Member Author

jjw24 commented Jul 15, 2021

By the way, do you think it would be better to change the use of the property LastQuerySelected. I think the usage is quite confusing.

how is it confusing? i use it all the time, it makes sure the previous query is highlighted so i can start typing after triggered the window.

It is confusing because when we don't want to select last query, we need to mark it as true to fake a selected. When we want the model to select last time query, we mark it false. Maybe a property like (Should)SelectLastQuery may be clearer.

oh ok, you mean the code not the actual functionality

@jjw24
Copy link
Member Author

jjw24 commented Jul 15, 2021

@taooceros just done refactor based on my understanding of how the last query modes should work, have a look and let me know if it's correct #568

@jjw24
Copy link
Member Author

jjw24 commented Jul 17, 2021

@taooceros i think this pr is ready to go, let's get this in and do the last query mode refactor seperately so we can release 1.8.0 since there is no functionality change for the refactor

@taooceros
Copy link
Member

@taooceros i think this pr is ready to go, let's get this in and do the last query mode refactor seperately so we can release 1.8.0 since there is no functionality change for the refactor

Oh sorry, I was not at home these few days so haven't got through the whole pr again.
Sure. Let's keep them after 1.8.0.

@taooceros taooceros removed the review in progress Indicates that a review is in progress for this PR label Jul 17, 2021
@jjw24 jjw24 merged commit 8d23f98 into dev Jul 17, 2021
@jjw24 jjw24 deleted the fix_hotkey_change branch July 17, 2021 13:23
@jjw24
Copy link
Member Author

jjw24 commented Jul 17, 2021

@taooceros i think this pr is ready to go, let's get this in and do the last query mode refactor seperately so we can release 1.8.0 since there is no functionality change for the refactor

Oh sorry, I was not at home these few days so haven't got through the whole pr again.
Sure. Let's keep them after 1.8.0.

All good no stress, I was just doing a fyi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Empty last query is not working (neither is select last query)

3 participants