From cb34a67ea1f4066bedae61c6497e449589e3e7f3 Mon Sep 17 00:00:00 2001 From: David Lawrence Ramsey Date: Fri, 6 Feb 2004 21:20:05 +0000 Subject: [PATCH] make the saving of marked status in open_files->file_flags work properly again; a tweak to the ISSET() macro in 1.3.0 to make it only return 0 or 1 broke it git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1647 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 8 ++++++-- src/files.c | 11 +++++++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index f2b8da47..25b33e39 100644 --- a/ChangeLog +++ b/ChangeLog @@ -13,6 +13,10 @@ CVS code - shortcut list, and tweak the unjustify routine to use it. (DLR) - files.c: + add_open_files() + - Make the saving of marked status in open_files->file_flags + work properly again; a tweak to the ISSET() macro in 1.3.0 + to make it only return 0 or 1 broke it. (DLR) write_marked() - New function used to write the current marked selection to a file, split out from do_writeout(). (DLR) @@ -361,8 +365,8 @@ GNU nano 1.3.0 - 2003.10.22 interpreted as Ctrl-[character], and the support for Pico's Esc Esc [three-digit decimal ASCII code] input method. (DLR) do_mark() - - Toggle MARK_ISSET() at the beginning of the function instead - of setting it in one place and unsetting it in another place. + - Toggle MARK_ISSET at the beginning of the function instead of + setting it in one place and unsetting it in another place. (David Benbennick) do_suspend() - Use handle_hupterm() to handle SIGHUP and SIGTERM so we can diff --git a/src/files.c b/src/files.c index 2bcff96a..8c6d7ea8 100644 --- a/src/files.c +++ b/src/files.c @@ -777,17 +777,24 @@ int add_open_file(int update) /* save current line number */ open_files->file_lineno = current->lineno; + /* start with default modification status: unmodified (and marking + status, if available: unmarked) */ + open_files->file_flags = 0; + /* if we're updating, save current modification status (and marking status, if available) */ if (update) { #ifndef NANO_SMALL - open_files->file_flags = (MODIFIED & ISSET(MODIFIED)) | (MARK_ISSET & ISSET(MARK_ISSET)); + if (ISSET(MODIFIED)) + open_files->file_flags |= MODIFIED; if (ISSET(MARK_ISSET)) { open_files->file_mark_beginbuf = mark_beginbuf; open_files->file_mark_beginx = mark_beginx; + open_files->file_flags |= MARK_ISSET; } #else - open_files->file_flags = (MODIFIED & ISSET(MODIFIED)); + if (ISSET(MODIFIED)) + open_files->file_flags |= MODIFIED; #endif } -- 2.39.5