[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdelibs/kate/part
From: John Tapsell <john () geola ! co ! uk>
Date: 2004-12-31 19:42:15
Message-ID: 20041231194215.1FB3B18869 () office ! kde ! org
[Download RAW message or body]
CVS commit by johnflux:
Optimization - Over halve the size of an "export to html" file (which also reduces \
the size when copying to clipboard)
M +0 -1 katedocument.cpp 1.781
M +10 -6 katetextline.cpp 1.89
--- kdelibs/kate/part/katedocument.cpp #1.780:1.781
@@ -662,5 +662,4 @@ void KateDocument::textAsHtmlStream ( ui
}
}
- (*ts) << "</span>"; // i'm guaranteed a span is started (i started one at the \
beginning of the output). (*ts) << "</pre>";
}
--- kdelibs/kate/part/katetextline.cpp #1.88:1.89
@@ -404,4 +404,5 @@ char *KateTextLine::restore (char *buf)
void KateTextLine::stringAsHtml(uint startCol, uint length, KateRenderer *renderer, \
QTextStream *outputStream) const {
+ if(length == 0) return;
// some variables :
bool previousCharacterWasBold = false;
@@ -412,5 +413,6 @@ void KateTextLine::stringAsHtml(uint sta
bool needToReinitializeTags = false;
QColor previousCharacterColor(0,0,0); // default color of HTML characters is black
- (*outputStream) << "<span style='color: #000000'>";
+ QColor blackColor(0,0,0);
+// (*outputStream) << "<span style='color: #000000'>";
@@ -434,4 +436,5 @@ void KateTextLine::stringAsHtml(uint sta
// close the previous font tag :
+ if(previousCharacterColor != blackColor)
(*outputStream) << "</span>";
// let's read that color :
@@ -439,4 +442,5 @@ void KateTextLine::stringAsHtml(uint sta
// getting the red, green, blue values of the color :
charAttributes->textColor().rgb(&red, &green, &blue);
+ if(!(red == 0 && green == 0 && blue == 0)) {
(*outputStream) << "<span style='color: #"
<< ( (red < 0x10)?"0":"") // need to put 0f, NOT f for instance. \
don't touch 1f. @@ -447,4 +451,5 @@ void KateTextLine::stringAsHtml(uint sta
<< QString::number(blue, 16)
<< "'>";
+ }
// we need to reinitialize the bold/italic status, since we closed all the \
tags needToReinitializeTags = true;
@@ -483,7 +488,6 @@ void KateTextLine::stringAsHtml(uint sta
(*outputStream) << "</i>";
- // HTML document end :
- (*outputStream) << "</span>"; // i'm guaranteed a span is started (i started one \
at the beginning of the output).
-
+ if(previousCharacterColor != blackColor)
+ (*outputStream) << "</span>";
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic