[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

irb and readline

List Recv

7/17/2006 5:43:00 PM

I'm getting funny behavior when using irb (readline) on Windows. When
I go back to a very long line in the history, I can't edit it. After
hit the left arrow a few times, the cursors moves *up* a line, and not
left anymore. At that point, I can't figure out what I'm typing, and
so I have to Ctrl-C.

Does anyone else experience this problem? More importantly, is there a
way to fix it?

Any ideas or help appreciated.

14 Answers

Gavin Kistner

7/17/2006 7:43:00 PM

0

listrecv@gmail.com wrote:
> I'm getting funny behavior when using irb (readline) on Windows. When
> I go back to a very long line in the history, I can't edit it.

Since you asked, yes, I experience this too. You're not alone.

Unfortunately, I cannot answer your second question (how to fix this).

List Recv

7/17/2006 10:16:00 PM

0


Phrogz wrote:
> listrecv@gmail.com wrote:
> > I'm getting funny behavior when using irb (readline) on Windows. When
> > I go back to a very long line in the history, I can't edit it.
>
> Since you asked, yes, I experience this too. You're not alone.
>
> Unfortunately, I cannot answer your second question (how to fix this).

What is the correct place to submit this as a bug report, then?

Peña, Botp

7/18/2006 1:17:00 AM

0

From: listrecv@gmail.com [mailto:listrecv@gmail.com]
# I'm getting funny behavior when using irb (readline) on Windows. When
# I go back to a very long line in the history, I can't edit it. After
# hit the left arrow a few times, the cursors moves *up* a line, and not
# left anymore. At that point, I can't figure out what I'm typing, and
# so I have to Ctrl-C.
# Does anyone else experience this problem? More importantly,
# is there a
# way to fix it?
# Any ideas or help appreciated.

also experienced that, but when i upgraded to latest one-click, the odd behavior disappeared.

irb(main):003:0> x="athas dfjalsd thsi is a very long line of text asd;fljas;dlf
jas;dlfja;sdlfjas ldjflakj djfkjdf jdkfjsdkfjskdfjksdjf;alskdjflasdjflasjdflasdj
fa;lsdfjalsdkjf jdkfjdkjfkdjfdlksjfslkdjfslkdjfkdjf dkfjkdjfkdjfkd jfl jflskdjfl
aksjdflasdkjflsk djfksjdf klsjdf;lakdsjf sjdflkajsdflksjdflaskjflaskdjf;alsdkfja
;sldkfj;lsd fja;lsd ja;lfk a;ldfj asj;lsdfja;sdlfkj sldkfjslkjfsldjf ;slfjasldjf
a;sdl fasd;lfjs djflskdjf lsdkjf sldjfslkdjf lsf"
=> "athas dfjalsd thsi is a very long line of text asd;fljas;dlfjas;dlfja;sdlfja
s ldjflakj djfkjdf jdkfjsdkfjskdfjksdjf;alskdjflasdjflasjdflasdjfa;lsdfjalsdkjf
jdkfjdkjfkdjfdlksjfslkdjfslkdjfkdjf dkfjkdjfkdjfkd jfl jflskdjflaksjdflasdkjflsk
djfksjdf klsjdf;lakdsjf sjdflkajsdflksjdflaskjflaskdjf;alsdkfja;sldkfj;lsd fja;
lsd ja;lfk a;ldfj asj;lsdfja;sdlfkj sldkfjslkjfsldjf ;slfjasldjfa;sdl fasd;lfjs
djflskdjf lsdkjf sldjfslkdjf lsf"
irb(main):004:0> quit

C:\Documents and Settings\botp>irb --version
irb 0.9.5(05/04/13)

C:\Documents and Settings\botp>ruby -v
ruby 1.8.4 (2006-04-14) [i386-mswin32]


not sure if this helps though.
kind regards -botp

List Recv

7/18/2006 3:05:00 PM

0

I'm running exact same ruby/irb vers, and still get this. Not always -
I wasn't able to figure out exactly when it happens.

Where can I report this bug?


Peña wrote:
> From: listrecv@gmail.com [mailto:listrecv@gmail.com]
> # I'm getting funny behavior when using irb (readline) on Windows. When
> # I go back to a very long line in the history, I can't edit it. After
> # hit the left arrow a few times, the cursors moves *up* a line, and not
> # left anymore. At that point, I can't figure out what I'm typing, and
> # so I have to Ctrl-C.
> # Does anyone else experience this problem? More importantly,
> # is there a
> # way to fix it?
> # Any ideas or help appreciated.
>
> also experienced that, but when i upgraded to latest one-click, the odd behavior disappeared.
>
> irb(main):003:0> x="athas dfjalsd thsi is a very long line of text asd;fljas;dlf
> jas;dlfja;sdlfjas ldjflakj djfkjdf jdkfjsdkfjskdfjksdjf;alskdjflasdjflasjdflasdj
> fa;lsdfjalsdkjf jdkfjdkjfkdjfdlksjfslkdjfslkdjfkdjf dkfjkdjfkdjfkd jfl jflskdjfl
> aksjdflasdkjflsk djfksjdf klsjdf;lakdsjf sjdflkajsdflksjdflaskjflaskdjf;alsdkfja
> ;sldkfj;lsd fja;lsd ja;lfk a;ldfj asj;lsdfja;sdlfkj sldkfjslkjfsldjf ;slfjasldjf
> a;sdl fasd;lfjs djflskdjf lsdkjf sldjfslkdjf lsf"
> => "athas dfjalsd thsi is a very long line of text asd;fljas;dlfjas;dlfja;sdlfja
> s ldjflakj djfkjdf jdkfjsdkfjskdfjksdjf;alskdjflasdjflasjdflasdjfa;lsdfjalsdkjf
> jdkfjdkjfkdjfdlksjfslkdjfslkdjfkdjf dkfjkdjfkdjfkd jfl jflskdjflaksjdflasdkjflsk
> djfksjdf klsjdf;lakdsjf sjdflkajsdflksjdflaskjflaskdjf;alsdkfja;sldkfj;lsd fja;
> lsd ja;lfk a;ldfj asj;lsdfja;sdlfkj sldkfjslkjfsldjf ;slfjasldjfa;sdl fasd;lfjs
> djflskdjf lsdkjf sldjfslkdjf lsf"
> irb(main):004:0> quit
>
> C:\Documents and Settings\botp>irb --version
> irb 0.9.5(05/04/13)
>
> C:\Documents and Settings\botp>ruby -v
> ruby 1.8.4 (2006-04-14) [i386-mswin32]
>
>
> not sure if this helps though.
> kind regards -botp

Dave Burt

7/19/2006 10:29:00 AM

0

listrecv@gmail.com wrote:
> I'm getting funny behavior when using irb (readline) on Windows. When
> I go back to a very long line in the history, I can't edit it. After
> hit the left arrow a few times, the cursors moves *up* a line, and not
> left anymore. At that point, I can't figure out what I'm typing, and
> so I have to Ctrl-C.
>
> Does anyone else experience this problem? More importantly, is there a
> way to fix it?
>
> Any ideas or help appreciated.

On Windows, under the cmd.exe shell, you don't need readline for
history, cmd.exe provides it by default. My preference is to run
irb --noreadline. As an added bonus, that means I can paste text with
tabs in it into the irb session.

Cheers,
Dave

List Recv

7/19/2006 5:43:00 PM

0


Dave Burt wrote:
> On Windows, under the cmd.exe shell, you don't need readline for
> history, cmd.exe provides it by default. My preference is to run
> irb --noreadline. As an added bonus, that means I can paste text with
> tabs in it into the irb session.


Good tip. The only problem is that this breaks tab completion also,
which I find very helpful.

However, you may have found the cause of the bug. Perhaps the fact
that cmd.exe is providing its own history interferes with irb's
readline history. Is there anyway to shut off cmd's history?

(As an aside, I don't think it's possible to run a console program in
Windows without going through cmd.exe)

Sean O'Halpin

7/19/2006 7:31:00 PM

0

On 7/19/06, listrecv@gmail.com <listrecv@gmail.com> wrote:

> Is there anyway to shut off cmd's history?
Doesn't appear to be. It used to be "keys off" but on XP:

C:\>keys /?
Enables or disables command line editing on DOS system

This is present for Compatibility with DOS systems. It has no effect
under Windows XP, as command line editing is always enabled.

>
> (As an aside, I don't think it's possible to run a console program in
> Windows without going through cmd.exe)
>

Not true. For example, try double-clicking on a .rb file in Explorer -
that runs ruby as a console program without going through cmd.exe.

Regards,
Sean

Gavin Kistner

7/19/2006 7:39:00 PM

0

Dave Burt wrote:
> On Windows, under the cmd.exe shell, you don't need readline for
> history, cmd.exe provides it by default. My preference is to run
> irb --noreadline.

Nice, that solves it for me, too.

Any .bat geeks able to tell me how to modify the irb.bat file that
comes with the one-click installer so that this option is always
specified?

List Recv

7/19/2006 9:51:00 PM

0


Sean O'Halpin wrote:
> Not true. For example, try double-clicking on a .rb file in Explorer -
> that runs ruby as a console program without going through cmd.exe.

I believe that there is still a cmd.exe running in the background,
powering it.

If I'm wrong, is there a way to make a .bat script invoke irb, but skip
cmd.exe?

Sean O'Halpin

7/19/2006 10:47:00 PM

0

On 7/19/06, listrecv@gmail.com <listrecv@gmail.com> wrote:
>
> Sean O'Halpin wrote:
> > Not true. For example, try double-clicking on a .rb file in Explorer -
> > that runs ruby as a console program without going through cmd.exe.
>
> I believe that there is still a cmd.exe running in the background,
> powering it.

Nope. It's spawned directly. Make sure you don't have cmd.exe running,
double-click a .rb file containing just the line
gets
to make sure it waits for input, check Task Manager and you'll see
that there is no cmd.exe running.

>
> If I'm wrong, is there a way to make a .bat script invoke irb, but skip
> cmd.exe?
>

No - .bat (& .cmd) files are scripts that are interpreted by cmd.exe.
However, you could have an irb.rb file containing this (pinched from
irb.bat):

require "irb"

if __FILE__ == $0
IRB.start(__FILE__)
else
# check -e option
if /^-e$/ =~ $0
IRB.start(__FILE__)
else
IRB.setup(__FILE__)
end
end

which would bypass cmd.exe. However, command line history seems to be
built into the console these days (i.e. it's nothing to do with
cmd.exe).

Regards,
Sean