Switch to unified view

a/src/qtgui/plaintorich.cpp b/src/qtgui/plaintorich.cpp
1
#ifndef lint
1
#ifndef lint
2
static char rcsid[] = "@(#$Id: plaintorich.cpp,v 1.27 2007-09-08 17:19:58 dockes Exp $ (C) 2005 J.F.Dockes";
2
static char rcsid[] = "@(#$Id: plaintorich.cpp,v 1.28 2007-10-17 16:12:38 dockes Exp $ (C) 2005 J.F.Dockes";
3
#endif
3
#endif
4
/*
4
/*
5
 *   This program is free software; you can redistribute it and/or modify
5
 *   This program is free software; you can redistribute it and/or modify
6
 *   it under the terms of the GNU General Public License as published by
6
 *   it under the terms of the GNU General Public License as published by
7
 *   the Free Software Foundation; either version 2 of the License, or
7
 *   the Free Software Foundation; either version 2 of the License, or
...
...
308
    sprintf(acname, "%s%d", termAnchorNameBase, i);
308
    sprintf(acname, "%s%d", termAnchorNameBase, i);
309
    return string(acname);
309
    return string(acname);
310
}
310
}
311
311
312
#ifdef QT_SCROLL_TO_ANCHOR_BUG
312
#ifdef QT_SCROLL_TO_ANCHOR_BUG
313
// 0xcd8f is utf8 for unicode 034F COMBINING GRAPHEME JOINER Qt
313
// qtextedit scrolltoanchor(), which we would like to use to walk the 
314
// doesn't display it, but accepts to search for it. With QT4 it
314
// search hit positions does not work well. So we mark the positions with
315
// sometimes seems to create a display bug where two adjacent lines
315
// a special string which we then use with the find() function for positionning
316
// are overstriked, but it shouldn't, see:
316
// We used to use some weird utf8 char for this, but this was displayed 
317
// http://unicode.org/faq/char_combmark.html#17
317
// inconsistently depending of system, font, etc. We now use a good ole bel 
318
// We are counting on the fact that a sequence of two such chars should be 
318
// char which doesnt' seem to cause any trouble.
319
// extremely unlikely in normal text and not affecting the display.
320
const char *firstTermBeacon = "\xcd\x8f\xcd\x8f";
319
const char *firstTermBeacon = "\007";
321
#endif
320
#endif
322
321
323
static string termBeacon(int i)
322
static string termBeacon(int i)
324
{
323
{
325
    return string("<a name=\"") + termAnchorName(i) + "\">"
324
    return string("<a name=\"") + termAnchorName(i) + "\">"
326
#ifdef QT_SCROLL_TO_ANCHOR_BUG
325
#ifdef QT_SCROLL_TO_ANCHOR_BUG
327
            + " " + firstTermBeacon + " "
326
            + firstTermBeacon
328
#endif
327
#endif
329
            + "</a>";
328
            + "</a>";
330
331
}
329
}
332
330
333
331
334
// Fix result text for display inside the gui text window.
332
// Fix result text for display inside the gui text window.
335
//
333
//
...
...
450
        ateol = 0;
448
        ateol = 0;
451
        }
449
        }
452
        chariter.appendchartostring(out);
450
        chariter.appendchartostring(out);
453
    }
451
    }
454
    }
452
    }
455
#if 0
453
#if 1
456
    {
454
    {
457
    FILE *fp = fopen("/tmp/debugplaintorich", "a");
455
    FILE *fp = fopen("/tmp/debugplaintorich", "a");
458
    fprintf(fp, "%s\n", out.c_str());
456
    fprintf(fp, "%s\n", out.c_str());
459
    fclose(fp);
457
    fclose(fp);
460
    }
458
    }