summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>1998-10-06 15:47:45 (GMT)
committerBarry Warsaw <barry@python.org>1998-10-06 15:47:45 (GMT)
commita398924c6a6273c2311835fb8ba16a7f4dbf0b55 (patch)
tree8e89e75af5db07696c707eef01b0a794753d3c38
parentae4ad6e45429112b907c231d1b250cdd1069a2f7 (diff)
downloadcpython-a398924c6a6273c2311835fb8ba16a7f4dbf0b55.zip
cpython-a398924c6a6273c2311835fb8ba16a7f4dbf0b55.tar.gz
cpython-a398924c6a6273c2311835fb8ba16a7f4dbf0b55.tar.bz2
__normalize(): Preserve the location of the icursor and restore it so
that Left/Right arrow keys and C-a C-e all work.
-rw-r--r--Tools/pynche/TypeinViewer.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/Tools/pynche/TypeinViewer.py b/Tools/pynche/TypeinViewer.py
index 63df363..ee3aa21 100644
--- a/Tools/pynche/TypeinViewer.py
+++ b/Tools/pynche/TypeinViewer.py
@@ -74,6 +74,7 @@ class TypeinViewer:
def __normalize(self, event=None):
ew = event.widget
contents = ew.get()
+ icursor = ew.index(INSERT)
if contents == '':
contents = '0'
# figure out what the contents value is in the current base
@@ -90,12 +91,14 @@ class TypeinViewer:
i = ew.index(INSERT)
contents = contents[:i-1] + contents[i:]
ew.bell()
+ icursor = icursor-1
elif self.__hexp.get():
contents = hex(v)
else:
contents = int(v)
ew.delete(0, END)
ew.insert(0, contents)
+ ew.icursor(icursor)
def __maybeupdate(self, event=None):
if self.__uwtyping.get() or event.keysym in ('Return', 'Tab'):