microsoft / PowerToys

Windows system utilities to maximize productivity
MIT License
110.62k stars 6.52k forks source link

[PT run] Initial selection is not consistent and sometimes even incorrect #13310

Open CombeeMike opened 3 years ago

CombeeMike commented 3 years ago

Microsoft PowerToys version

0.45.0

Running as admin

Area(s) with issue?

PowerToys Run

Steps to reproduce

Inconsistent selection highlighting

I have no 1:1 reproduction steps as this behavior is most probably highly dependant on the indexed files & search history but I can explain what happens:

When typing something, most of the time the first entry in the result list is highlighted so that I know at one glance that this will be executed when pressing enter without moving the selection at all. However, sometimes nothing is selected:

https://user-images.githubusercontent.com/30658772/133963383-e5a3e183-4d5f-49c3-bc5f-c484bde6f236.mp4

As you can see in this video:

Incorrect selection highlighting

Sometimes it even happens, that the wrong entry is selected:

https://user-images.githubusercontent.com/30658772/133963867-6998278a-16f0-4169-8233-890e6181d366.mp4

Here, I only typed fin and did not move the selection, however, it is still the second entry which is highlighted. What is even more confusing then: When I press enter in the shown state, the first entry FinanceControl gets executed, not the highlighted one 🤷‍♂️

✔️ Expected Behavior

❌ Actual Behavior

Other Software

No response

htcfreek commented 3 years ago

Thank you for reporting that! Could you please send us a bug report?


How to generate the report: 1. Right-click on the PowerToys icon in the tray menu and select Report Bug. image 2. The report is saved as .zip file on your desktop. Please drag and drop the report into a GitHub comment.

CombeeMike commented 3 years ago

@htcfreek

Sure, here's the bug report: PowerToysReport_2021-09-20-13-13-00.zip

htcfreek commented 3 years ago

@CombeeMike Can you please try if it helps to disable calculator plugin. I found two types of exceptions and one is from calculator plugin.

[2021-09-20 12:50:11.8309] [ERROR] [S:\src\modules\launcher\Plugins\Microsoft.PowerToys.Run.Plugin.Calculator\Main.cs::63]
-------------------------- Begin exception --------------------------
Message: Exception when query for <{query}>

Exception full name  : Mages.Core.ParseException
Exception message    : The given source code contains errors.
Exception stack trace:
   at Mages.Core.Ast.Walkers.OperationTreeWalker.Mages.Core.Ast.IValidationContext.Report(ParseError error)
   at Mages.Core.Ast.Expressions.InvalidExpression.Validate(IValidationContext context)
   at Mages.Core.Ast.Walkers.OperationTreeWalker.Mages.Core.Ast.ITreeWalker.Visit(InvalidExpression expression)
   at Mages.Core.Ast.Expressions.InvalidExpression.Accept(ITreeWalker visitor)
   at Mages.Core.Ast.Walkers.OperationTreeWalker.Handle(BinaryExpression expression, Function function)
   at Mages.Core.Ast.Walkers.OperationTreeWalker.<>c.<.cctor>b__57_20(OperationTreeWalker walker, BinaryExpression expr)
   at Mages.Core.Ast.Walkers.OperationTreeWalker.Mages.Core.Ast.ITreeWalker.Visit(BinaryExpression expression)
   at Mages.Core.Ast.Expressions.BinaryExpression.Accept(ITreeWalker visitor)
   at Mages.Core.Ast.Walkers.OperationTreeWalker.Handle(BinaryExpression expression, Function function)
   at Mages.Core.Ast.Walkers.OperationTreeWalker.<>c.<.cctor>b__57_21(OperationTreeWalker walker, BinaryExpression expr)
   at Mages.Core.Ast.Walkers.OperationTreeWalker.Mages.Core.Ast.ITreeWalker.Visit(BinaryExpression expression)
   at Mages.Core.Ast.Expressions.BinaryExpression.Accept(ITreeWalker visitor)
   at Mages.Core.Ast.Walkers.OperationTreeWalker.Mages.Core.Ast.ITreeWalker.Visit(SimpleStatement statement)
   at Mages.Core.Ast.Statements.SimpleStatement.Accept(ITreeWalker visitor)
   at Mages.Core.Ast.Walkers.OperationTreeWalker.Mages.Core.Ast.ITreeWalker.Visit(BlockStatement block)
   at Mages.Core.Ast.Statements.BlockStatement.Accept(ITreeWalker visitor)
   at Mages.Core.Ast.StatementExtensions.MakeRunnable(IEnumerable`1 statements)
   at Mages.Core.Engine.Interpret(String source)
   at Microsoft.PowerToys.Run.Plugin.Calculator.CalculateEngine.Interpret(String input, CultureInfo cultureInfo)
   at Microsoft.PowerToys.Run.Plugin.Calculator.Main.Query(Query query)
Exception source     : Mages.Core
Exception target site: Void Mages.Core.Ast.IValidationContext.Report(Mages.Core.ParseError)
Exception HResult    : -2146233088
-------------------------- End exception --------------------------

(The other type is because the config of various built-in apps are not found. I think you have removed them.)

CombeeMike commented 3 years ago

@htcfreek Sure, just disabled the calc plugin & tested -> Same behavior

htcfreek commented 3 years ago

@CombeeMike Can you please try if it helps to disable calculator plugin. I found two types of exceptions and one is from calculator plugin.

[2021-09-20 12:50:11.8309] [ERROR] [S:\src\modules\launcher\Plugins\Microsoft.PowerToys.Run.Plugin.Calculator\Main.cs::63]
-------------------------- Begin exception --------------------------
Message: Exception when query for <{query}>

Exception full name  : Mages.Core.ParseException
Exception message    : The given source code contains errors.
Exception stack trace:
   at Mages.Core.Ast.Walkers.OperationTreeWalker.Mages.Core.Ast.IValidationContext.Report(ParseError error)
   at Mages.Core.Ast.Expressions.InvalidExpression.Validate(IValidationContext context)
   at Mages.Core.Ast.Walkers.OperationTreeWalker.Mages.Core.Ast.ITreeWalker.Visit(InvalidExpression expression)
   at Mages.Core.Ast.Expressions.InvalidExpression.Accept(ITreeWalker visitor)
   at Mages.Core.Ast.Walkers.OperationTreeWalker.Handle(BinaryExpression expression, Function function)
   at Mages.Core.Ast.Walkers.OperationTreeWalker.<>c.<.cctor>b__57_20(OperationTreeWalker walker, BinaryExpression expr)
   at Mages.Core.Ast.Walkers.OperationTreeWalker.Mages.Core.Ast.ITreeWalker.Visit(BinaryExpression expression)
   at Mages.Core.Ast.Expressions.BinaryExpression.Accept(ITreeWalker visitor)
   at Mages.Core.Ast.Walkers.OperationTreeWalker.Handle(BinaryExpression expression, Function function)
   at Mages.Core.Ast.Walkers.OperationTreeWalker.<>c.<.cctor>b__57_21(OperationTreeWalker walker, BinaryExpression expr)
   at Mages.Core.Ast.Walkers.OperationTreeWalker.Mages.Core.Ast.ITreeWalker.Visit(BinaryExpression expression)
   at Mages.Core.Ast.Expressions.BinaryExpression.Accept(ITreeWalker visitor)
   at Mages.Core.Ast.Walkers.OperationTreeWalker.Mages.Core.Ast.ITreeWalker.Visit(SimpleStatement statement)
   at Mages.Core.Ast.Statements.SimpleStatement.Accept(ITreeWalker visitor)
   at Mages.Core.Ast.Walkers.OperationTreeWalker.Mages.Core.Ast.ITreeWalker.Visit(BlockStatement block)
   at Mages.Core.Ast.Statements.BlockStatement.Accept(ITreeWalker visitor)
   at Mages.Core.Ast.StatementExtensions.MakeRunnable(IEnumerable`1 statements)
   at Mages.Core.Engine.Interpret(String source)
   at Microsoft.PowerToys.Run.Plugin.Calculator.CalculateEngine.Interpret(String input, CultureInfo cultureInfo)
   at Microsoft.PowerToys.Run.Plugin.Calculator.Main.Query(Query query)
Exception source     : Mages.Core
Exception target site: Void Mages.Core.Ast.IValidationContext.Report(Mages.Core.ParseError)
Exception HResult    : -2146233088
-------------------------- End exception --------------------------

(The other type is because the config of various built-in apps are not found. I think you have removed them.)

@jaimecbernardo

  1. Do we need a separate issue for this exception?
  2. Do we need an issue because of the incorrect query command ({query}) in logged exception?
  3. Do we need an issue for the program plugin exceptions because of the uninstalled store apps (see bug report)?
jaimecbernardo commented 3 years ago

@htcfreek, I believe this is because of the addition of calculator in global results in the settings. The calculator engine throws an exception so we catch and log it, but I assume it's an expected exception in this case. I don't think issues are needed for these, we're mostly just logging everything.

yuru7 commented 3 years ago

The same behavior in my environment. It seems that the results from the Windows Search plugin are not highlighted. Can see this by searching with direct activation command ?.

dedavis6797 commented 3 years ago

This is an interesting bug. I can't reproduce either the inconsistent highlighting or incorrect selection highlighting from a normal search. How often does it occur for you @CombeeMike?

Using the ? activation phrase, no highlighting occurs at all on my device. The other activation phrases seem to work though.

yuru7 commented 3 years ago

This is an interesting bug. I can't reproduce either the inconsistent highlighting or incorrect selection highlighting from a normal search. How often does it occur for you @CombeeMike?

@dedavis6797 This happens when the first result is the output from the Windows Search plugin and the second result is something else.

CombeeMike commented 3 years ago

This is an interesting bug. I can't reproduce either the inconsistent highlighting or incorrect selection highlighting from a normal search. How often does it occur for you @CombeeMike?

Using the ? activation phrase, no highlighting occurs at all on my device. The other activation phrases seem to work though.

@dedavis6797

Not sure how to properly quantify this but both issues (missing & incorrect highlighting) happen on a very regular basis for me. I think @yuru7 is right in assuming that this only happens for search plugin results so I'd guess the following (only a wild guess):

aaronbieber commented 2 years ago

I am also experiencing this exact bug, and the above summaries appear to be consistent with my observations (the first result must be from the search plugin to observe the issue).

I've attached a bug report zip of my own in case it helps to diff the two: PowerToysReport_2022-01-11-11-33-33.zip

This is what I see, which looks like the same behavior as OP's second screen recording (pressing enter will open the search result, not the URL): image

CombeeMike commented 2 years ago

I'm still having this problem which is really annoying in combination with stuff like this TBH.

However, I think this is now easier to reproduce with the "Global sort order score modifier":

https://user-images.githubusercontent.com/30658772/196896393-6cd72557-b5d4-4c3a-92c5-82d5ca317387.mp4

FYI, like I also stated in #12856 multiple times: I literally never started the Groove Music app from PT run, whilst I run Show Music Tab.exe on an almost daily basis which makes it really annoying that the Groove Music app is always selected first when searching for music...

Jay-o-Way commented 9 months ago

Is this still an issue with the latest version? /needinfo

CombeeMike commented 9 months ago

@Jay-o-Way Yes, this is still happening to me but slightly different:

https://github.com/microsoft/PowerToys/assets/30658772/9a1f3292-ca89-445d-8791-82acd27cb04f

Jay-o-Way commented 9 months ago

Pinging @htcfreek