* When the name of a nonexisting file is given with the 'edit' ex command,

the command now succeeds and prints a "[New file]" message.
This commit is contained in:
Gunnar Ritter 2005-02-17 14:48:49 +00:00
parent b737eb9531
commit 9fd9a3d91e
3 changed files with 20 additions and 7 deletions

View File

@ -17,7 +17,8 @@ Release ...
* The argument to the -w option is correctly recognized now. * The argument to the -w option is correctly recognized now.
* If the SHELL environment variable is set to the empty string, it is now * If the SHELL environment variable is set to the empty string, it is now
ignored. ignored.
* A non-null exit status is now returned if a file could not be opened. * A non-null exit status is now returned if a file could not be opened, or
if an invalid address is given for a command.
* If the match for a substitution is of length zero, a line overflow is * If the match for a substitution is of length zero, a line overflow is
now avoided when compiled with the 'UNIX(R) Regular Expression Library'. now avoided when compiled with the 'UNIX(R) Regular Expression Library'.
* When moving left while the cursor is positioned over a multicolumn * When moving left while the cursor is positioned over a multicolumn
@ -30,6 +31,8 @@ Release ...
processed first, i.e. the command is executed at the position where processed first, i.e. the command is executed at the position where
the tag was found. the tag was found.
* The -w option now also sets the scroll size for the 'z' command. * The -w option now also sets the scroll size for the 'z' command.
* When the name of a nonexisting file is given with the 'edit' ex command,
the command now succeeds and prints a "[New file]" message.
Release 1/19/05 Release 1/19/05
* The last release erroneously made 'X' work like 'x' in visual mode. It now * The last release erroneously made 'X' work like 'x' in visual mode. It now

View File

@ -73,7 +73,7 @@
#ifndef lint #ifndef lint
#ifdef DOSCCS #ifdef DOSCCS
static char sccsid[] = "@(#)ex_addr.c 1.9 (gritter) 11/23/04"; static char sccsid[] = "@(#)ex_addr.c 1.10 (gritter) 2/17/05";
#endif #endif
#endif /* not lint */ #endif /* not lint */
@ -123,6 +123,7 @@ setdot1(void)
addr1 = addr2 = dot; addr1 = addr2 = dot;
if (addr1 > addr2) { if (addr1 > addr2) {
notempty(); notempty();
failed = 1;
error(catgets(catd, 1, 6, error(catgets(catd, 1, 6,
"Addr1 > addr2|First address exceeds second")); "Addr1 > addr2|First address exceeds second"));
} }
@ -197,10 +198,12 @@ void
setnoaddr(void) setnoaddr(void)
{ {
if (addr2 != 0) if (addr2 != 0) {
failed = 1;
error(catgets(catd, 1, 8, error(catgets(catd, 1, 8,
"No address allowed@on this command")); "No address allowed@on this command"));
} }
}
/* /*
* Parse an address. * Parse an address.
@ -366,12 +369,16 @@ error(catgets(catd, 1, 11, "No match to TOP|Address search hit TOP without match
if (addr != zero) if (addr != zero)
notempty(); notempty();
addr += lastsign; addr += lastsign;
if (addr < zero) if (addr < zero) {
failed = 1;
error(catgets(catd, 1, 15, error(catgets(catd, 1, 15,
"Negative address@- first buffer line is 1")); "Negative address@- first buffer line is 1"));
if (addr > dol) }
if (addr > dol) {
failed = 1;
error(catgets(catd, 1, 16, error(catgets(catd, 1, 16,
"Not that many lines@in buffer")); "Not that many lines@in buffer"));
}
return (addr); return (addr);
} }
} }

View File

@ -73,7 +73,7 @@
#ifndef lint #ifndef lint
#ifdef DOSCCS #ifdef DOSCCS
static char sccsid[] = "@(#)ex_io.c 1.38 (gritter) 2/13/05"; static char sccsid[] = "@(#)ex_io.c 1.39 (gritter) 2/17/05";
#endif #endif
#endif #endif
@ -421,8 +421,11 @@ rop(int c)
* If the user just did "ex foo" he is probably * If the user just did "ex foo" he is probably
* creating a new file. Don't be an error, since * creating a new file. Don't be an error, since
* this is ugly, and it screws up the + option. * this is ugly, and it screws up the + option.
*
* POSIX.2 specifies that this be done for all
* "edit" commands, not just for the first one.
*/ */
if (!seenprompt) { if (1 || !seenprompt) {
printf(catgets(catd, 1, 90, " [New file]")); printf(catgets(catd, 1, 90, " [New file]"));
noonl(); noonl();
return; return;