The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
* [TUHS] vi in cooked mode?
@ 2022-11-03 19:43 Diomidis Spinellis
  2022-11-03 20:26 ` [TUHS] " Clem Cole
  2022-11-04 22:13 ` Mary Ann Horton
  0 siblings, 2 replies; 22+ messages in thread
From: Diomidis Spinellis @ 2022-11-03 19:43 UTC (permalink / raw)
  To: TUHS main list

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.

https://github.com/dspinellis/unix-history-repo/blob/BSD-1-Snapshot-Development/ex-1.1/ex_vops.c#L507

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

https://github.com/dspinellis/unix-history-repo/blob/BSD-1-Snapshot-Development/ex-1.1/ex_vadjust.c#L180

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?

-Diomidis

^ permalink raw reply	[flat|nested] 22+ messages in thread
* [TUHS] Re: vi in cooked mode?
@ 2022-11-03 20:17 Noel Chiappa
  0 siblings, 0 replies; 22+ messages in thread
From: Noel Chiappa @ 2022-11-03 20:17 UTC (permalink / raw)
  To: tuhs; +Cc: jnc

    > From: Diomidis Spinellis

    > 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.
    > ...
    > However, I can't find such evidence even as far back as BSD 1.

Maybe you're thinking of Multics Emacs, which had such a capability:

  https://multicians.org/mepap.html

  Noel

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2022-11-05 18:35 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-03 19:43 [TUHS] vi in cooked mode? Diomidis Spinellis
2022-11-03 20:26 ` [TUHS] " Clem Cole
2022-11-03 20:27   ` Clem Cole
2022-11-03 20:55   ` Warner Losh
2022-11-03 21:34     ` Clem Cole
2022-11-03 22:28       ` Warner Losh
2022-11-03 22:52         ` Ron Natalie
2022-11-04  6:43       ` Lars Brinkhoff
2022-11-04 15:18         ` Dan Cross
2022-11-04 17:54           ` Lars Brinkhoff
2022-11-04 18:33   ` Ron Natalie
2022-11-04 23:42     ` Theodore Ts'o
2022-11-05  0:45       ` Dave Horsfall
2022-11-05  1:02         ` Larry McVoy
2022-11-05  1:25           ` Bakul Shah
2022-11-05  1:40             ` Larry McVoy
2022-11-05  2:31               ` Rich Salz
2022-11-05  3:44                 ` Bakul Shah
2022-11-05 18:34               ` Theodore Ts'o
2022-11-05  9:29           ` Otto Moerbeek via TUHS
2022-11-04 22:13 ` Mary Ann Horton
2022-11-03 20:17 Noel Chiappa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).