>The escape reply should always come in as a single unit >without interspersed characters
Yabbut... if the save/move/probe/restore is issued in a single write() call then the (eventual) response can be trusted to give you an accurate size. While the returned sequence will always be contiguous it could be split over more than one read() call due to VMIN/VTIME, phase of the moon, etc., and could be preceded or followed by unrelated user input activity. All of which has to be sorted out. There will always be border cases for a where-am-I probe, due to shared tty devices. It's not 100% reliable, and I recommend against it. I think the best solution (best as in relatively easy to implement, yet as foolproof as can be had) is to use the probe once to query width, and run open-loop thereafter while using a ^L (or whatever) to resync the view if it gets messed up for any reason. In other words, just what shells were doing 20 years ago. (Assume your width/height, and if you ever find an intact size sequence in the input modify the variables accordingly and move on. Asynchronous state-driven, rather than request/response in nature.) You could probably justify probing once per prompt, if you were worried about SIGWINCH type scenarios. It might be nice, however, if your shell was still capable of running against an ASR-33, or ADM-3, or some other non-VT100 type device, so you'd need to know when not to probe. (TERM= setting? set -o setting?) >The really _fun_ part is where the user hits cursor up followed >by capital R. This used to be handled by noting that the characters were received far enough apart that they couldn't be considered to be an automatic response, and thus weren't candidates for functions but rather just individual keystrokes. -- Jim _______________________________________________ busybox mailing list [email protected] http://lists.busybox.net/mailman/listinfo/busybox
