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++ Library support » U++ Widgets - General questions or Mixed problems » Problem in CodeEditor
Re: Problem in CodeEditor [message #39139 is a reply to message #39138] Mon, 18 February 2013 16:29 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 13980
Registered: November 2005
Ultimate Member
koldo wrote on Mon, 18 February 2013 08:57

Hello Mirek

I get an error using CodeEditor when pasting a text in an empty CodeEditor.

With line == 0, as li is empty,

void EditorBar::ClearErrors(int line)
{
	int count;
	if(line < 0) {
		line = 0;
		count = li.GetCount();
	}
	else
		count = line + 1;

	for(int i = line; i < count; i++)
		li[i].error = 0;	// Assert here
}


A possible solution could be this:

void EditorBar::ClearErrors(int line)
{
	int count;
	if(line < 0) {
		line = 0;
		count = li.GetCount();
	}
	else if (line >= li.GetCount())	// Added
		count = li.GetCount();
	else
		count = line + 1;

	for(int i = line; i < count; i++)
		li[i].error = 0;
}



Would not a simple return be enough?

void EditorBar::ClearErrors(int line)
{
	int count;
	if(line < 0) {
		line = 0;
		count = li.GetCount();
	}
	else if (line >= li.GetCount())	// Added
		return;
	else
		count = line + 1;

	for(int i = line; i < count; i++)
		li[i].error = 0;
}


(Fixed).

Mirek
 
Read Message
Read Message
Read Message
Previous Topic: Solved: How to use WhenCancel callback for DropList
Next Topic: autocomplete editbox
Goto Forum:
  


Current Time: Fri May 17 22:38:55 CEST 2024

Total time taken to generate the page: 0.01594 seconds