SharpDevelop Community

Get your problems solved!
Welcome to SharpDevelop Community Sign in | Join | Help
in Search

4-line-fix to fix a bug in TextArea OnMouseDown method

Last post 11-10-2006 1:25 AM by buddydvd. 0 replies.
Page 1 of 1 (1 items)
Sort Posts: Previous Next
  • 11-10-2006 1:25 AM

    4-line-fix to fix a bug in TextArea OnMouseDown method

    symptom #1 

    how to reproduce:

    1. type the following text in the editor: "Hello world"
    2. RIGHT click the position between the letter "r" and "l". This should bring up the context menu.
    3. now, move the mouse and LEFT click on the character "H"

    expected:

    Current selection should be cleared.

    actual:

    Selection not cleared but is extended from the old position to the new position.

    Following are my changes to the file, TextAreaMouseHandler.cs:

    line 302

    • before:Point realmousepos = textArea.TextView.GetLogicalPosition(mousepos.X - textArea.TextView.DrawingPosition.X, mousepos.Y - textArea.TextView.DrawingPosition.Y);
    • after:Point realmousepos = textArea.TextView.GetLogicalPosition(mousedownpos.X - textArea.TextView.DrawingPosition.X, mousedownpos.Y - textArea.TextView.DrawingPosition.Y);

    line 314

    • before:if (mousepos.Y > 0 && mousepos.Y < textArea.TextView.DrawingPosition.Height) {
    • after:if (mousedownpos.Y > 0 && mousedownpos.Y < textArea.TextView.DrawingPosition.Height) {

    line326

    • before: Point realmousepos = textArea.TextView.GetLogicalPosition(mousepos.X - textArea.TextView.DrawingPosition.X, mousepos.Y - textArea.TextView.DrawingPosition.Y);
    • after: Point realmousepos = textArea.TextView.GetLogicalPosition(mousedownpos.X - textArea.TextView.DrawingPosition.X, mousedownpos.Y - textArea.TextView.DrawingPosition.Y);

    line 333

    • before: if (mousepos.Y > 0 && mousepos.Y < textArea.TextView.DrawingPosition.Height) {
    • after: if (mousedownpos.Y > 0 && mousedownpos.Y < textArea.TextView.DrawingPosition.Height) {

    - David

Page 1 of 1 (1 items)
Powered by Community Server (Commercial Edition), by Telligent Systems
Don't contact us via this (fleischfalle@alphasierrapapa.com) email address.