Posted on Dec 17, 2009

win32console upcoming changes and feedback

For the ones not aware of, win32console (originally here, gemified here) is a project that provides ANSI coloring for Windows.

Yeah, Windows doesn’t do ANSI coloring like any POSIX terminal, and it has it’s own API with extended control of the console functionality.

UPDATE: Please see this post for the beta1 release of new win32console.

So, I took over the project long ago, since required a couple of fixed. You could find the code here at GitHub

I must say that my backyard and house is getting crowded. Lot of small Open Source projects that require attention and some of those that require some special care, like this case.

What do I mean by this?

win32console do more than just fancy colors, it also translates the current console page back and forth using some clever but not portable character extrapolation…

Now, Ruby 1.9 doesn’t like you do that, not at all.

So wonder, what if I just get rid of that? How much of win32console features are being used beyond the ANSI coloring?

I just verified that tweak work with cucumber in 1.8 and 1.9, but dunno other user cases.

Want to know all that, since I’m creating a much simpler solution that uses FFI and will provide colors for both MRI and JRuby, no extension compilation and will deprecate the need of win32console.

What do you think? Please let me know your thoughts in the comments.

Thank you :)

8 Comments

  • Will Green says:

    I am unaware of any other use for win32console, so I say, go for it!

  • Vit Ondruch says:

    I’m installing win32console just for ANSI support. I don’t care about any other feature …

  • jcangas says:

    also only ANSI support :)

  • raggi says:

    Yeah, I’ve never used win32console for anything else.

    I think the main other useful thing for any win32 console lib is non-blocking getchar, which is also in highline, etc. and now rbreadline too, so let rip!

  • win32console 1.3.0 prerelease…

    I mentioned in previous post that I was working in a updated version of win32console. So, just pushed to Gemcutter the prerelease version (_beta1_) so you guys can test with your current Cucumber/RSpec scenarios. How to install prerelease versions? All…

  • Thanks a lot for this Luis! I’ll do my best to make sure the next Cucumber release uses this. Cucumber currently handles the codepage stuff like this:

    http://github.com/aslakhellesoy/cucumber/blob/1fcfb215075d556f15cb7dfa3c069189306e56dd/lib/cucumber/formatter/unicode.rb

    This hackery is used both by JRuby (where there is no win32console) and MRI. Now that win32console (which is only available on MRI) has a built-in way to detect the output codepage I’d like to use that – but we still need to handle the JRuby case.

    Do you have any tips on how to deal with this? It would be great to have a chat on IRC about this.

    Thanks again,

    Aslak

  • Luis says:

    @Aslak Hellesøy: Thanks Aslak for the pointer.

    win32console always offered a way to retrieve the console output, but was underused. Dealing with 1.9 made me notice that.

    Anyhow, I have two options: a C-extension version for MRI and the Win32API powered by FFI for JRuby. That will work with JRuby 1.5 as Win32API is now complete and functional.

    If that works, then the need for a separate code or simplified tool will rend useless.

    Cheers!

  • Would this new FFI thing work with IronRuby too? Cucumber needs colours and codepage detecting for MRI, JRuby and IronRuby on Windows.