end
Jeff
In short: it depends where you’re printing it.
The raw bytes streaming from your program’s $stdout stream include a
bunch of digits (value 0x30 to 0x39) and the odd “\b” (0x08). It’s up
to the terminal/console/etc. that receives them and formats them for
display to interpret the 0x08-bytes the way you intended.
Where are you running said script? (Which operating system, terminal
emulator, etc.?)
end
Jeff
In short: it depends where you’re printing it.
The raw bytes streaming from your program’s $stdout stream include a
bunch of digits (value 0x30 to 0x39) and the odd “\b” (0x08). It’s up
to the terminal/console/etc. that receives them and formats them for
display to interpret the 0x08-bytes the way you intended.
Where are you running said script? (Which operating system, terminal
emulator, etc.?)
I’m on a Mac, running Aptana Studio 3. Does that help?
I’m afraid it doesn’t help me, since I’m not a Mac user. From what I
can see (although it’s hard to find any real information) Aptana
Studio seems to use the system’s built-in terminal, and while I’ve
seen some comments on the OSX terminal not handling keyboard
backspace/delete propertly, all the proposed solutions imply that
actually printing a ^H / 0x08 / “\b” should work.
Hopefully someone else can help you.
By the way, your loop works fine in my Linux terminal.
I’m on a Mac, running Aptana Studio 3. Does that help?
I’m afraid it doesn’t help me, since I’m not a Mac user. From what I
can see (although it’s hard to find any real information) Aptana
Studio seems to use the system’s built-in terminal, and while I’ve
seen some comments on the OSX terminal not handling keyboard
backspace/delete propertly, all the proposed solutions imply that
actually printing a ^H / 0x08 / “\b” should work.
Hopefully someone else can help you.
By the way, your loop works fine in my Linux terminal.
Any others that can help with this? I’m running RubyMine on Mac and
experiencing the same thing with the \b not properly backspacing.
All I know is that the terminal emulators built into editors and IDEs
like RubyMine often don’t support the full range of interactions
possible in a proper terminal emulator, like Terminal or iTerm2. It’s
possible JetBrains just didn’t implement output of the backspace
character (ASCII 8); I believe it’s very seldom used in actually
programs.
Long story short: Use a real terminal, like Terminal or iTerm2.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.