This commit is contained in:
2026-04-13 19:45:58 +01:00
parent 037f884050
commit 013bffcad9
7 changed files with 16 additions and 5 deletions
+1 -1
View File
@@ -5,7 +5,7 @@
#include "syntax/decl.h"
#include "windows/decl.h"
void Bar::log(std::string message) { log_line = message; }
void Bar::log(std::string message) { log_line = strip_newlines(message); }
void Bar::render(std::vector<ScreenCell> &buffer) {
USING(LSPInstance);
+1
View File
@@ -59,6 +59,7 @@ char *load_file(const char *path, uint32_t *out_len, bool *out_eol) {
bool has_utf8_bom = (bom[0] == 0xEF && bom[1] == 0xBB && bom[2] == 0xBF);
uint32_t skip = has_utf8_bom ? 3 : 0;
uint32_t data_len = static_cast<uint32_t>(len) - skip;
file.clear();
file.seekg(skip, std::ios::beg);
char *buf = (char *)malloc(data_len + 1);
if (!buf)
+9
View File
@@ -91,6 +91,15 @@ std::string trim(const std::string &s) {
return s.substr(start, end - start + 1);
}
std::string strip_newlines(const std::string &s) {
std::string out;
out.reserve(s.size());
for (char c : s)
if (c != '\n' && c != '\r')
out.push_back(c);
return out;
}
std::string clean_text(const std::string &input) {
std::string result = input;
static const std::unordered_map<std::string, std::string> entities = {