fix alternate spell checker breakage: don't lose colors after using it

on a file


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2913 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
David Lawrence Ramsey 2005-07-23 00:41:45 +00:00
parent c009759c23
commit c00513b65e
4 changed files with 20 additions and 36 deletions

View File

@ -64,20 +64,12 @@ void initialize_buffer(void)
openfile->filename = mallocstrcpy(NULL, "");
openfile->fileage = make_new_node(NULL);
openfile->fileage->data = mallocstrcpy(NULL, "");
openfile->filebot = openfile->fileage;
openfile->edittop = openfile->fileage;
openfile->current = openfile->fileage;
initialize_buffer_text();
openfile->current_x = 0;
openfile->placewewant = 0;
openfile->current_y = 0;
openfile->totlines = 1;
openfile->totsize = 0;
openfile->modified = FALSE;
#ifndef NANO_SMALL
openfile->mark_set = FALSE;
@ -94,22 +86,22 @@ void initialize_buffer(void)
#endif
}
#ifndef DISABLE_SPELLER
/* Reinitialize the current entry of the openfile openfilestruct. */
void reinitialize_buffer(void)
/* Initialize the text of the current entry of the openfile
* openfilestruct. */
void initialize_buffer_text(void)
{
assert(openfile != NULL && openfile->filename != NULL && openfile->fileage != NULL);
assert(openfile != NULL);
free(openfile->filename);
free_filestruct(openfile->fileage);
#ifndef NANO_SMALL
if (openfile->current_stat != NULL)
free(openfile->current_stat);
#endif
openfile->fileage = make_new_node(NULL);
openfile->fileage->data = mallocstrcpy(NULL, "");
initialize_buffer();
openfile->filebot = openfile->fileage;
openfile->edittop = openfile->fileage;
openfile->current = openfile->fileage;
openfile->totlines = 1;
openfile->totsize = 0;
}
#endif
/* If it's not "", filename is a file to open. We make a new buffer, if
* necessary, and then open and read the file, if applicable. */

View File

@ -2187,7 +2187,6 @@ const char *do_int_speller(const char *tempfile_name)
const char *do_alt_speller(char *tempfile_name)
{
int alt_spell_status;
char *filename_save;
size_t current_x_save = openfile->current_x;
size_t pww_save = openfile->placewewant;
ssize_t current_y_save = openfile->current_y;
@ -2301,14 +2300,9 @@ const char *do_alt_speller(char *tempfile_name)
/* Set up the window size. */
window_size_init();
/* Save the current filename. */
filename_save = mallocstrcpy(NULL, openfile->filename);
/* Reinitialize the current buffer. */
reinitialize_buffer();
/* Restore the current filename. */
openfile->filename = filename_save;
/* Reinitialize the text of the current buffer. */
free_filestruct(openfile->fileage);
initialize_buffer_text();
/* Reload the temp file. Open it, read it into the current buffer,
* and move back to the first line of the buffer. */

View File

@ -209,14 +209,14 @@ typedef struct openfilestruct {
filestruct *filebot; /* Current file's last line. */
filestruct *edittop; /* Current top of edit window. */
filestruct *current; /* Current file's line. */
size_t totlines; /* Current file's total number of
* lines. */
size_t totsize; /* Current file's total size. */
size_t current_x; /* Current file's x-coordinate
* position. */
size_t placewewant; /* Current file's place we want. */
ssize_t current_y; /* Current file's y-coordinate
* position. */
size_t totlines; /* Current file's total number of
* lines. */
size_t totsize; /* Current file's total size. */
bool modified; /* Current file's modification
* status. */
#ifndef NANO_SMALL

View File

@ -235,9 +235,7 @@ void do_uncut_text(void);
/* Public functions in files.c. */
void make_new_buffer(void);
void initialize_buffer(void);
#ifndef DISABLE_SPELLER
void reinitialize_buffer(void);
#endif
void initialize_buffer_text(void);
void open_buffer(const char *filename);
void display_buffer(void);
#ifdef ENABLE_MULTIBUFFER