replaced utf8 cgj with good ole bel

This commit is contained in:
dockes 2007-10-17 16:12:38 +00:00
parent 02475fba71
commit 7313d22a88

View File

@ -1,5 +1,5 @@
#ifndef lint #ifndef lint
static char rcsid[] = "@(#$Id: plaintorich.cpp,v 1.27 2007-09-08 17:19:58 dockes Exp $ (C) 2005 J.F.Dockes"; static char rcsid[] = "@(#$Id: plaintorich.cpp,v 1.28 2007-10-17 16:12:38 dockes Exp $ (C) 2005 J.F.Dockes";
#endif #endif
/* /*
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -310,24 +310,22 @@ string termAnchorName(int i)
} }
#ifdef QT_SCROLL_TO_ANCHOR_BUG #ifdef QT_SCROLL_TO_ANCHOR_BUG
// 0xcd8f is utf8 for unicode 034F COMBINING GRAPHEME JOINER Qt // qtextedit scrolltoanchor(), which we would like to use to walk the
// doesn't display it, but accepts to search for it. With QT4 it // search hit positions does not work well. So we mark the positions with
// sometimes seems to create a display bug where two adjacent lines // a special string which we then use with the find() function for positionning
// are overstriked, but it shouldn't, see: // We used to use some weird utf8 char for this, but this was displayed
// http://unicode.org/faq/char_combmark.html#17 // inconsistently depending of system, font, etc. We now use a good ole bel
// We are counting on the fact that a sequence of two such chars should be // char which doesnt' seem to cause any trouble.
// extremely unlikely in normal text and not affecting the display. const char *firstTermBeacon = "\007";
const char *firstTermBeacon = "\xcd\x8f\xcd\x8f";
#endif #endif
static string termBeacon(int i) static string termBeacon(int i)
{ {
return string("<a name=\"") + termAnchorName(i) + "\">" return string("<a name=\"") + termAnchorName(i) + "\">"
#ifdef QT_SCROLL_TO_ANCHOR_BUG #ifdef QT_SCROLL_TO_ANCHOR_BUG
+ " " + firstTermBeacon + " " + firstTermBeacon
#endif #endif
+ "</a>"; + "</a>";
} }
@ -452,7 +450,7 @@ bool plaintorich(const string& in, string& out,
chariter.appendchartostring(out); chariter.appendchartostring(out);
} }
} }
#if 0 #if 1
{ {
FILE *fp = fopen("/tmp/debugplaintorich", "a"); FILE *fp = fopen("/tmp/debugplaintorich", "a");
fprintf(fp, "%s\n", out.c_str()); fprintf(fp, "%s\n", out.c_str());