From 7cf308f212edc4abd7231e28f1052e9bb32853b5 Mon Sep 17 00:00:00 2001 From: mazze Date: Sun, 15 Mar 2009 20:56:38 +0000 Subject: [PATCH] Don't reset the "modified" flag when an error happens during saving of a file. Otherwise the user could quit the editor without beeing notified that there are still modified buffers and changes are lost. git-svn-id: https://svn.aros.org/svn/aros/trunk/AROS@30925 fb15a70f-31f2-0310-bbcc-cdcc74a49acc --- workbench/tools/Edit/DiskIO.c | 4 +++- workbench/tools/Edit/Project.c | 10 ++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/workbench/tools/Edit/DiskIO.c b/workbench/tools/Edit/DiskIO.c index d420484ac..a82096a14 100644 --- a/workbench/tools/Edit/DiskIO.c +++ b/workbench/tools/Edit/DiskIO.c @@ -240,6 +240,7 @@ BYTE save_file(STRPTR name, LINE *svg, unsigned char eol, LONG protection) LONG i; BYTE szeol = szEOL[eol]; LINE *ln; BPTR fh; + BYTE retval = 0; BusyWindow(Wnd); @@ -271,6 +272,7 @@ BYTE save_file(STRPTR name, LINE *svg, unsigned char eol, LONG protection) /* Flush buffer */ if( i>szeol && FWrite(fh,buf,i-szeol,1)!=1 ) goto wrterr; FClose( fh ); + retval = 1; } else if(IoErr() == ERROR_OBJECT_EXISTS) ThrowError(Wnd, ErrMsg(ERR_WRONG_TYPE)); @@ -279,7 +281,7 @@ BYTE save_file(STRPTR name, LINE *svg, unsigned char eol, LONG protection) SetProtection(name, protection); WakeUp(Wnd); - return 1; + return retval; } /*** Show a requester to choose a file to load ***/ diff --git a/workbench/tools/Edit/Project.c b/workbench/tools/Edit/Project.c index 3761702a3..74e401c08 100644 --- a/workbench/tools/Edit/Project.c +++ b/workbench/tools/Edit/Project.c @@ -206,6 +206,8 @@ void set_project_name( Project p, STRPTR path ) /*** Save one project ***/ char save_project(Project p, char refresh, char ask) { + char retval; + /* Ask for a name if file doesn't have one */ if(p->path == NULL || ask) { @@ -218,13 +220,17 @@ char save_project(Project p, char refresh, char ask) return 0; p->state = 0; } - unset_modif_mark(p, FALSE); if( refresh ) UpdateTitle(Wnd, p), update_panel_name( p ); - return save_file(p->path, p->the_line, p->eol, p->protection); + retval = save_file(p->path, p->the_line, p->eol, p->protection); + + if (retval) + unset_modif_mark(p, FALSE); + + return retval; } /*** Save all modified projects ***/ -- 2.11.4.GIT