Home » U++ TheIDE » U++ TheIDE: CodeEditor, Assist++, Topic++ » CodeEditor new Errors in ScrollBar system
Re: CodeEditor new Errors in ScrollBar system [message #60627 is a reply to message #60625] |
Wed, 12 June 2024 14:13  |
cbpporter
Messages: 1426 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: Mon Feb 17 20:54:09 CET 2025
Total time taken to generate the page: 0.03808 seconds
|