On Wed, Oct 1, 2008 at 13:51, Bert Wesarg <[EMAIL PROTECTED]> wrote:
>> Comment By: Bert Wesarg (lebert)
>> Date: 2008-10-01 13:19
>>
>> Message:
>> Ohh,
>>
>> I think we are not done with this bug:
>>
>> start nedit
>> modifie the Untitled buffer
>> close window without saving
>> -> Untitled without path
>
> Here is a small patch which does this by simply keeping the path from
> the window which is closed.
>
> It changes also UniqueUntitledName() so that we can use w->filename in-place.
Did I really forgot the attachment?
>
> Bert
>
---
source/file.c | 7 ++++++-
source/window.c | 7 ++-----
2 files changed, 8 insertions(+), 6 deletions(-)
diff --quilt old/source/window.c new/source/window.c
--- old/source/window.c
+++ new/source/window.c
@@ -951,7 +951,6 @@ WindowInfo *TabToWindow(Widget tab)
void CloseWindow(WindowInfo *window)
{
int keepWindow, state;
- char name[MAXPATHLEN];
WindowInfo *win, *topBuf = NULL, *nextBuf = NULL;
/* Free smart indent macro programs */
@@ -989,14 +988,12 @@ void CloseWindow(WindowInfo *window)
/* if this is the last window, or must be kept alive temporarily because
it's running the macro calling us, don't close it, make it Untitled */
if (keepWindow || (WindowList == window && window->next == NULL)) {
- window->filename[0] = '\0';
- UniqueUntitledName(name);
+ /* keep the path from the old window */
+ UniqueUntitledName(window->filename);
CLEAR_ALL_LOCKS(window->lockReasons);
window->fileMode = 0;
window->fileUid = 0;
window->fileGid = 0;
- strcpy(window->filename, name);
- strcpy(window->path, "");
window->ignoreModify = TRUE;
BufSetAll(window->buffer, "");
window->ignoreModify = FALSE;
diff --quilt old/source/file.c new/source/file.c
--- old/source/file.c
+++ new/source/file.c
@@ -1608,9 +1608,14 @@ void UniqueUntitledName(char *name)
sprintf(name, "Untitled");
else
sprintf(name, "Untitled_%d", i);
- for (w=WindowList; w!=NULL; w=w->next)
+ for (w=WindowList; w!=NULL; w=w->next) {
+ if (&w->filename[0] == name) {
+ /* skip the window, for what we need a new name */
+ continue;
+ }
if (!strcmp(w->filename, name))
break;
+ }
if (w == NULL)
break;
}
--
NEdit Develop mailing list - [email protected]
http://www.nedit.org/mailman/listinfo/develop