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;
#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. */
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;
/* 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. */
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
/* 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