[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnue] r9042 - trunk/gnue-forms/src/uidrivers/curses/widgets
From: |
johannes |
Subject: |
[gnue] r9042 - trunk/gnue-forms/src/uidrivers/curses/widgets |
Date: |
Tue, 14 Nov 2006 08:25:42 -0600 (CST) |
Author: johannes
Date: 2006-11-14 08:25:42 -0600 (Tue, 14 Nov 2006)
New Revision: 9042
Modified:
trunk/gnue-forms/src/uidrivers/curses/widgets/entry.py
Log:
Better treatment of selections
Modified: trunk/gnue-forms/src/uidrivers/curses/widgets/entry.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/curses/widgets/entry.py 2006-11-14
13:59:12 UTC (rev 9041)
+++ trunk/gnue-forms/src/uidrivers/curses/widgets/entry.py 2006-11-14
14:25:42 UTC (rev 9042)
@@ -158,6 +158,10 @@
def _ui_set_cursor_position_(self, index, position):
+ old_selection = self.__selection[index]
+ self.__selection[index] = None
+ need_repaint = old_selection is not None
+
assert gDebug(2, "----- new position: %s" % position)
assert gDebug(2, " Value : %r" % self.__value[index])
assert gDebug(2, " Curr.Offset : %s/%s" % (self.__offset[index],
@@ -185,7 +189,6 @@
# Get the vertical cursor-position and offset
cpVertical = value.count('\n') - self.__voffset[index] - vcorr
- needRepaint = False
if cpVertical < 0:
# the position is not visible right now, so we need to scroll
@@ -193,7 +196,7 @@
# cursor-position to line 0.
self.__voffset[index] += cpVertical
cpVertical = 1
- needRepaint = True
+ need_repaint = True
elif cpVertical >= self.__height:
# the position is not visible right now, so we need to scroll
@@ -201,7 +204,7 @@
self.__voffset[index] = value.count('\n') - \
self.__height + 1 - vcorr
cpVertical = self.__height # Pos. are Zero-based
- needRepaint = True
+ need_repaint = True
# Now, after having a valid row, we need to determine the
horizontal
# offset based on the last line holding our requested position.
@@ -212,14 +215,14 @@
# Beyond left margin, so scroll to the left
self.__offset[index] += cpHorizontal
cpHorizontal = 0
- needRepaint = True
+ need_repaint = True
elif cpHorizontal > self.__length:
self.__offset[index] = len(currentLine) - self.__length
cpHorizontal = self.__length
- needRepaint = True
+ need_repaint = True
- if needRepaint:
+ if need_repaint:
self.__repaint(index)
cpHorizontal = min(cpHorizontal, self.__length)
@@ -240,14 +243,19 @@
self.__offset[index] = position - self.__length
npos = self.__length
self.__repaint(index)
+ need_repaint = False
elif npos < 0:
self.__offset[index] += npos
npos = 0
self.__repaint(index)
+ need_repaint = False
position = npos
+ if need_repaint:
+ self.__repaint(index)
+
self.__setCursor(position, 0)
@@ -381,6 +389,9 @@
if res is not None:
self._request('REPLACEVALUE', text = res)
else:
+
+ sel = self.__selection[self.__focusIndex]
+ assert gDebug(2, "SELECTION: %s" % repr(sel))
UIHelper._keypress(self, key)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnue] r9042 - trunk/gnue-forms/src/uidrivers/curses/widgets,
johannes <=