Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1a 7/7/83; site rlgvax.UUCP Path: utzoo!linus!decvax!harpo!seismo!rlgvax!guy From: guy@rlgvax.UUCP (Guy Harris) Newsgroups: net.dcom Subject: Re: Xon/Xoff and editors Message-ID: <1380@rlgvax.UUCP> Date: Wed, 9-Nov-83 19:15:20 EST Article-I.D.: rlgvax.1380 Posted: Wed Nov 9 19:15:20 1983 Date-Received: Fri, 11-Nov-83 08:49:35 EST References: <200@denelcor.UUCP> Organization: CCI Office Systems Group, Reston, VA Lines: 56 One of the really nice features of screen editors is the "function-key" concept, in which a single keystroke can cause an action to take place, be it moving the cursor or justifying a paragraph. This is what screen editing is all about. But what does this require? In order to get every single character typed *as it is typed*, the editor must place the terminal in raw mode (as opposed to cooked - forget cbreak for now) WHAT? Why should we forget cbreak for now? It provides *exactly* what you're asking for, without turning of XON/XOFF, so it is extremely relevant to this discussion and cannot be left out. Admittedly, if you're running a version of UNIX prior to V7, you don't have CBREAK, but programs can be written to run, with some degradation, on V6 systems with the aid of conditional compilations (if you haven't upgraded to a V7 or later system, you have to expect a lot of things about UNIX to be considerably less nice). All the character-at-a-time input programs we've done here (our office automation system is screen-oriented, and it's a lot of code) runs in CBREAK mode, not in RAW mode. The main screen editors used here (one we did, and "vi") run in CBREAK mode, not in RAW mode. "vnews" runs in CBREAK mode, not in RAW mode. Most of the screen-oriented games that come with 4.xBSD run in CBREAK mode, not in RAW mode. There's a reason for this; in V7 (and its descendants), RAW mode was intended for binary data transmission (i.e., 8 bits come in to the line, the same 8 bits go to the process, and 8 bits go out of the process, the same 8 bits go out on the line, no more, no less) and CBREAK was probably *specifically* added for the benefit of screen editors and the like. It permits you to use the interrupt and quit characters (or disable them, if you wish), to use the XON and XOFF characters (or disable them, if you wish). It does not effect character output at all, so if your character-at-a-time input program wants tab expansion, or CRMOD handling, or delays, or parity checking and generation it can use them. However the very nature of raw mode is to pass through *all* characters to the editor, even XON and XOFF. That's why most screen oriented programs *don't use* raw mode. That is why XON/XOFF flow control is suspended by EMACS (and the Rand editor and vi). All these editors have ways to tailor your terminal to their language - and all require the specification of fill characters if required by the terminal. Yes, EMACS runs in raw mode. We don't have the Rand editor here, but "vi" damn well does *NOT* run in raw mode; it runs in cbreak mode. (Maybe "stty" lied to me, but I went into "vi" on one terminal and did an "stty" from another terminal to find out what mode the terminal running "vi" was in; the word "cbreak" appeared and the word "raw" did NOT.) The reason EMACS uses raw mode is that the search and quote commands are bound to the ^S and ^Q keys. Some versions of EMACS have been modified not to bind those functions to those keys and to run in CBREAK mode on VT100s. Guy Harris {seismo,ihnp4,allegra}!rlgvax!guy