Re: bug in position()
- Posted by "Juergen Luethje" <j.lue at gmx.de> Sep 27, 2005
- 471 views
Robert Craig wrote: > Robert Craig wrote: > >> jacques desch=EAnes wrote: >> >>> As windows consoles may have more than 25 lines, there is a bug with >>> the actual implementation of position(). >>> If line is greater than 25 euphoria crash. (tested on windows xp pro) >>> >>> exemple: >>> }}} <eucode> >>> include graphics.e >>> sequence pos >>> pos = get_position() >>> position(pos[1],pos[2]-1) -- crash if pos[1]>25 >>> </eucode> {{{ >> >> Ok, thanks Jacques. >> I duplicated the problem on my machine. >> I'll fix it for the next release. >> A couple of other people have reported similar >> problems with consoles over 25 lines. It's not just 2.5, >> but earlier releases too. Just for the sake of completeness: The problem does *not* exist on my Windows 98 machine. Someone else reported to me the same problem under Win 2000 SP4. I could duplicate it under Windows XP, using a console window with 25(!) lines, so not only consoles with over 25 lines are affected. I used something like
pos = get_position() position(pos[1], 1)
I don't have a Windows XP machine here right now, and unfortunately I forgot to write down the error message, but as far as I recall it was something like "Can't move cursor to line 27" or so. So it seems to be a bug in get_position() rather than position(). pos[1] is provided by get_position(), which should always be an existing line, shouldn't it? > As a quick fix, try calling text_rows() > in graphics.e. That seems to tell Euphoria about the larger number > of lines, and stop it from giving a false error report. e.g. > > }}} <eucode> > include graphics.e > sequence pos > > if text_rows(43) then > end if > pos = get_position() > position(pos[1],pos[2]-1) -- crash if pos[1]>25 > </eucode> {{{ That worked for me, too. Thanks! > The ed editor does that, and it handles > console windows with a large number of lines. Regards, Juergen -- Have you read a good program lately?