From ddd6ab5d83de416ed1e06495050a43657c7e3605 Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Mon, 10 Jun 2002 21:04:20 +0000 Subject: Fix some editor problems; still have a few bugs that need to be resolved before 1.1.0... git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2304 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- test/editor.cxx | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'test/editor.cxx') diff --git a/test/editor.cxx b/test/editor.cxx index fd1f54a25..eb4c057b3 100644 --- a/test/editor.cxx +++ b/test/editor.cxx @@ -1,5 +1,5 @@ // -// "$Id: editor.cxx,v 1.2.2.3.2.9 2002/06/09 18:28:49 easysw Exp $" +// "$Id: editor.cxx,v 1.2.2.3.2.10 2002/06/10 21:04:20 easysw Exp $" // // A simple text editor program for the Fast Light Tool Kit (FLTK). // @@ -287,11 +287,10 @@ style_init(void) { memset(style, 'A', textbuf->length()); style[textbuf->length()] = '\0'; - if (stylebuf) delete stylebuf; + if (!stylebuf) stylebuf = new Fl_Text_Buffer(textbuf->length()); style_parse(text, style, textbuf->length()); - stylebuf = new Fl_Text_Buffer(textbuf->length()); stylebuf->text(style); delete[] style; free(text); @@ -465,7 +464,6 @@ void load_file(char *newfile, int ipos) { else if (!insert) strcpy(filename, newfile); loading = 0; - style_init(); textbuf->call_modify_callbacks(); } @@ -553,7 +551,6 @@ void new_cb(Fl_Widget*, void*) { filename[0] = '\0'; textbuf->select(0, textbuf->length()); textbuf->remove_selection(); - style_init(); changed = 0; textbuf->call_modify_callbacks(); } @@ -740,8 +737,8 @@ Fl_Window* new_view() { w->resizable(w->editor); w->callback((Fl_Callback *)close_cb, w); - textbuf->add_modify_callback(changed_cb, w); textbuf->add_modify_callback(style_update, w->editor); + textbuf->add_modify_callback(changed_cb, w); textbuf->call_modify_callbacks(); num_windows++; return w; @@ -761,5 +758,5 @@ int main(int argc, char **argv) { } // -// End of "$Id: editor.cxx,v 1.2.2.3.2.9 2002/06/09 18:28:49 easysw Exp $". +// End of "$Id: editor.cxx,v 1.2.2.3.2.10 2002/06/10 21:04:20 easysw Exp $". // -- cgit v1.2.3