|
442 | 442 | local preview_config = conf.get().preview |
443 | 443 | if preview_config then preview.setup(preview_config) end |
444 | 444 |
|
| 445 | +local function suspend_paste() |
| 446 | + if not vim.o.paste then return false end |
| 447 | + vim.o.paste = false |
| 448 | + return true |
| 449 | +end |
| 450 | + |
| 451 | +local function restore_paste(should_restore) |
| 452 | + if should_restore then vim.o.paste = true end |
| 453 | +end |
| 454 | + |
445 | 455 | M.state = { |
446 | 456 | active = false, |
447 | 457 | layout = nil, |
@@ -491,6 +501,7 @@ M.state = { |
491 | 501 | ns_id = nil, |
492 | 502 |
|
493 | 503 | last_status_info = nil, |
| 504 | + restore_paste = false, |
494 | 505 |
|
495 | 506 | last_preview_file = nil, |
496 | 507 | last_preview_location = nil, -- Track last preview location to detect changes |
@@ -528,6 +539,9 @@ function M.create_ui() |
528 | 539 | local config = M.state.config |
529 | 540 | if not config then return false end |
530 | 541 |
|
| 542 | + -- Prompt editing should behave consistently even if the user has :set paste. |
| 543 | + M.state.restore_paste = suspend_paste() |
| 544 | + |
531 | 545 | if not M.state.ns_id then |
532 | 546 | M.state.ns_id = vim.api.nvim_create_namespace('fff_picker_status') |
533 | 547 | combo_renderer.init(M.state.ns_id) |
@@ -2411,6 +2425,8 @@ function M.close() |
2411 | 2425 | vim.cmd('stopinsert') |
2412 | 2426 | M.state.active = false |
2413 | 2427 |
|
| 2428 | + restore_paste(M.state.restore_paste) |
| 2429 | + |
2414 | 2430 | combo_renderer.cleanup() |
2415 | 2431 | scrollbar.cleanup() |
2416 | 2432 |
|
@@ -2478,6 +2494,7 @@ function M.close() |
2478 | 2494 | M.state.grep_regex_fallback_error = nil |
2479 | 2495 | M.state.suggestion_items = nil |
2480 | 2496 | M.state.suggestion_source = nil |
| 2497 | + M.state.restore_paste = false |
2481 | 2498 | M.state.combo_visible = true |
2482 | 2499 | M.state.combo_initial_cursor = nil |
2483 | 2500 | M.reset_history_state() |
|
0 commit comments