Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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 Go to previous message
cbpporter is currently offline  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.
 
Read Message
Read Message
Previous Topic: TheIDE Topic++ 'Export group to HTML' issue with images
Next Topic: Feature request for Assist++
Goto Forum:
  


Current Time: Mon Feb 17 20:54:09 CET 2025

Total time taken to generate the page: 0.03808 seconds