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++ » [Solved] CodeEditor: press BACKSPACE (and DELETE) key twice in order to remove one char.
[Solved] CodeEditor: press BACKSPACE (and DELETE) key twice in order to remove one char. [message #49691] Wed, 04 April 2018 13:31 Go to next message
omari is currently offline  omari
Messages: 264
Registered: March 2010
Experienced Member
in TheIDE, Whenever I delete a character, I have to visually check if the character has delete, otherwise, I retype the delete key.

after investigation, i found the solution here:

bool   TextCtrl::RemoveSelection() {
	int64 l, h;
	if(anchor < 0) return false;
	if(IsRectSelection())
		l = RemoveRectSelection();
	else {
		GetSelection(l, h);
		if(l == h) return false;     <--- Add this line
		Remove((int)l, int(h - l));
	}
	anchor = -1;
	Refresh();
	PlaceCaret(l);
	Action();
	return true;
}


when there is no selection, GetSelection set l and h to same value
then RemoveSelection() shall return false.

Adding the line
if(l == h) return false;
seem to resolve the problem.


regards
omari.

[Updated on: Sat, 11 January 2020 23:02]

Report message to a moderator

Re: [BUG #1858, + PATCH] CodeEditor: press BACKSPACE (and DELETE) key twice in order to remove one char. [message #49749 is a reply to message #49691] Fri, 20 April 2018 13:27 Go to previous message
omari is currently offline  omari
Messages: 264
Registered: March 2010
Experienced Member
after more research, I find that the real source of the problem is the triggering of a MouseMove event while the mouse left button is down.

so to reproduce the problem in theide:
Mouse :
- LeftDown : clicks somewhere in the text
- MouseMove : makes a lettle mouse move in order to raise a MouseMove event, but without selection
- LeftUp : releases the button.

Keyboard:
- press the key BACKSPACE (or DELETE)

==> the key pressed do nothing,


after analyzing LineEdit :: MouseMove:
void LineEdit::MouseMove(Point p, dword flags) {
	if((flags & K_MOUSELEFT) && HasFocus() && HasCapture()) {
		int64 c = GetMousePos(p);
		dorectsel = flags & K_ALT;
		PlaceCaret(c, mpos != c || HasCapture());                  // <<-----
		dorectsel = false;
	}
}


I notice that the line
 PlaceCaret(c, mpos != c || HasCapture());  

is equivalent to
 PlaceCaret(c, true); 
because if HasCapture() is false, the condition
if((flags & K_MOUSELEFT) && HasFocus() && HasCapture())
is false too.

then i think, this line shell be

 PlaceCaret(c, mpos != c );  

which solves the bug


regards
omari.
Previous Topic: what about *.ini highlighter?
Next Topic: simple bug?
Goto Forum:
  


Current Time: Thu Mar 28 11:10:02 CET 2024

Total time taken to generate the page: 0.01625 seconds