From ea4eba9f14571a7122dc9a5cf15106798aab2b92 Mon Sep 17 00:00:00 2001 From: Stefano Ceccherini Date: Thu, 3 Aug 2006 13:12:54 +0000 Subject: [PATCH] Simplified a bit a part of FindLineBreak. Removed a now useless comment git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18361 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/interface/BTextView/TextView.cpp | 31 ++++++++--------------- 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/src/kits/interface/BTextView/TextView.cpp b/src/kits/interface/BTextView/TextView.cpp index 5a4291b593..aeefee2e69 100644 --- a/src/kits/interface/BTextView/TextView.cpp +++ b/src/kits/interface/BTextView/TextView.cpp @@ -779,7 +779,6 @@ void BTextView::Pulse() { if (fActive && fEditable && fSelStart == fSelEnd) { - // TODO: Is this check needed ? if (system_time() > (fCaretTime + 500000.0)) InvertCaret(); } @@ -3298,37 +3297,29 @@ BTextView::FindLineBreak(int32 fromOffset, float *outAscent, float *outDescent, return limit; } - bool done = false; - float ascent = 0.0; - float descent = 0.0; int32 offset = fromOffset; - int32 delta = 0; - float deltaWidth = 0.0; - float tabWidth = 0.0; - float strWidth = 0.0; - // do we need to wrap the text? + // Text wrapping is turned off. + // Just find the offset of the first \n character if (!fWrap) { offset = limit - fromOffset; fText->FindChar('\n', fromOffset, &offset); offset += fromOffset; offset = (offset < limit) ? offset + 1 : limit; - // iterate through the style runs - int32 length = offset; - int32 startOffset = fromOffset; - int32 numChars; - while ((numChars = fStyles->Iterate(startOffset, length, fInline, NULL, NULL, &ascent, &descent)) != 0) { - *outAscent = max_c(ascent, *outAscent); - *outDescent = max_c(descent, *outDescent); - - startOffset += numChars; - length -= numChars; - } + *ioWidth = StyledWidth(fromOffset, offset - fromOffset, outAscent, outDescent); return offset; } + bool done = false; + float ascent = 0.0; + float descent = 0.0; + int32 delta = 0; + float deltaWidth = 0.0; + float tabWidth = 0.0; + float strWidth = 0.0; + // wrap the text do { bool foundTab = false;