| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1277,15 +1277,22 @@ def show_list(self, items, topline=None, current_item=None): | |||
| 1277 | 1277 | max_h = y + 1 | |
| 1278 | 1278 | max_w = int(w * self.config.cli_suggestion_width) | |
| 1279 | 1279 | self.list_win.erase() | |
| 1280 | + | ||
| 1280 | 1281 | if items: | |
| 1281 | 1282 | sep = '.' | |
| 1282 | - if os.path.sep in items[0]: | ||
| 1283 | - # Filename completion | ||
| 1284 | - sep = os.path.sep | ||
| 1285 | - if sep in items[0]: | ||
| 1286 | - items = [x.rstrip(sep).rsplit(sep)[-1] for x in items] | ||
| 1283 | + separators = ['.', os.path.sep, '['] | ||
| 1284 | + lastindex = max([items[0].rfind(c) for c in separators]) | ||
| 1285 | + if lastindex > -1: | ||
| 1286 | + sep = items[0][lastindex] | ||
| 1287 | + items = [x.rstrip(sep).rsplit(sep)[-1] for x in items] | ||
| 1288 | + if current_item: | ||
| 1289 | + current_item = current_item.rstrip(sep).rsplit(sep)[-1] | ||
| 1290 | + | ||
| 1291 | + if items[0].endswith(']'): | ||
| 1292 | + # dictionary key suggestions | ||
| 1293 | + items = [x.rstrip(']') for x in items] | ||
| 1287 | 1294 | if current_item: | |
| 1288 | - current_item = current_item.rstrip(sep).rsplit(sep)[-1] | ||
| 1295 | + current_item = current_item.rstrip(']') | ||
| 1289 | 1296 | ||
| 1290 | 1297 | if topline: | |
| 1291 | 1298 | height_offset = self.mkargspec(topline, down) + 1 | |
| Back | FazBrowse Home | New Git URL |
0 commit comments