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++ Library : Other (not classified elsewhere) » BUG: EditKeys
BUG: EditKeys [message #23542] Thu, 29 October 2009 17:32 Go to next message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
Using key group names with spaces causes RestoreKeys to fail. One symptom of this is that if the user clicks 'Cancel' on the EditKeys dialog then the key settings revert to application defaults.

My fix is to alter the processing of group names in Restore keys by using a ReadGroupName function (previously it used ReadId(), so stopped at spaces):
String ReadGroupName(CParser &p) {
	const char *start = p.GetPtr();
	const char *ptr = start;
	while (*ptr && *ptr != ';') {
		p.GetChar();
		++ptr;
	}
	return String(start, ptr - start);
}	

void RestoreKeys(const String& data)
{
	SetDefaultKeys();
	CParser p(data);
	try {
		while(!p.IsEof()) {
			try {
				p.PassChar('-');
				String group = ReadGroupName(p);
				p.PassChar(';');

etc...

You can probably find a more elegant way though Smile
Re: BUG: EditKeys [message #23552 is a reply to message #23542] Fri, 30 October 2009 14:57 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Thanks, a good observation.

Fixed this way:

String StoreKeys()
{
	String out;
	const VectorMap<String, Vector<KeyBinding> >& g = sKeys();
	for(int i = 0; i < g.GetCount(); i++) {
		out << "- " << AsCString(g.GetKey(i)) << ";\r\n";


void RestoreKeys(const String& data)
{
	SetDefaultKeys();
	CParser p(data);
	try {
		while(!p.IsEof()) {
			try {
				p.PassChar('-');
				String group;
				if(p.IsId()) // backward compatibility
				 	group = p.ReadId();
				else
					group = p.ReadString();

[Updated on: Fri, 30 October 2009 14:57]

Report message to a moderator

Previous Topic: ColumnList BUG FIXED !!! dragging last element makes disappear all other items
Next Topic: BUG: Key states incorrectly cleared on Ubuntu
Goto Forum:
  


Current Time: Tue Apr 16 22:42:43 CEST 2024

Total time taken to generate the page: 0.01608 seconds