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

Strange repl eager-eval behavior #37585

Closed
bl-ue opened this issue Mar 3, 2021 · 2 comments · Fixed by #46857
Closed

Strange repl eager-eval behavior #37585

bl-ue opened this issue Mar 3, 2021 · 2 comments · Fixed by #46857
Labels
repl Issues and PRs related to the REPL subsystem.

Comments

@bl-ue
Copy link
Contributor

bl-ue commented Mar 3, 2021

  • Version: output of node -v
  • Platform: Darwin iMac.local 20.3.0 Darwin Kernel Version 20.3.0: Thu Jan 21 00:07:06 PST 2021; root:xnu-7195.81.3~1/RELEASE_X86_64 x86_64
  • Subsystem: repl?

What steps will reproduce the bug?

  1. start the node repl: node

  2. type a few numbers in but don't press enter, e.g. 1<backspace>2<backspace>3<backspace>. no eager-eval should be printed

  3. type a number followed by a decimal point e.g. 1.<backspace>. the eager-eval should be immediately triggered. When you type in 1 again (without the decimal point), you'll see eager-eval prints 1, but only for 1, not any other numbers

  4. Type a different number followed by a period e.g. 6.<backspace>. Now eager-eval will only print when you type 6

How often does it reproduce? Is there a required condition?

Always. None.

What is the expected behavior?

eager-eval should print the number regardless of the decimal point.

What do you see instead?

eager-eval only prints the number you typed if just before you typed it, you typed the number with a decimal point

Additional information

Introduced in version 13.4.0 and 12.17.0. Looks like it's caused by #30811 (which introduced the feature in the first place)

@mvduin
Copy link

mvduin commented Mar 8, 2021

It seems more generally that once the preview has displayed some particular number, that specific number subsequently again shows up in preview when you type in that number (but not when you type in some other number). The specific expression you use to get it displayed the first time, whether it's 1. or 2-1 or +"1", doesn't seem to matter.

Here's an animated gif of the phenomenon:

@PoojaDurgad PoojaDurgad added the repl Issues and PRs related to the REPL subsystem. label Mar 10, 2021
@BridgeAR
Copy link
Member

The current logic is to ignore the preview if it's identical to the input and if it's not identical to the last visible preview.

Showing output that is identical to the input does not provide any benefit and is therefore mainly distracting. Visualizing the last identical preview seems to have caused the confusion here. I can open a PR to stop visualizing something for the last identical match, if that helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
repl Issues and PRs related to the REPL subsystem.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants