Author Topic: Right-Click unselects highlighted text  (Read 7220 times)

Offline RJP Computing

  • Almost regular
  • **
  • Posts: 135
    • RJP Computing
Right-Click unselects highlighted text
« on: October 25, 2005, 11:42:53 pm »
I am using Windows XP SP2 and Code::Blocks version 1.0-RC2.

When you right-click after highlighting text it gets unselected. This basically makes the 'Edit' menu items useless. eg. Cut and Copy.

- Ryan

- Ryan

Ubuntu/WinXP, AMD Athlon 64 3000+, 1000MB RAM, AC 97 Audio, ATI Radeon 9600XT 256MB

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: Right-Click unselects highlighted text
« Reply #1 on: October 25, 2005, 11:48:18 pm »
This seems to be a bug. Please report it at sourceforge.

Thanks! :)

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: Right-Click unselects highlighted text
« Reply #2 on: October 31, 2005, 03:59:29 am »
OK, i see it reported as bug #1342953.
http://sourceforge.net/tracker/index.php?func=detail&aid=1342953&group_id=126998&atid=707416

I'd appreciate it if any of the devs would give us a hand with this. I'll try to pinpoint the bug, but I'm not sure I can find it.

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Right-Click unselects highlighted text
« Reply #3 on: October 31, 2005, 08:53:17 am »
Fixed.


EDIT:
The fix has the side effect that you have to select a word before you can use "Find declaration of..." (but that is the lesser evil).
The best solution will probably be to check whether there is currently a selection and whether the click is inside that selection. Otherwise, proceed as before. I haven't figured that yet, though.
Another solution (a lot easier) would be to rewrite "Find declaration of..." to use the click position rather than the cursor position. Not good, don't have mouse position available at that time.

EDIT 2:
Done that, too. Right-click in selection keeps selection. Right-click outside selection behaves as before. Guess that can be considered final now.
« Last Edit: October 31, 2005, 10:47:29 am by thomas »
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Right-Click unselects highlighted text
« Reply #4 on: October 31, 2005, 11:56:18 am »
Thanks Thomas :)
Be patient!
This bug will be fixed soon...

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: Right-Click unselects highlighted text
« Reply #5 on: October 31, 2005, 04:38:08 pm »
Thanks a lot! What sourcefiles did you change? Did you update the sourceforge bug?

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Right-Click unselects highlighted text
« Reply #6 on: October 31, 2005, 05:25:10 pm »
What sourcefiles did you change?
cbEditor.h:
Code
 bool cbEditor::OnBeforeBuildContextMenu(bool noeditor)
 {
     if (!noeditor)
     {
         cbStyledTextCtrl* control = Manager::Get()->GetEditorManager()->....
         int pos = control->PositionFromPoint(control->ScreenToClient(wxGetMousePosition()));
-        control->GotoPos(pos);
+        if(control->GetSelectionStart() > pos || control->GetSelectionEnd() < pos)
+            control->GotoPos(pos);
     }
...
}

Did you update the sourceforge bug?
Uhh.... no admin rights? ;)
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: Right-Click unselects highlighted text
« Reply #7 on: October 31, 2005, 05:33:34 pm »
You just have to be logged in. I gave you technician privileges, so you can close the bug and mark it "fixed".

Edit: Hmmm... Thomas just send me a screenshot. Are *only* admins allowed to change bugs' status? (I closed the bug anyway)
« Last Edit: October 31, 2005, 07:30:14 pm by rickg22 »