[TUHS] vi in cooked mode?

Diomidis Spinellis dds at aueb.gr
Fri Nov 4 05:43:44 AEST 2022

I remember being told back in the 1980s that vi would set the terminal 
to "cooked mode" when vi was in "insert mode", so as to reduce expensive 
context switching for each character typed.  Only vi's "command mode" 
would set the terminal to "raw mode" so as to provide immediate feedback 
on each (command) character typed.  This would be a clever system 
performance optimization, and would also explain designing vi around 
distinct insert and command modes.

However, I can't find such evidence even as far back as BSD 1.  It seems 
that in insert mode ESC was processed like any other character.


Cooked mode was only entered when scrolling in order to receive interrupts.


Also, for this scheme to work ESC would need to be mapped to an 
interrupt key, so as to allow exiting the cooked mode through the 
corresponding signal handler.  Again, grepping for ESC, did not show me 
any such code.

I also remember being told that this optimization was what allowed 
twenty students to concurrently perform interactive editing on a VAX 
11/780 (running 4.2BSD and then 4.3BSD), and that Emacs was not provided 
to students because it was always operating in raw mode.

Was I misled?  Was there perhaps a hacked version of vi that worked in 
this way?


More information about the TUHS mailing list