[Git][NTPsec/ntpsec][master] Fix some glitches in string parsing and wide formatting.

Eric S. Raymond gitlab at mg.gitlab.com
Sun Nov 27 17:36:39 UTC 2016


Eric S. Raymond pushed to branch master at NTPsec / ntpsec


Commits:
2a991041 by Eric S. Raymond at 2016-11-27T12:36:04-05:00
Fix some glitches in string parsing and wide formatting.

- - - - -


2 changed files:

- pylib/packet.py
- pylib/util.py


Changes:

=====================================
pylib/packet.py
=====================================
--- a/pylib/packet.py
+++ b/pylib/packet.py
@@ -1110,7 +1110,7 @@ class ControlSession:
             if c == '"':
                 response = response + c
                 instring = not instring
-            if instring and c == ',':
+            elif instring and c == ',':
                 response = response + "\xae"
             elif polyord(c) > 0 and polyord(c) < 127:
                 response = response + c


=====================================
pylib/util.py
=====================================
--- a/pylib/util.py
+++ b/pylib/util.py
@@ -87,14 +87,14 @@ class PeerSummary:
         # By default, the peer spreadsheet layout is designed so lines just
         # fit in 80 characters. This tells us how much extra horizontal space
         # we have available on a wider terminal emulator.
-        self.horizontal_slack = (termwidth or 80) - 80
+        self.horizontal_slack = min((termwidth or 80) - 80, 24)
         # Peer spreadsheet column widths. The reason we cap extra
         # width used at 24 is that on very wide displays, slamming the
         # non-hostname fields all the way to the right produces a huge
         # river that makes the entries difficult to read as wholes.
         # This choice caps the peername field width at that of the longest
         # possible IPV6 numeric address.
-        self.namewidth = 15 + min(self.horizontal_slack, 24)
+        self.namewidth = 15 + self.horizontal_slack
         self.refidwidth = 15
         # Compute peer spreadsheet headers 
         self.__remote = "     remote    ".ljust(self.namewidth)



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/2a991041ad4b0da7175c5fc78aa48cc239714351
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20161127/39f15f55/attachment.html>


More information about the vc mailing list