]> granicus.if.org Git - python/commitdiff
__normalize(): Preserve the location of the icursor and restore it so
authorBarry Warsaw <barry@python.org>
Tue, 6 Oct 1998 15:47:45 +0000 (15:47 +0000)
committerBarry Warsaw <barry@python.org>
Tue, 6 Oct 1998 15:47:45 +0000 (15:47 +0000)
that Left/Right arrow keys and C-a C-e all work.

Tools/pynche/TypeinViewer.py

index 63df363791179879a81e1e04f955068c0a1e53a8..ee3aa21f91b9d8c6b288488765f7c877b0121309 100644 (file)
@@ -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'):