IRB : Auto_Indent in Windows

Hi. I managed to set auto_indent, but it just don't work quite the way
we expect, at least in Windows. eg, in irb console I type:

def my_method
  a = "some text"
  end

but I need (visually speaking)

def my_method
  a = "some text"
end

Can I fix it? or it's a limitation on Windows?

···

--
Posted via http://www.ruby-forum.com/.

Hi. I managed to set auto_indent, but it just don't work quite the way
we expect...
Can I fix it? or it's a limitation on Windows?

It's a limitation of IRB. If you find a fix, though, that would be
very very cool.

···

--
Giles Bowkett

Podcast: http://hollywoodgrit.blogspot.com
Blog: http://gilesbowkett.blogspot.com
Portfolio: http://www.gilesgoatboy.org
Tumblelog: http://giles.tumblr.com

No, is a IRB limitation.

There is no way "in advance" that IRB understand that you're doing
'end' and it should be indented one level lower than previous
indentantion.

IF tricky, adding something like that can create problems with users
just doing:

def foo; "bar"; end

and IRB trying "as you time" to reindent the code...

I'll suggest you code in some IDE, like Komodo or NetBeans that
automatically indent your code.

HTH,

Luis

···

On Dec 28, 1:24 pm, "Ken A." <ken.awam...@gmail.com> wrote:

Hi. I managed to set auto_indent, but it just don't work quite the way
we expect, at least in Windows. eg, in irb console I type:

def my_method
  a = "some text"
  end

but I need (visually speaking)

def my_method
  a = "some text"
end

Can I fix it? or it's a limitation on Windows?

It would need to re-write the line after the \n, which requires going up a line and re-writing.
or... it would require not echoing keys to the terminal.

Neither are easy to support on windows due to bugs and limitations in the curses and readline implementations, although I expect with some added complexity to irb (unless it's already there of course), this could be done quite trivially on *nix systems.

···

On 28 Dec 2007, at 16:32, Giles Bowkett wrote:

Hi. I managed to set auto_indent, but it just don't work quite the way
we expect...
Can I fix it? or it's a limitation on Windows?

It's a limitation of IRB. If you find a fix, though, that would be
very very cool.

--
Giles Bowkett

Podcast: http://hollywoodgrit.blogspot.com
Blog: http://gilesbowkett.blogspot.com
Portfolio: http://www.gilesgoatboy.org
Tumblelog: http://giles.tumblr.com

I expect with some
added complexity to irb (unless it's already there of course), this
could be done quite trivially on *nix systems.

Triviality is a relative term. I don't have the faintest idea where to
start on something like that but I would be thrilled to figure it out.
I'd throw it into my IRB enhancements gem quicker than the Flash plus
Red Bull. I think IRB just drops its output into STDOUT, so
repositioning it after the fact sounds pretty challenging. Would it
just be something to regex the output before dumping to STDOUT? I
think currently all the auto-indentation is handled by modifying the
prompt.

···

--
Giles Bowkett

Podcast: http://hollywoodgrit.blogspot.com
Blog: http://gilesbowkett.blogspot.com
Portfolio: http://www.gilesgoatboy.org
Tumblelog: http://giles.tumblr.com