[comp.sources.bugs] fep - unusable for certain stty settings

cudcv@warwick.ac.uk (Rob McMahon) (12/21/88)

We use ^X as our kill character round here (almost makes sense - CAN).
Because the settings imported from the tty driver override the standard
bindings for fep, this makes it almost unusable (^X is a prefix character
normally, and all sorts of nice commands, including show-bindings, go out the
window).  I think it better if the default bindings override the imported
settings.  There won't be any difference for the `standard' settings, and no
important commands will be lost.

Another problem is that if a character is unset, fep tries to set element -1
of an array.
-- 
RCS file: fep_edit.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -c -r1.1 -r1.2
*** /tmp/,RCSt1a03969	Tue Dec 20 19:25:46 1988
--- /tmp/,RCSt2a03969	Tue Dec 20 19:25:49 1988
***************
*** 182,211 ****
  
      for (i = 0; i < 256; i++)
  	cft[i] = self_insert;
-     for (ftp = emacsBindings; ftp->bt_s; ftp++) {
- 	bind_key (cft, ftp->bt_func, ftp->bt_s, abort);
-     }
  
      /* Now, using cbreak mode
!     cft[(int) tchars_buf.t_startc] = ignore;
!     cft[(int) tchars_buf.t_stopc] = ignore;
      */
!     cft[(int) tchars_buf.t_intrc] = insert_and_flush;
!     cft[(int) tchars_buf.t_quitc] = insert_and_flush;
!     /* Now, EOF will be sent on empty line.
!     cft[(int) tchars_buf.t_eofc] = send_eof;
      */
!     cft[(int) tchars_buf.t_brkc] = insert_and_flush;
!     cft[(int) ltchars_buf.t_suspc] = insert_and_flush;
!     /* ^Y is used for yank-from-kill-buffer
!     cft[(int) ltchars_buf.t_dsuspc] = self_insert;
      */
!     cft[(int) ltchars_buf.t_rprntc] = reprint;
!     cft[(int) ltchars_buf.t_flushc] = self_insert;
!     cft[(int) ltchars_buf.t_werasc] = delete_previous_word;
!     cft[(int) ltchars_buf.t_lnextc] = literal_next;
!     cft[(int) initial_ttymode.sg_erase] = delete_previous_character;
!     cft[(int) initial_ttymode.sg_kill] = delete_line;
  }
  
  /*
--- 182,214 ----
  
      for (i = 0; i < 256; i++)
  	cft[i] = self_insert;
  
+ #define import(key, fn) if ((int) key > 0) cft[(int) key] = fn
      /* Now, using cbreak mode
!     import(tchars_buf.t_startc, ignore);
!     import(tchars_buf.t_stopc, ignore);
      */
!     import(tchars_buf.t_intrc, insert_and_flush);
!     import(tchars_buf.t_quitc, insert_and_flush);
!     import(tchars_buf.t_eofc, send_eof);
!     import(tchars_buf.t_brkc, insert_and_flush);
!     import(ltchars_buf.t_suspc, insert_and_flush);
!     /* No-op
!     import(ltchars_buf.t_dsuspc, self_insert);
      */
!     import(ltchars_buf.t_rprntc, reprint);
!     /* No-op
!     import(ltchars_buf.t_flushc, self_insert);
      */
!     import(ltchars_buf.t_werasc, delete_previous_word);
!     import(ltchars_buf.t_lnextc, literal_next);
!     import(initial_ttymode.sg_erase, delete_previous_character);
!     import(initial_ttymode.sg_kill, delete_line);
! #undef import
! 
!     for (ftp = emacsBindings; ftp->bt_s; ftp++) {
! 	bind_key (cft, ftp->bt_func, ftp->bt_s, abort);
!     }
  }
  
  /*
-- 
(Line numbers may vary)
RCS file: fep_vi.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -c -r1.2 -r1.3
*** /tmp/,RCSt1a03977	Tue Dec 20 19:27:33 1988
--- /tmp/,RCSt2a03977	Tue Dec 20 19:27:34 1988
***************
*** 160,165 ****
--- 160,190 ----
      for (i = 0; i < 256; i++)
  	cft[i] = self_insert;
  
+ #define import(key, fn) if ((int) key > 0) cft[(int) key] = fn
+     /* Now, using cbreak mode
+     import(tchars_buf.t_startx, ignore);
+     import(tchars_buf.t_stopc, ignore);
+     */
+     import(tchars_buf.t_intrc, insert_and_flush);
+     if ((int) tchars_buf.t_intrc > 0)
+ 	aft[(int) tchars_buf.t_intrc] = insert_and_flush;
+     import(tchars_buf.t_quitc, insert_and_flush);
+     import(tchars_buf.t_eofc, send_eof);
+     import(tchars_buf.t_brkc, insert_and_flush);
+     import(ltchars_buf.t_suspc, insert_and_flush);
+     /* No-op
+     import(ltchars_buf.t_dsuspc, self_insert);
+     */
+     import(ltchars_buf.t_rprntc, reprint);
+     /* No-op
+     import(ltchars_buf.t_flushc, self_insert);
+     */
+     import(ltchars_buf.t_werasc, delete_previous_word);
+     import(ltchars_buf.t_lnextc, literal_next);
+     import(initial_ttymode.sg_erase, delete_previous_character);
+     import(initial_ttymode.sg_kill, delete_line);
+ #undef import
+ 
      for (ftp = viComBindings; ftp->bt_s; ftp++) {
  	bind_key (aft, ftp->bt_func, ftp->bt_s, abort);
      }
***************
*** 166,189 ****
      for (ftp = viInsertBindings; ftp->bt_s; ftp++) {
  	bind_key (cft, ftp->bt_func, ftp->bt_s, abort);
      }
- 
-     /* Now, using cbreak mode
-     cft[(int) tchars_buf.t_startx] = ignore;
-     cft[(int) tchars_buf.t_stopc] = ignore;
-     */
-     cft[(int) tchars_buf.t_intrc] = insert_and_flush;
-     aft[(int) tchars_buf.t_intrc] = insert_and_flush;
-     cft[(int) tchars_buf.t_quitc] = insert_and_flush;
-     cft[(int) tchars_buf.t_eofc] = send_eof;
-     cft[(int) tchars_buf.t_brkc] = insert_and_flush;
-     cft[(int) ltchars_buf.t_suspc] = insert_and_flush;
-     cft[(int) ltchars_buf.t_dsuspc] = self_insert;
-     cft[(int) ltchars_buf.t_rprntc] = reprint;
-     cft[(int) ltchars_buf.t_flushc] = self_insert;
-     cft[(int) ltchars_buf.t_werasc] = delete_previous_word;
-     cft[(int) ltchars_buf.t_lnextc] = literal_next;
-     cft[(int) initial_ttymode.sg_erase] = delete_previous_character;
-     cft[(int) initial_ttymode.sg_kill] = delete_line;
  
      viInsTable = cft;
      viComTable = aft;
--- 191,196 ----
-- 
Rob
-- 
UUCP:   ...!mcvax!ukc!warwick!cudcv	PHONE:  +44 203 523037
JANET:  cudcv@uk.ac.warwick             ARPA:   cudcv@warwick.ac.uk
Rob McMahon, Computing Services, Warwick University, Coventry CV4 7AL, England