Fixed bug [ 1870906 ] There are few problems selection text by mouse in RichTextCt
Fixed bug [ 1870265 ] window does not scroll after pasting text Fixed bug [ 1870264 ] wxTextUrlEvent after click in empty space Fixed bug [ 1806479 ] wxRichText URL issues (URL event triggered when clicking on blank space) Fixed bug [ 1806953 ] wxRichTextControl::AddParagraph() is broken Fixed a bug in SelectWord causing bad selections. Added Ctrl+Backspace word deletion. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@52110 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -398,7 +398,7 @@ void wxRichTextCtrl::OnLeftUp(wxMouseEvent& event)
|
||||
wxPoint logicalPt = event.GetLogicalPosition(dc);
|
||||
int hit = GetBuffer().HitTest(dc, logicalPt, position);
|
||||
|
||||
if (hit != wxRICHTEXT_HITTEST_NONE)
|
||||
if ((hit != wxRICHTEXT_HITTEST_NONE) && !(hit & wxRICHTEXT_HITTEST_OUTSIDE))
|
||||
{
|
||||
wxRichTextEvent cmdEvent(
|
||||
wxEVT_COMMAND_RICHTEXT_LEFT_CLICK,
|
||||
@@ -642,7 +642,19 @@ void wxRichTextCtrl::OnChar(wxKeyEvent& event)
|
||||
// so subtract 1 for deleted character and add 1 for conversion to character position.
|
||||
if (m_caretPosition > -1 && !HasSelection())
|
||||
{
|
||||
GetBuffer().DeleteRangeWithUndo(wxRichTextRange(m_caretPosition, m_caretPosition), this);
|
||||
bool processed = false;
|
||||
if (event.CmdDown())
|
||||
{
|
||||
long pos = wxRichTextCtrl::FindNextWordPosition(-1);
|
||||
if (pos != -1 && (pos < m_caretPosition))
|
||||
{
|
||||
GetBuffer().DeleteRangeWithUndo(wxRichTextRange(pos+1, m_caretPosition), this);
|
||||
processed = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!processed)
|
||||
GetBuffer().DeleteRangeWithUndo(wxRichTextRange(m_caretPosition, m_caretPosition), this);
|
||||
}
|
||||
else
|
||||
DeleteSelectedContent();
|
||||
@@ -1915,13 +1927,17 @@ bool wxRichTextCtrl::DoSaveFile(const wxString& filename, int fileType)
|
||||
/// Add a new paragraph of text to the end of the buffer
|
||||
wxRichTextRange wxRichTextCtrl::AddParagraph(const wxString& text)
|
||||
{
|
||||
return GetBuffer().AddParagraph(text);
|
||||
wxRichTextRange range = GetBuffer().AddParagraph(text);
|
||||
LayoutContent();
|
||||
return range;
|
||||
}
|
||||
|
||||
/// Add an image
|
||||
wxRichTextRange wxRichTextCtrl::AddImage(const wxImage& image)
|
||||
{
|
||||
return GetBuffer().AddImage(image);
|
||||
wxRichTextRange range = GetBuffer().AddImage(image);
|
||||
LayoutContent();
|
||||
return range;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -1957,6 +1973,9 @@ bool wxRichTextCtrl::SelectWord(long position)
|
||||
if (!para)
|
||||
return false;
|
||||
|
||||
if (position == para->GetRange().GetEnd())
|
||||
position --;
|
||||
|
||||
long positionStart = position;
|
||||
long positionEnd = position;
|
||||
|
||||
@@ -1984,6 +2003,9 @@ bool wxRichTextCtrl::SelectWord(long position)
|
||||
if (positionEnd >= para->GetRange().GetEnd())
|
||||
positionEnd = para->GetRange().GetEnd();
|
||||
|
||||
if (positionEnd < positionStart)
|
||||
return false;
|
||||
|
||||
SetSelection(positionStart, positionEnd+1);
|
||||
|
||||
if (positionStart >= 0)
|
||||
|
Reference in New Issue
Block a user