diff --git a/docs/changes.txt b/docs/changes.txt index 1dddd4b0fc..290706e9d6 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -94,6 +94,7 @@ Major new features in 2.8 release All (GUI): - Added colour normalization to PNM image handler (Ray Johnston) +- Fixed selecting part of word from right to left in wxHTML (Michael Hieke) wxMSW: diff --git a/src/html/htmlcell.cpp b/src/html/htmlcell.cpp index 751efd8eaa..8bcd8eb095 100644 --- a/src/html/htmlcell.cpp +++ b/src/html/htmlcell.cpp @@ -381,6 +381,16 @@ void wxHtmlWordCell::Split(const wxDC& dc, wxPoint pt2 = (selTo == wxDefaultPosition) ? wxPoint(m_Width, wxDefaultCoord) : selTo - GetAbsPos(); + // if the selection is entirely within this cell, make sure pt1 < pt2 in + // order to make the rest of this function simpler: + if ( selFrom != wxDefaultPosition && selTo != wxDefaultPosition && + selFrom.x > selTo.x ) + { + wxPoint tmp = pt1; + pt1 = pt2; + pt2 = tmp; + } + unsigned len = m_Word.length(); unsigned i = 0; pos1 = 0;