[tor-commits] [arm/master] Expanding connection line selection by a space

atagar at torproject.org atagar at torproject.org
Sat May 14 02:48:18 UTC 2011


commit 860511ce71e2ad947014271bd2517624fb38289e
Author: Damian Johnson <atagar at torproject.org>
Date:   Fri May 13 18:21:43 2011 -0700

    Expanding connection line selection by a space
    
    The connection panel looks a little better if selection hilighting stretches
    all the way to the left window edge.
---
 src/cli/connections/circEntry.py |    4 +++-
 src/cli/connections/connEntry.py |    6 ++++--
 src/cli/connections/connPanel.py |    4 ++--
 3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/cli/connections/circEntry.py b/src/cli/connections/circEntry.py
index b15b26a..82ef0ff 100644
--- a/src/cli/connections/circEntry.py
+++ b/src/cli/connections/circEntry.py
@@ -177,13 +177,14 @@ class CircLine(connEntry.ConnectionLine):
     lineFormat = uiTools.getColor(connEntry.CATEGORY_COLOR[self.getType()])
     
     # The required widths are the sum of the following:
+    # initial space (1 character)
     # bracketing (3 characters)
     # placementLabel (14 characters)
     # gap between etc and placement label (5 characters)
     
     if self.isLast: bracket = (curses.ACS_LLCORNER, curses.ACS_HLINE, ord(' '))
     else: bracket = (curses.ACS_VLINE, ord(' '), ord(' '))
-    baselineSpace = len(bracket) + 14 + 5
+    baselineSpace = len(bracket) + 14 + 5 + 1
     
     dst, etc = "", ""
     if listingType == entries.ListingType.IP_ADDRESS:
@@ -212,5 +213,6 @@ class CircLine(connEntry.ConnectionLine):
     drawEntry = uiTools.DrawEntry(" " * (width - baselineSpace - len(dst) - len(etc) + 5), lineFormat, drawEntry)
     drawEntry = uiTools.DrawEntry(dst + etc, lineFormat, drawEntry)
     drawEntry = uiTools.DrawEntry(bracket, curses.A_NORMAL, drawEntry, lockFormat = True)
+    drawEntry = uiTools.DrawEntry(" ", curses.A_NORMAL, drawEntry, lockFormat = True)
     return drawEntry
 
diff --git a/src/cli/connections/connEntry.py b/src/cli/connections/connEntry.py
index ac45656..05e2a45 100644
--- a/src/cli/connections/connEntry.py
+++ b/src/cli/connections/connEntry.py
@@ -288,7 +288,7 @@ class ConnectionLine(entries.ConnectionPanelLine):
       timePrefix = "+" if self.isInitialConnection else " "
     else: timePrefix = ""
     
-    timeEntry = myListing.getNext()
+    timeEntry = myListing.getNext().getNext()
     timeEntry.text = timePrefix + "%5s" % uiTools.getTimeLabel(currentTime - self.startTime, 1)
     
     return myListing
@@ -304,6 +304,7 @@ class ConnectionLine(entries.ConnectionPanelLine):
     entryType = self.getType()
     
     # Lines are split into the following components in reverse:
+    # init gap - " "
     # content  - "<src>  -->  <dst>     <etc>     "
     # time     - "<uptime>"
     # preType  - " ("
@@ -317,7 +318,8 @@ class ConnectionLine(entries.ConnectionPanelLine):
     drawEntry = uiTools.DrawEntry(entryType.upper(), lineFormat | curses.A_BOLD, drawEntry)
     drawEntry = uiTools.DrawEntry(" (", lineFormat, drawEntry)
     drawEntry = uiTools.DrawEntry(" " * timeWidth, lineFormat, drawEntry)
-    drawEntry = uiTools.DrawEntry(self._getListingContent(width - (12 + timeWidth), listingType), lineFormat, drawEntry)
+    drawEntry = uiTools.DrawEntry(self._getListingContent(width - (12 + timeWidth) - 1, listingType), lineFormat, drawEntry)
+    drawEntry = uiTools.DrawEntry(" ", lineFormat, drawEntry)
     return drawEntry
   
   def _getDetails(self, width):
diff --git a/src/cli/connections/connPanel.py b/src/cli/connections/connPanel.py
index 7fab33e..45750c3 100644
--- a/src/cli/connections/connPanel.py
+++ b/src/cli/connections/connPanel.py
@@ -278,9 +278,9 @@ class ConnectionPanel(panel.Panel, threading.Thread):
       title = "Connection Details:" if self._showDetails else self._title
       self.addstr(0, 0, title, curses.A_STANDOUT)
     
-    scrollOffset = 1
+    scrollOffset = 0
     if isScrollbarVisible:
-      scrollOffset = 3
+      scrollOffset = 2
       self.addScrollBar(scrollLoc, scrollLoc + height - detailPanelOffset - 1, len(self._entryLines), 1 + detailPanelOffset)
     
     if self.isPaused() or not self._isTorRunning:





More information about the tor-commits mailing list