فهرست منبع

revert old strategy for LayoutLine() because for the empty text in calculations wasn't used text/highlighter style, fix issue rev #6382 for EOT

git-svn-id: https://svn.inf.ethz.ch/svn/lecturers/a2/trunk@6425 8c9fc860-2736-0410-a75d-ab315db34111
eth.metacore 9 سال پیش
والد
کامیت
f41658df09
1فایلهای تغییر یافته به همراه7 افزوده شده و 11 حذف شده
  1. 7 11
      source/WMTextView.Mod

+ 7 - 11
source/WMTextView.Mod

@@ -2129,10 +2129,9 @@ TYPE
 			currentStyle := NIL; lastStyle := NIL;
 
 			eol := FALSE;
-			readerPosition := localTextReader.GetPosition();
-			localTextReader.ReadCh(ch);
-
-			WHILE ~(localTextReader.eot OR eol) DO
+			REPEAT
+				readerPosition := localTextReader.GetPosition();
+				localTextReader.ReadCh(ch);
 
 				IF (highlighter # NIL) THEN
 					ASSERT(state # NIL);
@@ -2250,8 +2249,8 @@ TYPE
 				lastHighlighterStyle := highlighterStyle;
 
 				IF first THEN
-					IF ch = Texts.NewLineChar THEN
-						ascent := style.font.GetAscent(); descent := 0;
+					IF (ch = Texts.NewLineChar) OR (ch = 0) THEN
+						ascent := style.font.GetAscent(); descent := style.font.GetDescent();
 					ELSE
 						descent := 0; ascent := 0;
 					END;
@@ -2262,7 +2261,7 @@ TYPE
 				END;
 				INC(pos);
 				IF (stopPos < 0) OR (pos <= stopPos) THEN
-					IF ch # Texts.NewLineChar THEN
+					IF (ch # Texts.NewLineChar) & (ch # 0) THEN
 						GetExtents(ch, dx, a, d); ascent := Strings.Max(ascent, a); descent := Strings.Max(descent, d);
 						IF ld = 0 THEN ld := ascent + descent; ELSE ld := Strings.Max(ld, ascent + descent); END; leading := Strings.Max(leading, ld);
 						IF isMultiLineI & (wrapModeI # NoWrap) & (i > 0) & (x0 + x + dx > wrapwidth) THEN
@@ -2299,10 +2298,7 @@ TYPE
 					eol := TRUE
 				END;
 				INC(i);
-				readerPosition := localTextReader.GetPosition();
-				localTextReader.ReadCh(ch);
-			END;
-
+			UNTIL eol OR localTextReader.eot;
 
 			l.width := x;
 			l.ascent := ascent; l.height := leading; (* ascent + descent; *)