Dne Čt 13. října 2011 13:34:27 Ladislav Slezak napsal(a):
> Dne 13.10.2011 10:41, jsuch...@svn2.opensuse.org napsal(a):
> > +       if (!textmode)
> > +       {
> > +           // show fixed font in diff
> > +           diff    = "<tt>" + diff + "</tt>";
> > +       }
> 
> Is the condition necessary? I'd expect that ncurses would do nothing if
> <tt> is found and simply ignore it as they cannot change terminal font.
> The same with <font>. Or does it cause some side effects in ncurses UI?

Yes, it somehow highlights the text in the richtext, which looks bad (see 
attached example). It might be bug in ncurses UI, but now I needed quick 
solution for yast2-snapper. 

Gabi?

Jiri

-- 
Jiri Suchomel

SUSE LINUX, s.r.o.                            e-mail: jsuch...@suse.cz
Lihovarská 1060/12                            tel: +420 284 028 960
190 00 Praha 9, Czech Republic                http://www.suse.cz
{
    import "String";
    import "Wizard";

    string rt   = "Index: Kiwi.ycp
===================================================================
--- Kiwi.ycp    (revision 65660)
+++ Kiwi.ycp    (working copy)";

    rt  = String::EscapeTags (rt);

    list<string> rt_l   = (list<string>) maplist (string line, splitstring (rt, 
"\n"), {
        if (String::StartsWith (line, "+"))
        {
            line        = sformat ("<font color=blue>%1</font>", line);
        }
        else if (String::StartsWith (line, "-"))
        {
            line        = sformat ("<font color=red>%1</font>", line);
        }
        return line;
    });

    rt = mergestring (rt_l, "<br>");

    term contents = `VBox (
        `RichText(`id(`rt), rt),
        `RichText(`id(`rt2), "<tt>" + rt + "</tt>")
    );
    Wizard::OpenAcceptDialog ();
    Wizard::SetContents ("diff", contents, "", true, true);
    UI::UserInput();
    Wizard::CloseDialog();
}

Reply via email to