From vimdev-owner@prz.tu-berlin.de  Mon Jun 19 10:50:36 1995
Return-Path: vimdev-owner@prz.tu-berlin.de
Received: from haven.uchicago.edu (root@haven.uchicago.edu [128.135.12.3]) by fudge.uchicago.edu (8.7.5/8.7.3) with ESMTP id KAA06926 for <eric@fudge.uchicago.edu>; Mon, 19 Jun 1995 10:50:35 -0500 (CDT)
Received: from midway.uchicago.edu (root@midway.uchicago.edu [128.135.12.12]) by haven.uchicago.edu (8.7.5/8.7.3) with ESMTP id KAA10536 for <eric@fudge.uchicago.edu>; Wed, 19 Jun 1996 10:49:51 -0500 (CDT)
Received: from mail.Germany.EU.net (mail.germany.eu.net [192.76.144.65]) by midway.uchicago.edu (8.7.3/8.7.2) with SMTP id KAA11521 for <enf1@midway.uchicago.edu>; Wed, 19 Jun 1996 10:48:46 -0500 (CDT)
Received: by mail.Germany.EU.net with ESMTP (5.59:21/EUnetD-2.5.4.c) via EUnet
	id RAA28504; Wed, 19 Jun 1996 17:38:16 +0200
Received: (from majordom@localhost) by tubkom.prz.tu-berlin.de (8.6.11/8.6.9) id LAA17465 for vimdev-outgoing; Wed, 19 Jun 1996 11:30:23 -0400
Received: from haven.uchicago.edu (haven.uchicago.edu [128.135.12.3]) by tubkom.prz.tu-berlin.de (8.6.11/8.6.9) with ESMTP id RAA17459 for <vimdev@prz.tu-berlin.de>; Wed, 19 Jun 1996 17:30:05 +0200
Received: from ellis.uchicago.edu (enf1@ellis.uchicago.edu [128.135.12.62]) by haven.uchicago.edu (8.7.5/8.7.3) with ESMTP id KAA09383 for <vimdev@prz.tu-berlin.de>; Wed, 19 Jun 1996 10:31:20 -0500 (CDT)
Received: (from enf1@localhost) by ellis.uchicago.edu (8.7.1/8.7.2) id KAA13185 for vimdev@prz.tu-berlin.de; Wed, 19 Jun 1996 10:32:30 -0500 (CDT)
Date: Wed, 19 Jun 1996 10:32:30 -0500 (CDT)
From: eric fischer <enf1@midway.uchicago.edu>
Message-Id: <199606191532.KAA13185@ellis.uchicago.edu>
To: vimdev@prz.tu-berlin.de
Subject: A few more ex mode improvements
Sender: owner-vimdev@prz.tu-berlin.de
Precedence: bulk

I said a few days ago that I thought I could get open mode working
pretty easily.  I was wrong :)  In the meantime, here are a few
minor fixes to ex mode, to start editing at the end of the file
instead of the start and to make the display look nicer when using
the Return key to step through the file.

diff -rcp ../vim-4.1ex/src/cmdcmds.c ./src/cmdcmds.c
*** ../vim-4.1ex/src/cmdcmds.c	Wed Jun 12 23:26:03 1996
--- ./src/cmdcmds.c	Sat Jun 15 13:21:02 1996
*************** do_fixdel()
*** 1131,1144 ****
  										 (char_u *)"\010" : (char_u *)"\177");
  }
  
! 	void
! print_line(lnum, use_number)
  	linenr_t	lnum;
  	int			use_number;
  {
  	char_u		numbuf[20];
  
- 	msg_outchar('\n');
  	if (curwin->w_p_nu || use_number)
  	{
  		sprintf((char *)numbuf, "%7ld ", (long)lnum);
--- 1131,1143 ----
  										 (char_u *)"\010" : (char_u *)"\177");
  }
  
! 	static void
! print_line_no_prefix(lnum, use_number)
  	linenr_t	lnum;
  	int			use_number;
  {
  	char_u		numbuf[20];
  
  	if (curwin->w_p_nu || use_number)
  	{
  		sprintf((char *)numbuf, "%7ld ", (long)lnum);
*************** print_line(lnum, use_number)
*** 1148,1153 ****
--- 1147,1170 ----
  		stop_highlight();
  	}
  	msg_prt_line(ml_get(lnum));
+ }
+ 
+     void
+ print_line(lnum, use_number)
+ 	linenr_t	lnum;
+ 	int			use_number;
+ {
+ 	msg_outchar('\n');
+ 	print_line_no_prefix (lnum, use_number);
+ }
+ 
+     void
+ print_line_cr(lnum, use_number)
+ 	linenr_t	lnum;
+ 	int			use_number;
+ {
+ 	msg_outchar('\r');
+ 	print_line_no_prefix (lnum, use_number);
  }
  
  /*
Binary files ../vim-4.1ex/src/cmdcmds.o and ./src/cmdcmds.o differ
diff -rcp ../vim-4.1ex/src/cmdline.c ./src/cmdline.c
*** ../vim-4.1ex/src/cmdline.c	Wed Jun 12 23:31:13 1996
--- ./src/cmdline.c	Tue Jun 18 22:02:58 1996
*************** ccheck_abbr(c)
*** 1002,1011 ****
  }
  
  /*
!  * ex_mode(): repeatedly get ex commands for the Q command, until we
   * return to visual mode.
   */
  
  void
  do_exmode()
  {
--- 1002,1013 ----
  }
  
  /*
!  * do_exmode(): repeatedly get ex commands for the Q command, until we
   * return to visual mode.
   */
  
+ static int ex_pressedreturn = FALSE;
+ 
  void
  do_exmode()
  {
*************** do_exmode()
*** 1025,1031 ****
  		lines_left = Rows - 1;
  
  		if (oldline != curwin->w_cursor.lnum && !ex_no_reprint) {
! 			print_line (curwin->w_cursor.lnum, FALSE);
  		}
  
  		ex_no_reprint = FALSE;
--- 1027,1038 ----
  		lines_left = Rows - 1;
  
  		if (oldline != curwin->w_cursor.lnum && !ex_no_reprint) {
! 			if (ex_pressedreturn) {
! 				print_line_cr (curwin->w_cursor.lnum, FALSE);
! 				ex_pressedreturn = FALSE;
! 			} else {
! 				print_line (curwin->w_cursor.lnum, FALSE);
! 			}
  		}
  
  		ex_no_reprint = FALSE;
*************** do_one_cmd(cmdlinep, cmdlinelenp, sourci
*** 1223,1228 ****
--- 1230,1236 ----
  
  	if (*cmd == NUL && exmode_active) {
  		cmd = "+";
+ 		ex_pressedreturn = TRUE;
  	}
  
  	if (*cmd == '"' || *cmd == NUL)	/* ignore comment and empty lines */
*************** do_ecmd(fnum, fname, sfname, command, hi
*** 3462,3468 ****
--- 3470,3484 ----
  			beginline(MAYBE);
  		}
  		else
+ 		{
+ 			if (exmode_active)
+ 			{
+ 				curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count;
+ 				check_cursor();
+ 			}
+ 
  			beginline(TRUE);
+ 		}
  	}
  
  	/*
Binary files ../vim-4.1ex/src/cmdline.o and ./src/cmdline.o differ
Binary files ../vim-4.1ex/src/ex and ./src/ex differ
diff -rcp ../vim-4.1ex/src/main.c ./src/main.c
*** ../vim-4.1ex/src/main.c	Wed Jun 12 22:10:51 1996
--- ./src/main.c	Tue Jun 18 22:08:55 1996
*************** main(argc, argv)
*** 881,888 ****
--- 881,894 ----
  	/* Only read the file if there is none for the current buffer, a command
  	 * in the .vimrc might have loaded a file */
  	else if (curbuf->b_ml.ml_mfp == NULL)
+ 	{
  		(void)open_buffer();			/* create memfile and read file */
  
+ 		if (invoked_as_ex) {       /* move to end of file if running as ex */
+ 			curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count;
+ 		}
+ 	}
+ 
  	setpcmark();
  
  	/*
*************** main(argc, argv)
*** 908,914 ****
  			curwin->w_arg_idx = arg_idx;
  			/* edit file from arg list, if there is one */
  			(void)do_ecmd(0, arg_idx < arg_count ? arg_files[arg_idx] : NULL,
! 										NULL, NULL, TRUE, (linenr_t)1, FALSE);
  			if (arg_idx == arg_count - 1)
  				arg_had_last = TRUE;
  			++arg_idx;
--- 914,920 ----
  			curwin->w_arg_idx = arg_idx;
  			/* edit file from arg list, if there is one */
  			(void)do_ecmd(0, arg_idx < arg_count ? arg_files[arg_idx] : NULL,
! 										NULL, NULL, TRUE, (linenr_t)0, FALSE);
  			if (arg_idx == arg_count - 1)
  				arg_had_last = TRUE;
  			++arg_idx;
Binary files ../vim-4.1ex/src/main.o and ./src/main.o differ
diff -rcp ../vim-4.1ex/src/misccmds.c ./src/misccmds.c
*** ../vim-4.1ex/src/misccmds.c	Wed Jun 12 05:01:58 1996
--- ./src/misccmds.c	Sat Jun 15 12:51:10 1996
*************** change_warning()
*** 1450,1455 ****
--- 1450,1456 ----
  	{
  		curbuf->b_did_warn = TRUE;
  		MSG("Warning: Changing a readonly file");
+ 		flushbuf();
  		mch_delay(1000L, TRUE);	/* give him some time to think about it */
  	}
  }
Binary files ../vim-4.1ex/src/misccmds.o and ./src/misccmds.o differ
diff -rcp ../vim-4.1ex/src/proto/cmdcmds.pro ./src/proto/cmdcmds.pro
*** ../vim-4.1ex/src/proto/cmdcmds.pro	Wed Jun 12 22:46:10 1996
--- ./src/proto/cmdcmds.pro	Sat Jun 15 13:15:41 1996
*************** void viminfo_readstring __PARMS((char_u 
*** 13,18 ****
--- 13,19 ----
  void viminfo_writestring __PARMS((FILE *fd, char_u *p));
  void do_fixdel __PARMS((void));
  void print_line __PARMS((linenr_t lnum, int use_number));
+ void print_line_cr __PARMS((linenr_t lnum, int use_number));
  void do_file __PARMS((char_u *arg, int forceit));
  void ex_insert __PARMS((int before, linenr_t whatline));
  void ex_change __PARMS((linenr_t start, linenr_t end));
Binary files ../vim-4.1ex/src/screen.o and ./src/screen.o differ
diff -rcp ../vim-4.1ex/src/term.c ./src/term.c
*** ../vim-4.1ex/src/term.c	Tue Jun 11 14:44:06 1996
--- ./src/term.c	Tue Jun 18 22:10:12 1996
*************** set_winsize(width, height, mustset)
*** 1981,1990 ****
  		}
  		else
  		{
! 			tmp = RedrawingDisabled;
! 			RedrawingDisabled = FALSE;
! 			updateScreen(CURSUPD);
! 			RedrawingDisabled = tmp;
  			if (State == CMDLINE)
  				redrawcmdline();
  			else
--- 1981,1994 ----
  		}
  		else
  		{
! 			if (!exmode_active)
! 			{
! 				tmp = RedrawingDisabled;
! 				RedrawingDisabled = FALSE;
! 				updateScreen(CURSUPD);
! 				RedrawingDisabled = tmp;
! 			}
! 
  			if (State == CMDLINE)
  				redrawcmdline();
  			else
Binary files ../vim-4.1ex/src/term.o and ./src/term.o differ
Binary files ../vim-4.1ex/src/version.o and ./src/version.o differ
Binary files ../vim-4.1ex/src/vim and ./src/vim differ

