]> git.saurik.com Git - wxWidgets.git/commitdiff
fixed selecting part of word from right to left in wxHTML (patch #1719530)
authorVáclav Slavík <vslavik@fastmail.fm>
Sun, 17 Jun 2007 17:31:09 +0000 (17:31 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Sun, 17 Jun 2007 17:31:09 +0000 (17:31 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46505 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/html/htmlcell.cpp

index feeabd00c3ee16323c9992a21ffa5594e9b2b83d..d70af49a3a76e057175ffc16576ef7cca502d5e5 100644 (file)
@@ -386,6 +386,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;