X Tutup
Skip to content

Commit 615ed80

Browse files
fix attribute access completion
os.path.a| now shows abspath altset instead of os.path.abspath os.path.altsep --HG-- branch : scroll-frontend
1 parent d0d3cfb commit 615ed80

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

bpython/curtsiesfrontend/replpainter.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# -*- coding: utf-8 -*-
22
import logging
3+
import os
34

45
from curtsies.fmtfuncs import bold
56
from curtsies.fsarray import fsarray
@@ -41,16 +42,27 @@ def paint_current_line(rows, columns, current_display_line):
4142
def matches_lines(rows, columns, matches, current, config):
4243
highlight_color = func_for_letter(config.color_scheme['operator'].lower())
4344
#TODO ...that's not really what operator is for
45+
4446
if not matches:
4547
return []
4648
color = func_for_letter(config.color_scheme['main'])
4749
max_match_width = max(len(m) for m in matches)
4850
words_wide = max(1, (columns - 1) // (max_match_width + 1))
51+
if os.path.sep in matches[0]: # filename completion
52+
pass
53+
elif '.' in matches[0]:
54+
matches = [m.rstrip('.').rsplit('.')[-1] for m in matches]
55+
if current:
56+
current = current.rstrip('.').rsplit('.')[-1]
57+
else:
58+
pass
59+
4960
matches_lines = [fmtstr(' ').join(color(m.ljust(max_match_width))
5061
if m != current
5162
else highlight_color(m.ljust(max_match_width))
5263
for m in matches[i:i+words_wide])
5364
for i in range(0, len(matches), words_wide)]
65+
5466
logging.debug('match: %r' % current)
5567
logging.debug('matches_lines: %r' % matches_lines)
5668
return matches_lines

0 commit comments

Comments
 (0)
X Tutup