Skip to content

Commit c4299e9

Browse files
committed
Just ignore, I trusted to AI too much
1 parent e02cc46 commit c4299e9

5 files changed

Lines changed: 1 addition & 24 deletions

File tree

lua/spectre/init.lua

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ M.open = function(opts)
8888
state.view = {
8989
mode = 'both',
9090
show_search = true,
91-
show_replace = true,
9291
}
9392
state.regex = nil
9493

@@ -347,15 +346,12 @@ M.change_view = function()
347346
if state.view.mode == 'both' then
348347
state.view.mode = 'replace'
349348
state.view.show_search = false
350-
state.view.show_replace = true
351349
elseif state.view.mode == 'replace' then
352350
state.view.mode = 'search'
353351
state.view.show_search = true
354-
state.view.show_replace = false
355352
else
356353
state.view.mode = 'both'
357354
state.view.show_search = true
358-
state.view.show_replace = true
359355
end
360356

361357
-- Trigger UI update if available

lua/spectre/state.lua

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ M.async_id = nil
9494
M.view = {
9595
mode = 'both',
9696
show_search = true,
97-
show_replace = true,
9897
}
9998
M.regex = nil
10099
M.renderer = nil

lua/spectre/ui/buffer/init.lua

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ M.render_line = function(bufnr, namespace, text_opts, view_opts, regex)
5858
replace_query = text_opts.replace_query,
5959
search_text = text_opts.search_text,
6060
show_search = view_opts.show_search,
61-
show_replace = view_opts.show_replace,
6261
}, regex)
6362
local end_lnum = text_opts.is_replace == true and text_opts.lnum + 1 or text_opts.lnum
6463

@@ -626,7 +625,6 @@ M.render_results = function()
626625
padding_text = cfg.result_padding,
627626
padding = padding,
628627
show_search = state.view.show_search,
629-
show_replace = state.view.show_replace,
630628
}, state_utils.get_regex())
631629

632630
c_line = c_line + 1

lua/spectre/ui/float/init.lua

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,6 @@ local function create_search_ui()
228228
replace_query = state.query.replace_query,
229229
search_text = truncated_text:sub(match[1] + 1, match[2]),
230230
show_search = true,
231-
show_replace = true,
232231
}, regex).replace
233232
end)
234233

lua/spectre/utils.lua

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ M.get_hl_line_text = function(opts, regex)
168168
result.text = opts.search_text
169169
if search_match then
170170
result.search = match_text_line(search_match, opts.search_text, 0)
171-
if opts.replace_query and #opts.replace_query > 0 and opts.show_replace ~= false then
171+
if opts.replace_query and #opts.replace_query > 0 then
172172
local replace_match = regex.replace_all(opts.search_query, opts.replace_query, search_match)
173173
local total_increase = 0
174174

@@ -197,21 +197,6 @@ M.get_hl_line_text = function(opts, regex)
197197

198198
result.text = new_text
199199
end
200-
else
201-
-- Before replacement or preview: Show original text with replacement preview
202-
for _, v in pairs(result.search) do
203-
v[1] = v[1] + total_increase
204-
v[2] = v[2] + total_increase
205-
206-
-- Add replacement text in parentheses after the search match with an arrow
207-
local display_replace = ' → (' .. replace_match .. ')'
208-
local pos = { v[2], v[2] + #display_replace }
209-
table.insert(result.replace, pos)
210-
211-
local text = result.text
212-
result.text = text:sub(0, v[2]) .. display_replace .. text:sub(v[2] + 1)
213-
total_increase = total_increase + #display_replace
214-
end
215200
end
216201
end
217202
end

0 commit comments

Comments
 (0)