Fixes artifacts shown in REPL input window.
continuous-integration/drone/push Build is failing Details

This commit is contained in:
Deukhoofd 2021-01-03 14:45:53 +01:00
parent 56538a5552
commit 856c37a583
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
1 changed files with 8 additions and 2 deletions

View File

@ -16,12 +16,18 @@ void UpdateScriptWithParseInfo(WINDOW* inputWindow, const std::u8string& script,
if (diag != nullptr) {
auto start = diag->GetSpan().GetStart();
auto end = diag->GetSpan().GetEnd() + 1;
if (end > script.size()) {
end = script.size();
if (start == end && start > 0) {
start--;
}
}
waddnstr(inputWindow, (char*)script.c_str(), start);
wattron(inputWindow, COLOR_PAIR(1));
waddnstr(inputWindow, (char*)script.c_str() + start, end - start);
waddnstr(inputWindow, (char*)script.substr(start).data(), end - start);
wattroff(inputWindow, COLOR_PAIR(1));
waddnstr(inputWindow, (char*)script.c_str() + end, script.size() - end);
waddnstr(inputWindow, (char*)script.substr(end).data(), script.size() - end);
if (start >= script.size() - 1) {
wattron(inputWindow, COLOR_PAIR(1));