-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlspdebug.cpp
More file actions
36 lines (28 loc) · 1.03 KB
/
Copy pathlspdebug.cpp
File metadata and controls
36 lines (28 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include "lspdebug.h"
#include "application.h"
LspDebug::LspDebug(Widget *parent) : Widget(parent) {
id = icu::UnicodeString::fromUTF8("LspDebug");
viewbox = new TextEdit(this, [](Widget*){});
}
void LspDebug::lspmessage(std::string& from, std::string& message) {
new std::thread([=]() {
std::lock_guard<std::mutex> lock(App::canMakeChanges);
Cursor c = Cursor();
c.head_line = viewbox->lines.size()-1;
c.head_char = viewbox->lines[c.head_line].line_text.length();
c.anchor_line = c.head_line;
c.anchor_char = c.head_char;
std::string newstring = "\n\n["+from+"] --> "+trim(message);
icu::UnicodeString log = icu::UnicodeString::fromUTF8(newstring);
viewbox->insertTextAtCursor(c, log);
});
}
void LspDebug::render() {
Widget::render();
if (rounded) {
App::DrawInverseRoundedRect(t_x, t_y, t_w, t_h, App::text_padding, App::theme.main_background_color);
App::DrawRoundBorder(t_x, t_y, t_w, t_h, App::theme.border, 5, App::text_padding);
}else{
App::DrawBorder(t_x, t_y, t_w, t_h, App::theme.border);
}
}