change references to "open files" to "open file buffers" for
consistency, and add DB's changes to die() so that it works properly with the overhauled multibuffer routines git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2153 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Этот коммит содержится в:
родитель
1483ee3db1
Коммит
3ece0b9aeb
@ -26,6 +26,8 @@ CVS code -
|
|||||||
free_filestruct(); removal of open_prevfile() and
|
free_filestruct(); removal of open_prevfile() and
|
||||||
open_nextfile(). (David Benbennick, minor tweaks and additions
|
open_nextfile(). (David Benbennick, minor tweaks and additions
|
||||||
by DLR)
|
by DLR)
|
||||||
|
- Change references to "open files" to "open file buffers", for
|
||||||
|
consistency. (DLR)
|
||||||
- cut.c:
|
- cut.c:
|
||||||
do_cut_text()
|
do_cut_text()
|
||||||
- If keep_cutbuffer is FALSE, only blow away the text in the
|
- If keep_cutbuffer is FALSE, only blow away the text in the
|
||||||
|
12
src/files.c
12
src/files.c
@ -823,7 +823,7 @@ void add_open_file(bool update)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Read the current entry in the open_files structure and set up the
|
/* Read the current entry in the open_files structure and set up the
|
||||||
* currently open file using that entry's information. */
|
* currently open file buffer using that entry's information. */
|
||||||
void load_open_file(void)
|
void load_open_file(void)
|
||||||
{
|
{
|
||||||
assert(open_files != NULL);
|
assert(open_files != NULL);
|
||||||
@ -887,17 +887,17 @@ void load_open_file(void)
|
|||||||
titlebar(NULL);
|
titlebar(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Open either the next or previous file. */
|
/* Open either the next or previous file buffer. */
|
||||||
void open_prevnext_file(bool next)
|
void open_prevnext_file(bool next)
|
||||||
{
|
{
|
||||||
add_open_file(TRUE);
|
add_open_file(TRUE);
|
||||||
|
|
||||||
assert(open_files != NULL);
|
assert(open_files != NULL);
|
||||||
|
|
||||||
/* If only one file is open, indicate it on the statusbar and get
|
/* If only one file buffer is open, indicate it on the statusbar and
|
||||||
* out. */
|
* get out. */
|
||||||
if (open_files == open_files->next) {
|
if (open_files == open_files->next) {
|
||||||
statusbar(_("No more open files"));
|
statusbar(_("No more open file buffers"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -938,7 +938,7 @@ void open_nextfile_void(void)
|
|||||||
|
|
||||||
/* Delete an entry from the open_files filestruct. After deletion of an
|
/* Delete an entry from the open_files filestruct. After deletion of an
|
||||||
* entry, the next entry is opened. Return TRUE on success or FALSE if
|
* entry, the next entry is opened. Return TRUE on success or FALSE if
|
||||||
* there are no more open files. */
|
* there are no more open file buffers. */
|
||||||
bool close_open_file(void)
|
bool close_open_file(void)
|
||||||
{
|
{
|
||||||
assert(open_files != NULL);
|
assert(open_files != NULL);
|
||||||
|
@ -70,7 +70,8 @@ partition *filepart = NULL; /* A place to store a portion of the
|
|||||||
file struct */
|
file struct */
|
||||||
|
|
||||||
#ifdef ENABLE_MULTIBUFFER
|
#ifdef ENABLE_MULTIBUFFER
|
||||||
openfilestruct *open_files = NULL; /* The list of open files */
|
openfilestruct *open_files = NULL; /* The list of open file
|
||||||
|
buffers */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
|
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
|
||||||
|
35
src/nano.c
35
src/nano.c
@ -124,41 +124,32 @@ void die(const char *msg, ...)
|
|||||||
vfprintf(stderr, msg, ap);
|
vfprintf(stderr, msg, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
/* save the currently loaded file if it's been modified */
|
/* Save the current file buffer if it's been modified. */
|
||||||
if (ISSET(MODIFIED))
|
if (ISSET(MODIFIED))
|
||||||
die_save_file(filename);
|
die_save_file(filename);
|
||||||
|
|
||||||
#ifdef ENABLE_MULTIBUFFER
|
#ifdef ENABLE_MULTIBUFFER
|
||||||
/* then save all of the other modified loaded files, if any */
|
/* Save all of the other modified file buffers, if any. */
|
||||||
if (open_files != NULL) {
|
if (open_files != NULL) {
|
||||||
openfilestruct *tmp;
|
openfilestruct *tmp = open_files;
|
||||||
|
|
||||||
tmp = open_files;
|
while (tmp != open_files->next) {
|
||||||
|
open_files = open_files->next;
|
||||||
|
|
||||||
while (open_files->prev != NULL)
|
/* Save the current file buffer if it's been modified. */
|
||||||
open_files = open_files->prev;
|
if (open_files->flags & MODIFIED) {
|
||||||
|
/* Set fileage and filebot to match the current file
|
||||||
while (open_files->next != NULL) {
|
* buffer, and then write it to disk. */
|
||||||
|
|
||||||
/* if we already saved the file above (i.e, if it was the
|
|
||||||
currently loaded file), don't save it again */
|
|
||||||
if (tmp != open_files) {
|
|
||||||
/* make sure open_files->fileage and fileage, and
|
|
||||||
open_files->filebot and filebot, are in sync; they
|
|
||||||
might not be if lines have been cut from the top or
|
|
||||||
bottom of the file */
|
|
||||||
fileage = open_files->fileage;
|
fileage = open_files->fileage;
|
||||||
filebot = open_files->filebot;
|
filebot = open_files->filebot;
|
||||||
/* save the file if it's been modified */
|
die_save_file(open_files->filename);
|
||||||
if (open_files->flags & MODIFIED)
|
|
||||||
die_save_file(open_files->filename);
|
|
||||||
}
|
}
|
||||||
open_files = open_files->next;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
exit(1); /* We have a problem: exit w/ errorlevel(1) */
|
/* Get out. */
|
||||||
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void die_save_file(const char *die_filename)
|
void die_save_file(const char *die_filename)
|
||||||
@ -3125,7 +3116,7 @@ void do_exit(void)
|
|||||||
|
|
||||||
if (i == 0 || (i == 1 && do_writeout(TRUE) > 0)) {
|
if (i == 0 || (i == 1 && do_writeout(TRUE) > 0)) {
|
||||||
#ifdef ENABLE_MULTIBUFFER
|
#ifdef ENABLE_MULTIBUFFER
|
||||||
/* Exit only if there are no more open buffers. */
|
/* Exit only if there are no more open file buffers. */
|
||||||
if (!close_open_file())
|
if (!close_open_file())
|
||||||
#endif
|
#endif
|
||||||
finish();
|
finish();
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user