]> git.neil.brown.name Git - scribble.git/commitdiff
Allowing inserting a line break in the middle of a text
authorNeil Brown <neilb@notabene.brown>
Thu, 28 Aug 2008 11:32:36 +0000 (21:32 +1000)
committerNeil Brown <neilb@notabene.brown>
Thu, 28 Aug 2008 11:32:36 +0000 (21:32 +1000)
this makes two texts.  They cannot (yet) be joined again.

scribble.py

index 8d13a9149fc36294449665fbe73956d3d344302b..b0dbbfb9d90587f6f34bba1673544cb639620ecf 100755 (executable)
@@ -917,9 +917,11 @@ class ScribblePad:
             if self.textcurs < len(self.textstr):
                 self.textcurs += 1
         elif sym == "<newline>":
+            tail = self.textstr[self.textcurs:]
+            self.textstr = self.textstr[:self.textcurs]
             self.flush_text()
-            self.textcurs = 0
-            self.textstr = ""
+            self.textcurs = len(tail)
+            self.textstr = tail
             self.textpos = [ self.textpos[0], self.textpos[1] +
                              self.lineheight ]
         else: