Re: Linux: position() bug?
- Posted by jimcbrown (admin) Jan 24, 2012
- 1315 views
I hope you guys can fix it.... oh, and there's that irritating cursor positoning problem in Linux at startup. Or is that the tail of the same horse?
kenneth@kenneth-OptiPlex-360:~/euphoria.4.0.3$ kenneth@kenneth-OptiPlex-360:~/euphoria.4.0.3$ ed.ex --<<<< executing ed.ex without an argument kenneth@ken$ --<<----- $ marks the prompt, 2 or 3 lines up, and minus 10 columns or so. file name: kenneth@kened.ex file name:
That thing has been around forever. I am not sure that it has ever worked since Rob dropped ncurses.
Your efforts are appreciated. Regards, Kenneth Rhodes
Also confirmed. This is a slightly different bug but in the same region of code - the issue here is that we never initialize the position of the screen when we start up by reading it from the terminal, instead we assume it's at 1,1 (the top of the screen).
For now, the following code will work around the issue by manually reading this value and then calling position() to set it (the cursor should not move, but the call to position() will update Euphoria's internal cursor position to match the terminals).
procedure get_real_text_starting_position() sequence sss = "" integer ccc puts(1, 27&"[6n") while 1 do ccc = get_key() if ccc = 'R' then exit end if if ccc != -1 then sss &= ccc end if end while sss = sss[3..$] sequence aa, bb aa = value(sss[1..find(';', sss)-1]) bb = value(sss[find(';', sss)+1..$]) position(aa[2], bb[2]) end procedure ifdef LINUX then get_real_text_starting_position() end ifdef
I tested this by putting it in after line 46 of ed.ex (after the include std/text.e line but before the constant TRUE line).