You'll want to check out the Curses package. It consults a database to look up the appropriate escape codes for your terminal. Also, it'll allow you to deal with screen drawing at a much higher level api.
| [reply] [d/l] |
You don't want to hardcode them. At the least you want to use a module like Term::Cap to lookup the specific sequences by a capability name; more likely you'd want to use something like Curses which will give you a higher level drawing API and handle the grunt work for you.
The cake is a lie.
The cake is a lie.
The cake is a lie.
| [reply] |
| [reply] |
I was trying to have vi command-line functionality within my script (not by launching vi with a temporary file), and after following a suggestion about the Term::ReadLine::Gnu, but I found that it didn't work exactly the way I wanted, or I didn't know how to use it.
However, this is exactly what I want and I'm using it correctly -> Term::ReadLine::Zoid
All vi functionality including an automatic history buffer is contained in it.
Thanks guys.
| [reply] |
That's sort of a raw, hardcoded (and unreliable) way of doing what probably ought to be done with Curses. What it's doing is printing terminal control codes without much regard for what the terminal is. Nearly every terminal today responds to most of the same codes, so it probably won't break much, but using a library to handle those functions will be easier to read and more reliable anyway.
| [reply] |
Yes, definitely curses. This is a package that was specifically designed to handle TTY terminals or their equivalent, allowing you to express what you want to do, at a fairly high level, and have curses do it.
| |