diff --git a/twander.py b/twander.py index b1bdc5a..1845359 100755 --- a/twander.py +++ b/twander.py @@ -6,7 +6,7 @@ # Program Information PROGNAME = "twander" -RCSID = "$Id: twander.py,v 3.226 2009/06/28 05:35:56 tundra Exp $" +RCSID = "$Id: twander.py,v 3.227 2009/06/28 07:13:58 tundra Exp $" VERSION = RCSID.split()[2] # Copyright Information @@ -586,8 +586,8 @@ ST_SZMODE = 12 ST_SZNLINK = 5 -ST_SZUNAME = 18 -ST_SZGNAME = 18 +ST_SZUNAME = 12 +ST_SZGNAME = 12 ST_SZLEN = MAX_SZ_FIELD ST_SZMTIME = 18 @@ -1166,17 +1166,25 @@ def PadString(string, width, Rjust=False, Trailing=0): - s = string[:(width-1)] - if Rjust: - s = s.rjust(width) - else: - s = s.ljust(width) - - # Rotate 'Trailing' number of spaces from left of string to right + # Only attempt this if there is room to do it - while (Trailing > 0) and (s[0] == ' ') : - s = s[1:] + ' ' - Trailing -= 1 + if width >= len(string) + Trailing: + s = string[:(width-1)] + if Rjust: + s = s.rjust(width) + else: + s = s.ljust(width) + + # Rotate 'Trailing' number of spaces from left of string to right + + while (Trailing > 0) and (s[0] == ' ') : + s = s[1:] + ' ' + Trailing -= 1 + + # If not, indicate problem + + else: + s = "X " return s @@ -4652,7 +4660,7 @@ # Convert UID to name, if possible try: - owner = pwd.getpwuid(stinfo[ST_UID])[0][:ST_SZUNAME-1] + owner = pwd.getpwuid(stinfo[ST_UID])[0] # No valid name associated with UID, so use number instead except: @@ -4660,7 +4668,7 @@ # Convert GID to name, if possible try: - group = grp.getgrgid(stinfo[ST_GID])[0][:ST_SZGNAME-1] + group = grp.getgrgid(stinfo[ST_GID])[0] # No valid name associated with GID, so use number instead except: @@ -5445,7 +5453,8 @@ UI.OptionsNumeric = {"AFTERWAIT":AFTERWAIT,"DEBUGLEVEL":DEBUGLEVEL, "FSZ":FSZ, "MFSZ":MFSZ, "HFSZ":HFSZ, "HEIGHT":HEIGHT, "MAXMENU":MAXMENU, "MAXMENUBUF":MAXMENUBUF, "MAXNESTING":MAXNESTING, - "REFRESHINT":REFRESHINT, "SCALEPRECISION":SCALEPRECISION, "STARTX":STARTX, "STARTY":STARTY, "WIDTH":WIDTH} + "REFRESHINT":REFRESHINT, "SCALEPRECISION":SCALEPRECISION, "STARTX":STARTX, "STARTY":STARTY, + "ST_SZUNAME":ST_SZUNAME, "ST_SZGNAME":ST_SZGNAME, "ST_SZLEN":ST_SZLEN, "WIDTH":WIDTH} UI.OptionsString = {"BCOLOR":BCOLOR, "FCOLOR":FCOLOR, "FNAME":FNAME, "FWT":FWT, # Main Font/Colors "MBCOLOR":MBCOLOR, "MFCOLOR":MFCOLOR, "MFNAME":MFNAME, "MFWT":MFWT, # Menu Font/Colors