[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] gzz/gzz/modules/pp demotest.py
From: |
Asko Soukka |
Subject: |
[Gzz-commits] gzz/gzz/modules/pp demotest.py |
Date: |
Fri, 10 Jan 2003 05:35:05 -0500 |
CVSROOT: /cvsroot/gzz
Module name: gzz
Changes by: Asko Soukka <address@hidden> 03/01/10 05:35:04
Modified files:
gzz/modules/pp : demotest.py
Log message:
More keybingings for text-editing: Up, Down, Home, End, Ctrl-Home and
Ctrl-End.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/modules/pp/demotest.py.diff?tr1=1.57&tr2=1.58&r1=text&r2=text
Patches:
Index: gzz/gzz/modules/pp/demotest.py
diff -u gzz/gzz/modules/pp/demotest.py:1.57 gzz/gzz/modules/pp/demotest.py:1.58
--- gzz/gzz/modules/pp/demotest.py:1.57 Fri Jan 10 04:58:41 2003
+++ gzz/gzz/modules/pp/demotest.py Fri Jan 10 05:35:04 2003
@@ -185,7 +185,8 @@
# Keys to move around
if key == "Left" or key == "Right" \
or key == "Up" or key == "Down" \
- or key == "Home" or key == "End":
+ or key == "Home" or key == "End" \
+ or key == "Ctrl-HomE" or key == "Ctrl-EnD":
self.ppv.viewMode = self.ppv.TEXT_EDITING
self.ppv.showLinkbuoys = 0
@@ -203,11 +204,51 @@
if key == "Right":
if offs < len(c.t()):
self.avc.setCursorOffset(offs+1)
+ if key == "Ctrl-HomE":
+ self.avc.setCursorOffset(0)
+ if key == "Ctrl-EnD":
+ self.avc.setCursorOffset(len(c.t()))
+ if key == "Home":
+ pre_breaks = c.t()[0:offs].count("\n")
+ if pre_breaks == 0:
+ self.avc.setCursorOffset(0)
+ else:
+ lines = c.t()[0:offs].split("\n")
+ self.avc.setCursorOffset(offs - len(lines[len(lines)-1]))
+ if key == "End":
+ post_breaks = c.t()[offs:].count("\n")
+ if post_breaks == 0:
+ self.avc.setCursorOffset(len(c.t()))
+ else:
+ lines = c.t()[offs:].split("\n")
+ self.avc.setCursorOffset(offs + len(lines[0]))
if key == "Up":
- self.avc.setCursorOffset(0)
+ pre_breaks = c.t()[0:offs].count("\n")
+ if pre_breaks == 0:
+ self.avc.setCursorOffset(0)
+ else:
+ lines = c.t()[0:offs].split("\n")
+ lineoffs = len(lines[len(lines)-1])
+ if len(lines[pre_breaks-1]) >= lineoffs:
+ self.avc.setCursorOffset(offs - (lineoffs+1) \
+ - (len(lines[pre_breaks-1]) -
lineoffs))
+ else:
+ self.avc.setCursorOffset(offs - (lineoffs+1))
if key == "Down":
- self.avc.setCursorOffset(len(c.t()))
-
+ post_breaks = c.t()[offs:].count("\n")
+ if post_breaks == 0:
+ self.avc.setCursorOffset(len(c.t()))
+ else:
+ lines = c.t()[0:offs].split("\n")
+ lineoffs = len(lines[len(lines)-1])
+ lines = c.t()[offs:].split("\n")
+ print "Lineoffs: %s" % (lineoffs)
+ if len(lines[1]) >= lineoffs:
+ self.avc.setCursorOffset(offs + (len(lines[0])+1) \
+ + lineoffs)
+ else:
+ self.avc.setCursorOffset(offs + (len(lines[0])+1) \
+ + len(lines[1]))
# Keys to edit text
if len(key) == 1 or key == "Backspace" or \
key == "Delete" or key == "Return":
- [Gzz-commits] gzz/gzz/modules/pp demotest.py, Matti Katila, 2003/01/03
- [Gzz-commits] gzz/gzz/modules/pp demotest.py, Matti Katila, 2003/01/03
- [Gzz-commits] gzz/gzz/modules/pp demotest.py, Matti Katila, 2003/01/03
- [Gzz-commits] gzz/gzz/modules/pp demotest.py, Matti Katila, 2003/01/05
- [Gzz-commits] gzz/gzz/modules/pp demotest.py, Matti Katila, 2003/01/07
- [Gzz-commits] gzz/gzz/modules/pp demotest.py, Matti Katila, 2003/01/07
- [Gzz-commits] gzz/gzz/modules/pp demotest.py, Matti Katila, 2003/01/09
- [Gzz-commits] gzz/gzz/modules/pp demotest.py, Matti Katila, 2003/01/10
- [Gzz-commits] gzz/gzz/modules/pp demotest.py, Matti Katila, 2003/01/10
- [Gzz-commits] gzz/gzz/modules/pp demotest.py, Matti Katila, 2003/01/10
- [Gzz-commits] gzz/gzz/modules/pp demotest.py,
Asko Soukka <=