[pyrepl-checkins] pyrepl/pyrepl completing_reader.py,1.5,1.6
mwh@codespeak.net
mwh@codespeak.net
Sun, 14 Mar 2004 15:05:46 +0100 (MET)
Update of /cvs/pyrepl/pyrepl/pyrepl
In directory thoth.codespeak.net:/tmp/cvs-serv32280
Modified Files:
completing_reader.py
Log Message:
Bugfix for when completed term exceeds the width of the terminal.
* mwh points at Cocoa
Index: completing_reader.py
===================================================================
RCS file: /cvs/pyrepl/pyrepl/pyrepl/completing_reader.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** completing_reader.py 16 May 2003 13:45:09 -0000 1.5
--- completing_reader.py 14 Mar 2004 14:05:43 -0000 1.6
***************
*** 47,51 ****
def build_menu(cons, wordlist, start):
! maxlen = max(map(len, wordlist))
cols = cons.width / (maxlen + 4)
rows = (len(wordlist) - 1)/cols + 1
--- 47,51 ----
def build_menu(cons, wordlist, start):
! maxlen = min(max(map(len, wordlist)), cons.width - 4)
cols = cons.width / (maxlen + 4)
rows = (len(wordlist) - 1)/cols + 1
***************
*** 55,59 ****
row = []
for col in range(cols):
! row.append("[ %-*s ]"%(maxlen, wordlist[i]))
i += 1
if i >= len(wordlist):
--- 55,59 ----
row = []
for col in range(cols):
! row.append("[ %-*s ]"%(maxlen, wordlist[i][:maxlen]))
i += 1
if i >= len(wordlist):