dabo Commit
Revision 6967
Date: 2011-11-09 09:06:16 -0800 (Wed, 09 Nov 2011)
Author: Ed
Trac: http://trac.dabodev.com/changeset/6967
Changed:
U trunk/dabo/ui/uiwx/dEditor.py
Log:
Added the getLineText() method, which returns the full text of the line at the
specified position.
Diff:
Modified: trunk/dabo/ui/uiwx/dEditor.py
===================================================================
--- trunk/dabo/ui/uiwx/dEditor.py 2011-11-09 16:58:02 UTC (rev 6966)
+++ trunk/dabo/ui/uiwx/dEditor.py 2011-11-09 17:06:16 UTC (rev 6967)
@@ -540,6 +540,21 @@
return ret
+ def getLineText(self, pos=None):
+ """
+ Returns the full text of the line containing specified
position, or if
+ no position is passed, for the current insertion point.
+ """
+ if pos is None:
+ pos = self.GetCurrentPos()
+ lnum = self.LineFromPosition(pos)
+ startpos = self.PositionFromLine(lnum)
+ endpos = self.PositionFromLine(lnum + 1)
+ ret = self.Value[startpos:endpos]
+ # Strip any trailing newline chars.
+ return ret.rstrip(chr(13) + chr(10))
+
+
def getLineFromPosition(self, pos):
"""
Given a position within the text, returns the corresponding line
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message:
http://leafe.com/archives/byMID/[email protected]