0

Printing at the last column forces carriage to move to the next line. Is there a way to avoid that?

I assume that this is possible via editing Console’s buffer. I’m not sure if that’s possible via Ruby. Probably this got something to do with FFI. Something similar was asked and answered here.

Thank you for any advice.

MOPO3OB
  • 383
  • 3
  • 16
  • What OS, what console? Please provide sample code of what you've tried so far. – Casper Mar 05 '18 at 09:50
  • @Casper it says Windows Console, that’s the name for default one. I’d like to provide some code. But I simply don’t know where to start with this problem, the only thing I know is that if you don’t print on last column then carriage won’t go to the next line. – MOPO3OB Mar 05 '18 at 15:48
  • Ok. Yeah sorry I didn't notice that. It's possible on most Unix/Linux consoles, but on Windows there is no direct Ruby solution as you figured out already from the linked answer. You could try IronRuby, which is integrated with Dot Net, and that way you'll have easier access to the C# methods from the example. Otherwise you need to find the equivalent C/C++ API to be able to call those methods with FFI. Here is some further discussion on C# access from Ruby: https://stackoverflow.com/questions/265879/can-ruby-import-a-net-dll – Casper Mar 05 '18 at 16:32
  • @Casper thank you for this information, I think that might be the exact thing I need. Keep in mind that it’s better to specify whatever is being used to run code under Windows. It’s not always the Windows Console, there are also different UNIX-like terminal (e.g. Cygwin64) which don’t behave like Windows Console, but they also don’t behave exactly like Linux’s or macOS’s terminals. Thanks again for the starting point. I needed it. – MOPO3OB Mar 05 '18 at 17:42

0 Answers0