@@ -5,6 +5,7 @@ local ui = {}
5
5
6
6
local MatchListing = require (' wincent.commandt.private.match_listing' ).MatchListing
7
7
local Prompt = require (' wincent.commandt.private.prompt' ).Prompt
8
+ local Settings = require (' wincent.commandt.private.settings' )
8
9
9
10
local candidate_count = nil
10
11
local cmdline_enter_autocmd = nil
@@ -14,6 +15,7 @@ local match_listing = nil
14
15
local prompt = nil
15
16
local results = nil
16
17
local selected = nil
18
+ local settings = Settings .new ()
17
19
18
20
-- Reverses `list` in place.
19
21
local reverse = function (list )
35
37
-- do anything that would move you out)
36
38
37
39
local close = function ()
40
+ -- Restore global settings.
41
+ settings .hlsearch = nil
42
+
38
43
if match_listing then
39
44
match_listing :close ()
40
45
match_listing = nil
@@ -69,16 +74,17 @@ ui.open = function(kind)
69
74
end
70
75
end
71
76
72
- -- TODO save/restore global options, like `hlsearch' (which we want to turn off
73
- -- temporarily when our windows are visible) — either that, or figure out how to
74
- -- make the highlighting not utterly suck.
75
- -- in any case, review the list at ruby/command-t/lib/command-t/match_window.rb
76
77
ui .show = function (finder , options )
77
78
-- TODO validate options
78
79
current_finder = finder
79
80
80
81
current_window = vim .api .nvim_get_current_win ()
81
82
83
+ -- Temporarily override global settings.
84
+ -- For now just 'hlsearch', but may add more later (see
85
+ -- ruby/command-t/lib/command-t/match_window.rb)
86
+ settings .hlsearch = false
87
+
82
88
-- Work around an autocommand bug. We don't reliably get `WinClosed` events,
83
89
-- or if we do, our call to `nvim_del_autocmd()` doesn't always clean up for
84
90
-- us. So, we add some window-related autocommands to a group which we always
0 commit comments