Home » U++ TheIDE » U++ TheIDE: CodeEditor, Assist++, Topic++ » CodeEditor new Errors in ScrollBar system
CodeEditor new Errors in ScrollBar system [message #60625] |
Wed, 12 June 2024 11:08 |
cbpporter
Messages: 1425 Registered: September 2007
|
Ultimate Contributor |
|
|
Hi,
After the October 18 2022 update CodeEditor lost its old support for showing errors on the side and now they are shown in the ScrollBar.
I'm trying to adapt to this change.
First of all, as far as I can tell using the new Errors API with a Point made of (column, line) does not respect tabs. The coordinates I'm getting from "console" tools that report errors use proper "expanded" tabs, while CodeEditor treats tabs as advancing column by 1.
I'm trying to figure out the formula to convert between these coordinates, but I was wondering if there is something built in to do this in CodeEditor?
Then I'm not sure about the alignment between the "edited lines display" markers in scroll bar and the error dots. It does look a bit weird/counterintuitive.
And finally the dots are not clickable and jump you to the error, preferably with some visual flare...
Thank you!
PS: I'll post the formula/algorithm for tabs once I find one.
|
|
|
Re: CodeEditor new Errors in ScrollBar system [message #60627 is a reply to message #60625] |
Wed, 12 June 2024 14:13 |
cbpporter
Messages: 1425 Registered: September 2007
|
Ultimate Contributor |
|
|
This looks like it works:
int AdjustForTabs(const String& text, int col, int tabSize) {
int pos = 1;
for (int i = 0; i < text.GetLength(); i++) {
if (text[i] == '\t') {
int newpos = (pos + tabSize - 1) / tabSize * tabSize + 1;
col -= newpos - pos - 1;
pos = newpos;
}
else
pos++;
}
return col;
}
String text = editor.GetUtf8Line(line);
col = AdjustForTabs(text, col, settings.TabSize);
I'll test it for a few days then write a Utf8 friendly version.
|
|
|
Goto Forum:
Current Time: Wed Dec 04 21:46:07 CET 2024
Total time taken to generate the page: 0.02582 seconds
|