polytronicgr / gwen-dotnet

Automatically exported from code.google.com/p/gwen-dotnet
0 stars 0 forks source link

TextBoxNumeric in color picker controls crashes on insert #3

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Click on any color picker textboxes, try to enter numbers - crash. Seems like 
erasing selection doesn't update cursor bounds correctly (or something is wrong 
with text-value sync).

Original issue reported on code.google.com by der.ag...@gmail.com on 18 Aug 2011 at 7:20

GoogleCodeExporter commented 8 years ago
I Implemented this fix. In file TextBox.cs in function DeleteText at line 477.
Modified CursorPos = m_CursorPos - length to the below. This seems more 
sensible. Length often results in a negative index to the string - which is no 
good.

       public virtual void DeleteText(int startPos, int length)
        {
            String str = Text;
            str = str.Remove(startPos, length);
            SetText(str);

            if (m_CursorPos > startPos)
            {
                CursorPos = m_CursorPos - startPos;
            }

            CursorEnd = m_CursorPos;
        }

Original comment by dlanna...@gmail.com on 4 Aug 2012 at 2:20

GoogleCodeExporter commented 8 years ago
This change causes strange behavior when you use delete/backspace in the middle 
of text.

Original comment by der.ag...@gmail.com on 11 Aug 2012 at 12:33