]> git.wh0rd.org Git - nano.git/commitdiff
fix alternate spell checker breakage: don't lose colors after using it
authorDavid Lawrence Ramsey <pooka109@gmail.com>
Sat, 23 Jul 2005 00:41:45 +0000 (00:41 +0000)
committerDavid Lawrence Ramsey <pooka109@gmail.com>
Sat, 23 Jul 2005 00:41:45 +0000 (00:41 +0000)
on a file

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2913 35c25a1d-7b9e-4130-9fde-d3aeb78583b8

src/files.c
src/nano.c
src/nano.h
src/proto.h

index 42388d8c304a7d413864761add1e959fd5e5e876..da39f6feefcd8b0a5fa49a3d708fcf296637ff98 100644 (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. */
index 57065c9ad1a4667839355a13c3f582a6a722bc44..1a8f9d6155c22628ef90fbca2d944a705b528f3e 100644 (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. */
index f71a01d9868a42937ed078675710fde83458f012..a131a9e76204ce171af10c297e9b393219aa5fc3 100644 (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
index 098af1a83b880f03e85f99374f9e9ab24747d130..6e34971db1ef4e0e84e51b0d26771f6afb1ab183 100644 (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