From a0337bc281b2c495908c38c3c215763ee57e369a Mon Sep 17 00:00:00 2001 From: Nick Treleaven Date: Wed, 14 May 2008 16:37:09 +0000 Subject: [PATCH] Fix line breaking not getting reset for new documents sometimes. Merge all document default settings into init_doc_struct(). git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2585 ea778897-0a13-0410-b9d1-a72fbfd435f5 --- ChangeLog | 3 +++ src/document.c | 27 ++++++++------------------- 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/ChangeLog b/ChangeLog index a4463658..9451ea96 100644 --- a/ChangeLog +++ b/ChangeLog @@ -30,6 +30,9 @@ * src/document.c: Recolourise the document in document_reload_file() because the text may have changed (should fix #1948857). + * src/document.c: + Fix line breaking not getting reset for new documents sometimes. + Merge all document default settings into init_doc_struct(). 2008-05-13 Nick Treleaven diff --git a/src/document.c b/src/document.c index f697b301..c934f6d6 100644 --- a/src/document.c +++ b/src/document.c @@ -347,11 +347,16 @@ static void init_doc_struct(document *new_doc) new_doc->tm_file = NULL; new_doc->encoding = NULL; new_doc->has_bom = FALSE; + new_doc->saved_encoding.encoding = NULL; + new_doc->saved_encoding.has_bom = FALSE; new_doc->sci = NULL; new_doc->undo_actions = NULL; new_doc->redo_actions = NULL; new_doc->scroll_percent = -1.0F; new_doc->line_breaking = FALSE; + new_doc->mtime = 0; + new_doc->changed = FALSE; + new_doc->last_check = time(NULL); } @@ -464,11 +469,13 @@ static gint document_create(const gchar *utf8_filename) if (new_idx == -1) /* expand the array, no free places */ { document new_doc; - init_doc_struct(&new_doc); new_idx = doc_array->len; g_array_append_val(doc_array, new_doc); } this = &doc_list[new_idx]; + init_doc_struct(this); /* initialize default document settings */ + + this->file_name = (utf8_filename) ? g_strdup(utf8_filename) : NULL; this->sci = create_new_sci(new_idx); @@ -480,24 +487,6 @@ static gint document_create(const gchar *utf8_filename) pango_font_description_free(pfd); g_free(fname); - this->tag_store = NULL; - this->tag_tree = NULL; - - /* store important pointers in the tab list */ - this->file_name = (utf8_filename) ? g_strdup(utf8_filename) : NULL; - this->encoding = NULL; - this->saved_encoding.encoding = NULL; - this->saved_encoding.has_bom = FALSE; - this->tm_file = NULL; - this->file_type = NULL; - this->mtime = 0; - this->changed = FALSE; - this->last_check = time(NULL); - this->readonly = FALSE; - this->line_wrapping = editor_prefs.line_wrapping; - this->auto_indent = (editor_prefs.indent_mode != INDENT_NONE); - this->has_tags = FALSE; - treeviews_openfiles_add(new_idx); /* sets this->iter */ tabnum = notebook_new_tab(new_idx);