|
4 | 4 |
|
5 | 5 | import functools
|
6 | 6 | import codecs
|
| 7 | +import locale |
7 | 8 | import os
|
8 | 9 | import pprint
|
9 | 10 | import re
|
@@ -277,7 +278,12 @@ def get_alternate_tags_paths(view, tags_file):
|
277 | 278 | os.path.normpath(
|
278 | 279 | os.path.join(folder, extrafile)))
|
279 | 280 |
|
280 |
| - return set(p for p in search_paths if p and os.path.exists(p)) |
| 281 | + # use list instead of set for keep order |
| 282 | + ret = [] |
| 283 | + for p in search_paths: |
| 284 | + if p and (p not in ret) and os.path.exists(p): |
| 285 | + ret.append(p) |
| 286 | + return ret |
281 | 287 |
|
282 | 288 |
|
283 | 289 | def get_common_ancestor_folder(path, folders):
|
@@ -571,6 +577,10 @@ def show_tag_panel(view, result, jump_directly):
|
571 | 577 | def on_select(i):
|
572 | 578 | if i != -1:
|
573 | 579 | JumpPrev.append(view)
|
| 580 | + # Work around bug in ST3 where the quick panel keeps focus after |
| 581 | + # selecting an entry. |
| 582 | + # See https://github.com/SublimeText/Issues/issues/39 |
| 583 | + view.window().run_command('hide_overlay') |
574 | 584 | scroll_to_tag(view, args[i])
|
575 | 585 |
|
576 | 586 | if jump_directly and len(args) == 1:
|
@@ -829,9 +839,14 @@ def run(self, edit, **args):
|
829 | 839 | opts = setting('opts')
|
830 | 840 | tag_file = setting('tag_file')
|
831 | 841 |
|
832 |
| - if 'dirs' in args: |
| 842 | + if 'dirs' in args and args['dirs']: |
833 | 843 | paths.extend(args['dirs'])
|
834 | 844 | self.build_ctags(paths, command, tag_file, recursive, opts)
|
| 845 | + elif 'files' in args and args['files']: |
| 846 | + paths.extend(args['files']) |
| 847 | + # build ctags and ignore recursive flag - we clearly only want |
| 848 | + # to build them for a file |
| 849 | + self.build_ctags(paths, command, tag_file, False, opts) |
835 | 850 | elif (self.view.file_name() is None and
|
836 | 851 | len(self.view.window().folders()) <= 0):
|
837 | 852 | status_message('Cannot build CTags: No file or folder open.')
|
@@ -881,7 +896,8 @@ def tags_built(tag_file):
|
881 | 896 | str_err = ' '.join(
|
882 | 897 | e.output.decode('windows-1252').splitlines())
|
883 | 898 | else:
|
884 |
| - str_err = e.output.rstrip() |
| 899 | + str_err = e.output.decode(locale.getpreferredencoding()).rstrip() |
| 900 | + |
885 | 901 | error_message(str_err)
|
886 | 902 | return
|
887 | 903 | except Exception as e:
|
|
0 commit comments