@@ -100,21 +100,30 @@ local function do_single_paste(source, dest, action_type, action_fn)
100
100
end
101
101
102
102
if dest_stats then
103
- local prompt_select = " Overwrite " .. dest .. " ?"
104
- local prompt_input = prompt_select .. " y/n/r(ename): "
105
- lib .prompt (prompt_input , prompt_select , { " y" , " n" , " r" }, { " Yes" , " No" , " Rename" }, function (item_short )
106
- utils .clear_prompt ()
107
- if item_short == " y" then
108
- on_process ()
109
- elseif item_short == " r" then
110
- vim .ui .input ({ prompt = " Rename to " , default = dest , completion = " dir" }, function (new_dest )
111
- utils .clear_prompt ()
112
- if new_dest then
113
- do_single_paste (source , new_dest , action_type , action_fn )
114
- end
115
- end )
116
- end
117
- end )
103
+ if source == dest then
104
+ vim .ui .input ({ prompt = " Rename to " , default = dest , completion = " dir" }, function (new_dest )
105
+ utils .clear_prompt ()
106
+ if new_dest then
107
+ do_single_paste (source , new_dest , action_type , action_fn )
108
+ end
109
+ end )
110
+ else
111
+ local prompt_select = " Overwrite " .. dest .. " ?"
112
+ local prompt_input = prompt_select .. " y/n/r(ename): "
113
+ lib .prompt (prompt_input , prompt_select , { " y" , " n" , " r" }, { " Yes" , " No" , " Rename" }, function (item_short )
114
+ utils .clear_prompt ()
115
+ if item_short == " y" then
116
+ on_process ()
117
+ elseif item_short == " r" then
118
+ vim .ui .input ({ prompt = " Rename to " , default = dest , completion = " dir" }, function (new_dest )
119
+ utils .clear_prompt ()
120
+ if new_dest then
121
+ do_single_paste (source , new_dest , action_type , action_fn )
122
+ end
123
+ end )
124
+ end
125
+ end )
126
+ end
118
127
else
119
128
on_process ()
120
129
end
0 commit comments