From: shevegen@... Date: 2018-04-17T16:24:16+00:00 Subject: [ruby-core:86562] [Ruby trunk Bug#14691] ANSI Erase in Line not working properly in Windows Issue #14691 has been updated by shevegen (Robert A. Heiler). > has an off by one error It's always these two major problems in the fields of computer and programming: - Giving something a good name (see matz's recent comment on a matz bot AI rejecting not ideal names for an API) - Simplicity versus Complexity in general - Off by one errors :D ---------------------------------------- Bug #14691: ANSI Erase in Line not working properly in Windows https://bugs.ruby-lang.org/issues/14691#change-71503 * Author: rsranger65 (Alex Gittemeier) * Status: Open * Priority: Normal * Assignee: * Target version: * ruby -v: ruby 2.5.1p57 (2018-03-29 revision 63029) [x64-mingw32] * Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN ---------------------------------------- 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 -- https://bugs.ruby-lang.org/ Unsubscribe: