]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/wx/lib/editor/selection.py
4 def RestOfLine(sx
, width
, data
, bool):
5 if len(data
) == 0 and sx
== 0:
9 return [(data
[sx
:sx
+width
], bool)]
11 def Selection(SelectBegin
,SelectEnd
, sx
, width
, line
, data
):
12 if SelectEnd
is None or SelectBegin
is None:
13 return RestOfLine(sx
, width
, data
, False)
14 (bRow
, bCol
) = SelectBegin
15 (eRow
, eCol
) = SelectEnd
17 (bRow
, bCol
) = SelectEnd
18 (eRow
, eCol
) = SelectBegin
19 if (line
< bRow
or eRow
< line
):
20 return RestOfLine(sx
, width
, data
, False)
21 if (bRow
< line
and line
< eRow
):
22 return RestOfLine(sx
, width
, data
, True)
23 if (bRow
== eRow
) and (eCol
< bCol
):
24 (bCol
, eCol
) = (eCol
, bCol
)
25 # selection either starts or ends on this line
26 end
= min(sx
+width
, len(data
))
34 pieces
+= [(data
[sx
:bCol
], False)]
36 return [(data
[sx
:end
], False)]
37 pieces
+= [(data
[max(bCol
,sx
):min(eCol
,end
)], True)]
39 pieces
+= [(data
[eCol
:end
], False)]