2 Copyright (c) 2006 Paolo Capriotti <p.capriotti@gmail.com>
3 (c) 2006 Maurizio Monge <maurizio.monge@kdemail.net>
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
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
14 #include "highlighter.h"
16 #include "luaapi/luahl.h"
17 #include <QTextCharFormat>
20 //BEGIN ConsoleOutput ---------------------------------------
23 * An utility class to perform a simple output operation
24 * on a QTextEdit with RAII.
31 ConsoleOutput(QTextEdit
* edit
, bool force_scroll
= false);
33 virtual ~ConsoleOutput();
35 virtual void operator()(const QString
& text
);
38 class ConsoleHighlighter
{
39 std::vector
<Highlighter::Pattern
> m_patterns
;
41 QTextCharFormat m_basic_format
;
45 void setDisplay(QTextEdit
* display
);
47 void operator()(const QString
& text
, ConsoleOutput
& output
);
50 class LuaConsoleHighlighter
{
53 class Executor
: public HLineExecutor
{
55 ConsoleOutput
& m_output
;
57 Executor(QTextEdit
* display
, ConsoleOutput
& output
);
59 virtual void writeChunk(const QString
& text
);
60 virtual void setFormat(const QTextCharFormat
& format
);
63 LuaConsoleHighlighter();
64 void setDisplay(QTextEdit
* display
);
65 void operator()(const QString
& text
, ConsoleOutput
& output
);