From 13ae564f03a3ea7dd86e218fb287363842371cba Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Sun, 9 Jun 2002 13:35:49 +0000 Subject: Add color definitions for "dark red", etc. Change "text" and "selecion" methods to return char *, not const char *, since they return a changeable copy of the text. Add range checking to style lookup in Fl_Text_Display. Add syntax hilighting to editor example. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2299 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl_Text_Display.cxx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/Fl_Text_Display.cxx') diff --git a/src/Fl_Text_Display.cxx b/src/Fl_Text_Display.cxx index 7a493dda9..8a4c85075 100644 --- a/src/Fl_Text_Display.cxx +++ b/src/Fl_Text_Display.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Text_Display.cxx,v 1.12.2.16 2002/06/06 14:04:53 easysw Exp $" +// "$Id: Fl_Text_Display.cxx,v 1.12.2.17 2002/06/09 13:35:49 easysw Exp $" // // Copyright 2001-2002 by Bill Spitzak and others. // Original code Copyright Mark Edel. Permission to distribute under @@ -1656,6 +1656,9 @@ int Fl_Text_Display::measure_vline( int visLineNum ) { style = ( unsigned char ) mStyleBuffer->character( lineStartPos + i ) - 'A'; + if (style < 0) style = 0; + else if (style >= mNStyles) style = mNStyles - 1; + fl_font( mStyleTable[ style ].font, mStyleTable[ style ].size ); width += ( int ) fl_width( expandedChar, len ); @@ -1948,5 +1951,5 @@ int Fl_Text_Display::handle(int event) { // -// End of "$Id: Fl_Text_Display.cxx,v 1.12.2.16 2002/06/06 14:04:53 easysw Exp $". +// End of "$Id: Fl_Text_Display.cxx,v 1.12.2.17 2002/06/09 13:35:49 easysw Exp $". // -- cgit v1.2.3