Skip to content

Commit a0a51de

Browse files
committed
installer: fix rendering of <RED>/<A> in paragraphs
Funnily enough, `GetTextWidth()` produces a non-zero width for Line Feed charaters. When determining the horizontal offset while rendering the colored text, we do accumulate in the `RowPrefix` variable all uncolored text, except Carriage Return characters (which re-set the `RowPrefix` variable to the empty string). Crucially, we also include Line Feed characters, Which means that our rendering is screwed up when using the `<RED>` or `<A>` tag in everything but the first line of each paragraph. Let's work around that issue simply by skipping the Line Feed characters (but only after a Carriage Return, every other instance would not make sense anyway). Happily, this does not affect any existing label. But we are about to introduce a new label that would be affected, so let's fix the bug Right Now. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 560dcf2 commit a0a51de

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

installer/install.iss

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1259,7 +1259,10 @@ begin
12591259
end;
12601260
'<RED>': begin
12611261
Untagged:=Untagged+SubString(Description,1,i-1);
1262-
RowPrefix:=RowPrefix+SubString(Description,1,i-1);
1262+
if (Description[1]=#10) then
1263+
RowPrefix:=RowPrefix+SubString(Description,2,i-2)
1264+
else
1265+
RowPrefix:=RowPrefix+SubString(Description,1,i-1);
12631266
Description:=SubString(Description,i+5,-1);
12641267
i:=Pos('</RED>',Description);
12651268
if (i=0) then LogError('Could not find </RED> in '+Description);
@@ -1300,7 +1303,10 @@ begin
13001303
end;
13011304
'<A HREF=': begin
13021305
Untagged:=Untagged+SubString(Description,1,i-1);
1303-
RowPrefix:=RowPrefix+SubString(Description,1,i-1);
1306+
if Description[1]=#10 then
1307+
RowPrefix:=RowPrefix+SubString(Description,2,i-2)
1308+
else
1309+
RowPrefix:=RowPrefix+SubString(Description,1,i-1);
13041310
Description:=SubString(Description,i+8,-1);
13051311
i:=Pos('>',Description);
13061312
if (i=0) then LogError('Could not find > in '+Description);

0 commit comments

Comments
 (0)