Re: Phix, numbers, printf, log10

new topic     » goto parent     » topic index » view thread      » older message » newer message
RobertS said...

Doesn't work with Linux, at least not for now. The input editor needs video_config() for the screen width, but even more important are get_position() and position() for the cursor, and since they don't work under Linux,

Must be Phix specific? get_position() and position() work fine under OE iirc - though if memory serves correctly this is tied to ncurses (which Phix is not likely using).

I suspect that this is what ncurses does internally - on startup (before any user input has happened) set the position by writing to stdout. That way the position is at some known fixed value.

Use a state machine of some kind, so with every write to the screen, a variable gets updated with the current position.

When writing to the screen, prefix each write with the escape sequence to set the position - this minimizes sides from other processes writing on the terminal and changing the position behind our backs.

Finally, when getting the current position, consult the variable instead of asking the terminal. That way there's no issue of reading from stdin and losing data.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu