diff options
author | 2009-02-12 10:17:10 -0500 | |
---|---|---|
committer | 2009-02-12 10:17:10 -0500 | |
commit | 190e072a87b2aab0660a6233a1268a63197d40a5 (patch) | |
tree | c0770279f5cc87f8af71b5da4cd525884dbd8a6b | |
parent | b434e87b267404cfa01b0c6fd9c6c4cd6d22c266 (diff) | |
download | textadept-190e072a87b2aab0660a6233a1268a63197d40a5.tar.gz textadept-190e072a87b2aab0660a6233a1268a63197d40a5.zip |
Fixed some corner cases for Find in Files user interface; core/ext/find.lua
-rw-r--r-- | core/ext/find.lua | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/core/ext/find.lua b/core/ext/find.lua index 611a73ab..c17d37b4 100644 --- a/core/ext/find.lua +++ b/core/ext/find.lua @@ -123,7 +123,9 @@ function find.find(text, next, flags, nowrap, wrapped) search_dir(dir) if #matches == 1 then matches[2] = locale.FIND_NO_RESULTS end matches[#matches + 1] = '' - previous_view = view + if buffer._type ~= locale.FIND_FILES_FOUND_BUFFER then + previous_view = view + end textadept._print(locale.FIND_FILES_FOUND_BUFFER, table.concat(matches, '\n')) end @@ -259,7 +261,23 @@ function goto_file(pos, line_num) line = buffer:get_line(line_num) local file, line_num = line:match('^(.+):(%d+):.+$') if file and line_num then - if previous_view then previous_view:focus() end + if #textadept.views == 1 then + _, previous_view = view:split(false) -- horizontal + else + local clicked_view = view + if previous_view then previous_view:focus() end + if buffer._type == locale.FIND_FILES_FOUND_BUFFER then + -- there are at least two find in files views; find one of those views + -- that the file was not selected from and focus it + for _, v in ipairs(textadept.views) do + if v ~= clicked_view then + previous_view = v + v:focus() + break + end + end + end + end textadept.io.open(file) buffer:ensure_visible_enforce_policy(line_num - 1) buffer:goto_line(line_num - 1) |