Actions
Bug #14691
closedANSI Erase in Line not working properly in Windows
Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.5.1p57 (2018-03-29 revision 63029) [x64-mingw32]
Description
When I run the following commands in either the Windows 10 Command Prompt
ruby -e 'puts "Hello world!\e[D\e[D\e[K\nWhat is up?"'
ruby -e 'puts "Hello world!\e[D\e[D\e[0K\nWhat is up?"'
ruby -e 'puts "Hello world!\e[D\e[D\e[1K\nWhat is up?"'
I expect to get the same output as from:
printf "Hello world!\\e[D\\e[D\\e[K\nWhats up?\n"
printf "Hello world!\\e[D\\e[D\\e[0K\nWhats up?\n"
printf "Hello world!\\e[D\\e[D\\e[1K\nWhats up?\n"
Which is:
Hello worl
Whats up?
Hello worl
Whats up?
!
Whats up?
But instead I get:
d!
What is up?
d!
What is up?
d!
What is up?
The same behavior occurs in PowerShell as well, with appropriate changes to escaping (escaping the double quotes in the ruby code).
It appears that for the CSI [n] K
sequences, n=0 (the default) and n=1 are doing the same operation and that n=1 has an off by one error
Windows version: Version 10.0.16299 Build 16299
Actions
Like0
Like0Like0