Re: graphics.e on Linux
- Posted by jimcbrown (admin) May 04, 2009
- 1074 views
IMHO this is a bug in the Unix console code of Euphoria. It should be possible to do this, in fact there is a working example at http://unixwiz.net/techtips/wsize.c (which should be integrated into Euphoria).
I have been experimenting with the position(line,column) procedure and get_position() function from the graphics.e include file for Linux running in a terminal window.
It appears from my tests that get_position() returns a line and column that is based on the line where the cursor was located when the program calling the function began. The position(line,column) procedure seems to locate the cursor at the beginning of the terminal window as I expected.
Is this the intended results of get_position()? If so, is there a way to determine the actual line within the terminal window based on the current position of the cursor?
I have seen other applications using position() and get_position that seem to work, but these seem to define an area of the screen for their use and don't depend on where the cursor is in the terminal window.
I'm probably just missing something simple again. The code for my simple (not very elegant) test case is below. Again this is run in a terminal window on Linux (Ubuntu 9.0.4)) which uses a Gnome desktop. I open a terminal window and run eui pos_test. Then (without closing and restarting the terminal window) I run eui pos_test again. Both times get_position reports the same line and column numbers, even though on the second call it appears the line number should not be the same. The text written after calling position() is written in the same place each time.
I would appreciate any help anyone can provide on this.
Thanks!
George
My code in a file pos_test is
-- test position and get_position include graphics.e sequence pos integer line, col puts(1,"\n\n\n\n****") pos = get_position() line = pos[1] col = pos[2] print(1,pos) position(line,col) puts(1,"**********\n\n\n\n")