Pasting multi-line functions repeats their lines pointlessly

Abierto
#67,364 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
javascript, nodejs
Área
cli

Línea de trabajo

The bug is in the REPL's multi-line input redraw on Windows, so start in lib/repl.js and the readline-based line refresh logic that re-renders the buffer as the user pastes. Reproduce by pasting the multi-line Fib snippet into node on Windows and confirm the duplicated prompt lines. Done means the pasted function is echoed once per line with no repeated lines, and a test under test/parallel for REPL output passes.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Version

v26.13.0

Platform
Microsoft Windows NT 10.0.19045.0 x64
Subsystem

No response

What steps will reproduce the bug?
  1. Open Node.
  2. Paste:
Fib=I=>{// Iterative Fibonacci , I = Integer ≥ 0
	if(!Number.isInteger(I)||I<0)return'Please enter a positive integer or zero!'
	if(I===0||I===1)return I
	let a=0,b=1,c;--I;do{c=a+b;a=b;b=c}while(--I!==0)// # iterations = I-1
	return c
}// e.g. Fib(7) //➜ 13 , Fib(8) //➜ 21 , Fib(9) //➜ 34

You'll see that it looks like this:

node
Welcome to Node.js v26.13.0.
Type ".help" for more information.
Fib=I=>{// Iterative Fibonacci , I = Integer ≥ 0
Fib=I=>{// Iterative Fibonacci , I = Integer ≥ 0
Fib=I=>{// Iterative Fibonacci , I = Integer ≥ 0
| if(!Number.isInteger(I)||I<0)return'Please enter a positive integer
Fib=I=>{// Iterative Fibonacci , I = Integer ≥ 0
| if(!Number.isInteger(I)||I<0)return'Please enter a positive integer
Fib=I=>{// Iterative Fibonacci , I = Integer ≥ 0
| if(!Number.isInteger(I)||I<0)return'Please enter a positive integer
or zero!'
| if(I===0||I===1)return I
| let a=0,b=1,c;--I;do{c=a+b;a=b;b=c}while(--I!==0)// # iterations = I-1
| return c
| }// e.g. Fib(7) //➜ 13 , Fib(8) //➜ 21 , Fib(9) //➜ 34
[Function: Fib]

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

It happens every time.

What is the expected behavior? Why is that the expected behavior?

I expect it to work the way that it did in past versions of Node and also as the DevTools console works. Not repeat the same line like 5 times.

What do you see instead?

Lines being repeated, 3 times, 5 times, etc.

Additional information

No response

Lenguaje dominante
JavaScript
Estrellas
124k
Forks
38k
Merge medio
4 d 2 h
PR fusionados (30 d)
266

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de nodejs/node

Todos los issues de nodejs/node

Issues similares

Más issues de JavaScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.