* edit-widget.h: Add new field loading_done.

* edit.c (edit_init): Set loading_done.
(edit_insert): Don't call edit_modification() before the file is
completely loaded.
This commit is contained in:
Pavel Roskin 2003-07-09 00:18:11 +00:00
parent 59593d0e1b
commit 5ff5f8e9d1
3 changed files with 11 additions and 2 deletions

View File

@ -1,5 +1,10 @@
2003-07-08 Pavel Roskin <proski@gnu.org>
* edit-widget.h: Add new field loading_done.
* edit.c (edit_init): Set loading_done.
(edit_insert): Don't call edit_modification() before the file is
completely loaded.
* edit-widget.h: Eliminate unused explicit_syntax field.
* edit-widget.h: Stop misusing "unsigned char" for boolean.

View File

@ -53,6 +53,7 @@ struct WEdit {
int force; /* how much of the screen do we redraw? */
int overwrite:1; /* Overwrite on type mode (as opposed to insert) */
int modified:1; /* File has been modified and needs saving */
int loading_done:1; /* File has been loaded into the editor */
int locked:1; /* We hold lock on current file */
int screen_modified:1; /* File has been changed since the last screen draw */
int delete_file:1; /* New file, needs to be deleted unless modified */

View File

@ -553,6 +553,7 @@ edit_init (WEdit *edit, int lines, int columns, const char *filename,
g_free (edit);
return 0;
}
edit->loading_done = 1;
edit->modified = 0;
edit->locked = 0;
edit_load_syntax (edit, 0, 0);
@ -839,8 +840,10 @@ edit_insert (WEdit *edit, int c)
edit->start_line++;
}
/* tell that we've modified the file */
edit_modification (edit);
/* Mark file as modified, unless the file hasn't been fully loaded */
if (edit->loading_done) {
edit_modification (edit);
}
/* now we must update some info on the file and check if a redraw is required */
if (c == '\n') {