[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

IRB : Auto_Indent in Windows

Ken Awamura

12/28/2007 4:24:00 PM

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-....

4 Answers

Giles Bowkett

12/28/2007 4:33:00 PM

0

> 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.bl...
Blog: http://gilesbowkett.bl...
Portfolio: http://www.gilesg...
Tumblelog: http://giles....

James Tucker

12/28/2007 4:53:00 PM

0

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.bl...
> Blog: http://gilesbowkett.bl...
> Portfolio: http://www.gilesg...
> Tumblelog: http://giles....
>


Luis Lavena

12/28/2007 5:20:00 PM

0

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?

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

Giles Bowkett

12/28/2007 10:02:00 PM

0

> 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.bl...
Blog: http://gilesbowkett.bl...
Portfolio: http://www.gilesg...
Tumblelog: http://giles....