Skip to content

Strange repl eager-eval behavior #37585

Description

@bl-ue
  • 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)

Activity

  1. mvduin commented on Mar 8, 2021

    @mvduin

    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:

  2. added
    replIssues and PRs related to the REPL subsystem.
    on Mar 10, 2021
  3. BridgeAR commented on Apr 10, 2021

    @BridgeAR
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    replIssues and PRs related to the REPL subsystem.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions