Skip to content

Commit 36cc78c

Browse files
committed
Make size of suggestion window configurable.
Patch by Sebastian Ramacher. Closes issue bpython#167.
1 parent 4f2cb14 commit 36cc78c

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

bpython/cli.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,9 @@ def __init__(self, scr, interp, statusbar, config, idle=None):
270270
self.formatter = BPythonFormatter(config.color_scheme)
271271
self.interact = CLIInteraction(self.config, statusbar=self.statusbar)
272272

273+
if config.cli_suggestion_width <= 0 or config.cli_suggestion_width > 1:
274+
config.cli_suggestion_width = 0.8
275+
273276
def addstr(self, s):
274277
"""Add a string to the current input line and figure out
275278
where it should go, depending on the cursor position."""
@@ -1145,7 +1148,7 @@ def show_list(self, items, topline=None, current_item=None):
11451148
max_h = h - y
11461149
else:
11471150
max_h = y + 1
1148-
max_w = int(w * 0.8)
1151+
max_w = int(w * self.config.cli_suggestion_width)
11491152
self.list_win.erase()
11501153
if items:
11511154
sep = '.'

bpython/config.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ def loadini(struct, configfile):
7474
'undo': 'C-r',
7575
'up_one_line': 'C-p',
7676
'yank_from_buffer': 'C-y'},
77+
'cli': {
78+
'suggestion_width': 0.8,
79+
},
7780
'gtk': {
7881
'font': 'monospace 10',
7982
'color_scheme': 'default'}})
@@ -118,6 +121,9 @@ def loadini(struct, configfile):
118121
struct.pastebin_url = config.get('general', 'pastebin_url')
119122
struct.pastebin_show_url = config.get('general', 'pastebin_show_url')
120123

124+
struct.cli_suggestion_width = config.getfloat('cli',
125+
'suggestion_width')
126+
121127
struct.gtk_font = config.get('gtk', 'font')
122128

123129
color_scheme_name = config.get('general', 'color_scheme')

0 commit comments

Comments
 (0)