mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 23:28:11 +00:00
LibSyntax+LibGUI+LibJS: Move JS syntax highlighter to LibJS
This is a little bit messy but the basic idea is: Syntax::Highlighter now has a Syntax::HighlighterClient to talk to the outside world. It mostly communicates in LibGUI primitives that are available in headers, so inlineable. GUI::TextEditor inherits from Syntax::HighlighterClient. This let us to move GUI::JSSyntaxHighlighter to JS::SyntaxHighlighter and remove LibGUI's dependency on LibJS.
This commit is contained in:
parent
22baa5e64f
commit
ddbf20ecf6
23 changed files with 139 additions and 80 deletions
|
@ -28,13 +28,13 @@
|
|||
#include <AK/StringBuilder.h>
|
||||
#include <LibGUI/BoxLayout.h>
|
||||
#include <LibGUI/Button.h>
|
||||
#include <LibGUI/JSSyntaxHighlighter.h>
|
||||
#include <LibGUI/TextBox.h>
|
||||
#include <LibGfx/FontDatabase.h>
|
||||
#include <LibJS/Interpreter.h>
|
||||
#include <LibJS/MarkupGenerator.h>
|
||||
#include <LibJS/Parser.h>
|
||||
#include <LibJS/Runtime/Error.h>
|
||||
#include <LibJS/SyntaxHighlighter.h>
|
||||
#include <LibWeb/DOM/DocumentType.h>
|
||||
#include <LibWeb/DOM/ElementFactory.h>
|
||||
#include <LibWeb/DOM/Text.h>
|
||||
|
@ -66,7 +66,7 @@ ConsoleWidget::ConsoleWidget()
|
|||
bottom_container.set_fixed_height(22);
|
||||
|
||||
m_input = bottom_container.add<GUI::TextBox>();
|
||||
m_input->set_syntax_highlighter(make<GUI::JSSyntaxHighlighter>());
|
||||
m_input->set_syntax_highlighter(make<JS::SyntaxHighlighter>());
|
||||
// FIXME: Syntax Highlighting breaks the cursor's position on non fixed-width fonts.
|
||||
m_input->set_font(Gfx::FontDatabase::default_fixed_width_font());
|
||||
m_input->set_history_enabled(true);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue