diff options
| -rw-r--r-- | doc/ScintillaDoc.html | 8 | ||||
| -rw-r--r-- | gtk/PlatGTK.cxx | 8 | ||||
| -rw-r--r-- | src/PropSet.cxx | 5 | ||||
| -rw-r--r-- | src/Style.cxx | 9 | ||||
| -rw-r--r-- | src/ViewStyle.cxx | 8 | 
5 files changed, 26 insertions, 12 deletions
| diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html index 95f95a7e3..4046638fd 100644 --- a/doc/ScintillaDoc.html +++ b/doc/ScintillaDoc.html @@ -809,12 +809,14 @@ SCI_SETSAVEPOINT  </pre>      <p>         Sent to the container when the savepoint is entered or left, allowing the container to to -      display a dirty indicator and change its menues. The first parameter is 1 when entering the +      display a dirty indicator and change its menus. The first parameter is 1 when entering the        save point, 0 when leaving.      </p>      <p> -       The container tells Scintilla where the save point is by sending the SCI_SETSAVEPOINT -      message. +      The container tells Scintilla where the save point is by sending the SCI_SETSAVEPOINT +      message.  This is usually done when the file is saved or loaded.  As Scintilla performs  +      undo and redo operations, it will notify the container that it has entered or left the save  +      point, allowing the container to know if the file should be considered dirty or not.      </p>  <pre>  SCN_MODIFYATTEMPTRO diff --git a/gtk/PlatGTK.cxx b/gtk/PlatGTK.cxx index e074aed17..5da2a3a94 100644 --- a/gtk/PlatGTK.cxx +++ b/gtk/PlatGTK.cxx @@ -381,8 +381,12 @@ void Surface::DrawTextClipped(PRectangle rc, Font &font_, int ybase, const char  void Surface::MeasureWidths(Font &font_, const char *s, int len, int *positions) {  	int totalWidth = 0;  	for (int i=0;i<len;i++) { -		int width = gdk_char_width(font_.id, s[i]); -		totalWidth += width; +		if (font_.id) { +			int width = gdk_char_width(font_.id, s[i]); +			totalWidth += width; +		} else { +			totalWidth++; +		}  		positions[i] = totalWidth;  	}  } diff --git a/src/PropSet.cxx b/src/PropSet.cxx index 7e2a906a4..8582105ea 100644 --- a/src/PropSet.cxx +++ b/src/PropSet.cxx @@ -27,6 +27,7 @@ bool EqualCaseInsensitive(const char *a, const char *b) {  // Get a line of input. If end of line escaped with '\\' then continue reading.  static bool GetFullLine(const char *&fpc, int &lenData, char *s, int len) {  	bool continuation = true; +	s[0] = '\0';  	while ((len > 1) && lenData > 0) {  		char ch = *fpc;  		fpc++; @@ -46,6 +47,7 @@ static bool GetFullLine(const char *&fpc, int &lenData, char *s, int len) {  		} else {  			continuation = false;  			*s++ = ch; +			*s = '\0';  			len--;  		}  	} @@ -253,6 +255,9 @@ void PropSet::ReadFromMemory(const char *data, int len) {  			if (isalpha(linebuf[0]))  				Set(linebuf);  		} +		// If there is a final line: +		if (isalpha(linebuf[0])) +			Set(linebuf);  	}  } diff --git a/src/Style.cxx b/src/Style.cxx index 271d98fc2..120fd6e95 100644 --- a/src/Style.cxx +++ b/src/Style.cxx @@ -10,6 +10,7 @@  #include "Style.h"  Style::Style() { +	aliasOfDefaultFont = false;  	Clear(Colour(0,0,0), Colour(0xff,0xff,0xff),  	        Platform::DefaultFontSize(), 0,  		false, false, false); @@ -18,11 +19,14 @@ Style::Style() {  Style::~Style() {  	if (!aliasOfDefaultFont)  		font.Release(); +	aliasOfDefaultFont = false;  }  Style &Style::operator=(const Style &source) {  	if (this == &source)  		return *this; +	// Crash: +	*(char *)0 = 1;  	Clear(Colour(0,0,0), Colour(0xff,0xff,0xff),  	        Platform::DefaultFontSize(), 0,  		false, false, false); @@ -47,6 +51,8 @@ void Style::Clear(Colour fore_, Colour back_, int size_, const char *fontName_,  	eolFilled = eolFilled_;  	if (!aliasOfDefaultFont)  		font.Release(); +	else  +		font.SetID(0);  	aliasOfDefaultFont = false;  } @@ -68,7 +74,8 @@ void Style::Realise(Surface &surface, int zoomLevel, Style *defaultStyle) {  	int sizeZoomed = size + zoomLevel;  	if (sizeZoomed <= 2)	// Hangs if sizeZoomed <= 1  		sizeZoomed = 2; -		 + +	font.Release();		  	int deviceHeight = (sizeZoomed * surface.LogPixelsY()) / 72;  	aliasOfDefaultFont = defaultStyle && EquivalentFontTo(defaultStyle);  	if (aliasOfDefaultFont) { diff --git a/src/ViewStyle.cxx b/src/ViewStyle.cxx index 122db6a00..976593de3 100644 --- a/src/ViewStyle.cxx +++ b/src/ViewStyle.cxx @@ -51,7 +51,7 @@ ViewStyle::ViewStyle() {  ViewStyle::ViewStyle(const ViewStyle &source) {  	Init(); -	for (int sty=0;sty<=STYLE_MAX;sty++) { +	for (unsigned int sty=0;sty<(sizeof(styles)/sizeof(styles[0]));sty++) {  		styles[sty] = source.styles[sty];  	}  	for (int mrk=0;mrk<=MARKER_MAX;mrk++) { @@ -163,9 +163,7 @@ void ViewStyle::RefreshColourPalette(Palette &pal, bool want) {  	pal.WantFind(edgecolour, want);  } -#include <mmsystem.h>  void ViewStyle::Refresh(Surface &surface) { -DWORD dwStart = timeGetTime();  	selbar.desired = Platform::Chrome();  	selbarlight.desired = Platform::ChromeHighlight();  	maxAscent = 1; @@ -194,8 +192,6 @@ DWORD dwStart = timeGetTime();  		if (ms[margin].width > 0)  			maskInLine &= ~ms[margin].mask;  	} -DWORD dwEnd = timeGetTime(); -Platform::DebugPrintf("Refresh took %d\n", dwEnd - dwStart);  }  void ViewStyle::ResetDefaultStyle() { @@ -206,7 +202,7 @@ void ViewStyle::ResetDefaultStyle() {  void ViewStyle::ClearStyles() {  	// Reset all styles to be like the default style -	for (int i=0; i<=STYLE_MAX; i++) { +	for (unsigned int i=0;i<(sizeof(styles)/sizeof(styles[0]));i++) {  		if (i != STYLE_DEFAULT) {  			styles[i].Clear(  				styles[STYLE_DEFAULT].fore.desired,  | 
