Re: graphics.e on Linux
- Posted by georgeorr May 04, 2009
- 977 views
Chris -
I feel a little better that you found this difficult also! I have actually wrapped the GNU readline function for my application, but this seems like overkill. I can wrap the readline history routines also, so there is good in this. I was just hoping to be able to avoid platform specific routines and third party libraries. But if I can't,
Thanks for your insight. The helpfulness of others has always seemed a strength of this forum to me.
George
Hi
After a little experimentation, this would seem to be the case - you can't know the position of the cursor, until after you have called position(). As far as I can tell, this is because there's no way of getting the cursor position from bash, or passing it to an application.
include graphics.e sequence pos integer line, col pos = get_position() --doesn't matter where you start, always returns 1,1 line = pos[1] col = pos[2] printf(1,"%d,%d\n",{line, col}) position(15,15) puts(1,"***\n-------------------------------->") --returns the real cursor position pos = get_position() line = pos[1] col = pos[2] printf(1,"%d,%d\n",{line, col})
I tried with a (highly experimental and undeveloped) ncurses lib, but you have to open a new 'screen' with that, and kind of defeats the object. There are ways of returning to and from 'cooked' mode with curses, but again I'm not sure how to get the cursor position from the stdscr.
Why don't you just put a box in the middle of the screen, and edit in there?
Chris