fix nc -do ""
[nedit-bw.git] / ammendment-to-emtpy-file_path.patch
blob3122053530248a5baaded428019c711c36248119
1 ---
3 source/file.c | 7 ++++++-
4 source/window.c | 7 ++-----
5 2 files changed, 8 insertions(+), 6 deletions(-)
7 diff --quilt old/source/window.c new/source/window.c
8 --- old/source/window.c
9 +++ new/source/window.c
10 @@ -951,7 +951,6 @@ WindowInfo *TabToWindow(Widget tab)
11 void CloseWindow(WindowInfo *window)
13 int keepWindow, state;
14 - char name[MAXPATHLEN];
15 WindowInfo *win, *topBuf = NULL, *nextBuf = NULL;
17 /* Free smart indent macro programs */
18 @@ -989,14 +988,12 @@ void CloseWindow(WindowInfo *window)
19 /* if this is the last window, or must be kept alive temporarily because
20 it's running the macro calling us, don't close it, make it Untitled */
21 if (keepWindow || (WindowList == window && window->next == NULL)) {
22 - window->filename[0] = '\0';
23 - UniqueUntitledName(name);
24 + /* keep the path from the old window */
25 + UniqueUntitledName(window->filename);
26 CLEAR_ALL_LOCKS(window->lockReasons);
27 window->fileMode = 0;
28 window->fileUid = 0;
29 window->fileGid = 0;
30 - strcpy(window->filename, name);
31 - strcpy(window->path, "");
32 window->ignoreModify = TRUE;
33 BufSetAll(window->buffer, "");
34 window->ignoreModify = FALSE;
35 diff --quilt old/source/file.c new/source/file.c
36 --- old/source/file.c
37 +++ new/source/file.c
38 @@ -1664,9 +1664,14 @@ void UniqueUntitledName(char *name)
39 sprintf(name, "Untitled");
40 else
41 sprintf(name, "Untitled_%d", i);
42 - for (w=WindowList; w!=NULL; w=w->next)
43 + for (w=WindowList; w!=NULL; w=w->next) {
44 + if (&w->filename[0] == name) {
45 + /* skip the window, for what we need a new name */
46 + continue;
47 + }
48 if (!strcmp(w->filename, name))
49 break;
50 + }
51 if (w == NULL)
52 break;