Re: bug in position()
- Posted by jacques deschênes <desja at globetrotter.net> Sep 25, 2005
- 453 views
The bug that get_position() return the right line number event if its greater than 25 so position() should not crash when passing it parameters obtained from get_position() as shown in my exemple. jacques Chris Burch wrote: > > jacques deschênes wrote: > > > > > > Hi Robert, > > 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> {{{ > > > > regards, > > Jacques Deschênes > > > > p.s. Folks forget about my previous message, I read message sequentially and > > don't > > check other's > > reply before replying. > > > > Hi > > I've never thought of this a bug, just a feature of the language. Some screens > have lines > > 25, and if you have set the screen to one of these modes, then you can write > > to > > 25. SCREEN_LINES tells you how long the screen is > > SCREEN_LINES = vid_conf[VC_LINES] > SCREEN_COLS = vid_conf[VC_COLUMNS] > > > then just wrap position with a check for the length of the screen to prevent > crashes. > > Please, any changes should not affect the abilty to write beyond 25 lines > > Chris > > <a > href="http://members.aol.com/chriscrylex/euphoria.htm">http://members.aol.com/chriscrylex/euphoria.htm</a> > <a href="http://uboard.proboards32.com/">http://uboard.proboards32.com/</a> > <a > href="http://members.aol.com/chriscrylex/EUSQLite/eusql.html">http://members.aol.com/chriscrylex/EUSQLite/eusql.html</a> >