equal
deleted
inserted
replaced
21 # You should have received a copy of the GNU General Public License |
21 # You should have received a copy of the GNU General Public License |
22 # along with this program; if not, write to the Free Software |
22 # along with this program; if not, write to the Free Software |
23 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
23 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
24 |
24 |
25 |
25 |
26 from __future__ import absolute_import |
26 |
27 from functools import reduce |
27 from functools import reduce |
28 import wx |
28 import wx |
29 import wx.stc |
29 import wx.stc |
30 from six.moves import xrange |
30 from six.moves import xrange |
31 |
31 |
70 return 0 |
70 return 0 |
71 old_length = len(old) |
71 old_length = len(old) |
72 new_length = len(new) |
72 new_length = len(new) |
73 common_length = min(old_length, new_length) |
73 common_length = min(old_length, new_length) |
74 i = 0 |
74 i = 0 |
75 for i in xrange(common_length): |
75 for i in range(common_length): |
76 if old[i] != new[i]: |
76 if old[i] != new[i]: |
77 break |
77 break |
78 if old_length < new_length: |
78 if old_length < new_length: |
79 if common_length > 0 and old[i] != new[i]: |
79 if common_length > 0 and old[i] != new[i]: |
80 return i + new_length - old_length |
80 return i + new_length - old_length |
100 if wx.Platform == '__WXMSW__': |
100 if wx.Platform == '__WXMSW__': |
101 if not event.Dragging(): |
101 if not event.Dragging(): |
102 x, _y = event.GetPosition() |
102 x, _y = event.GetPosition() |
103 margin_width = reduce( |
103 margin_width = reduce( |
104 lambda x, y: x + y, |
104 lambda x, y: x + y, |
105 [self.GetMarginWidth(i) for i in xrange(3)], |
105 [self.GetMarginWidth(i) for i in range(3)], |
106 0) |
106 0) |
107 if x <= margin_width: |
107 if x <= margin_width: |
108 self.SetCursor(wx.Cursor(wx.CURSOR_ARROW)) |
108 self.SetCursor(wx.Cursor(wx.CURSOR_ARROW)) |
109 else: |
109 else: |
110 self.SetCursor(wx.Cursor(wx.CURSOR_IBEAM)) |
110 self.SetCursor(wx.Cursor(wx.CURSOR_IBEAM)) |