@@ -58,11 +58,13 @@ async def _operation(
58
58
s : d for s , d in pre_operations .items () if await exists (d , follow = False )
59
59
}
60
60
61
+ asked = False
61
62
new_operations : MutableMapping [PurePath , PurePath ] = {}
62
63
while pre_existing :
63
64
source , dest = pre_existing .popitem ()
64
65
resp = await Nvim .input (question = LANG ("path_exists_err" ), default = dest .name )
65
66
new_dest = dest .parent / resp if resp else None
67
+ asked = True
66
68
67
69
if not new_dest :
68
70
pre_existing [source ] = dest
@@ -92,49 +94,50 @@ async def _operation(
92
94
for s , d in sorted (operations .items (), key = lambda t : pathsort_key (t [0 ]))
93
95
)
94
96
95
- question = LANG ("confirm op" , operation = op_name , paths = msg )
96
- ans = await Nvim .confirm (
97
- question = question ,
98
- answers = LANG ("ask_yesno" ),
99
- answer_key = {1 : True , 2 : False },
100
- )
97
+ if not asked :
98
+ question = LANG ("confirm op" , operation = op_name , paths = msg )
99
+ ans = await Nvim .confirm (
100
+ question = question ,
101
+ answers = LANG ("ask_yesno" ),
102
+ answer_key = {1 : True , 2 : False },
103
+ )
104
+
105
+ if not ans :
106
+ return None
101
107
102
- if not ans :
103
- return None
108
+ try :
109
+ await action (operations )
110
+ except Exception as e :
111
+ await Nvim .write (e , error = True )
112
+ return await refresh (state )
104
113
else :
105
- try :
106
- await action (operations )
107
- except Exception as e :
108
- await Nvim .write (e , error = True )
109
- return await refresh (state )
110
- else :
111
- parents = {
112
- p .parent for p in chain (operations .keys (), operations .values ())
113
- }
114
- invalidate_dirs = parents
115
- index = state .index | parents
116
- new_selection = {* operations .values ()}
117
- new_state = await forward (
118
- state ,
119
- index = index ,
120
- selection = new_selection if is_move else selection ,
121
- invalidate_dirs = invalidate_dirs ,
122
- )
123
- focus = next (
124
- iter (sorted (new_selection , key = pathsort_key )),
125
- None ,
126
- )
114
+ parents = {
115
+ p .parent for p in chain (operations .keys (), operations .values ())
116
+ }
117
+ invalidate_dirs = parents
118
+ index = state .index | parents
119
+ new_selection = {* operations .values ()}
120
+ new_state = await forward (
121
+ state ,
122
+ index = index ,
123
+ selection = new_selection if is_move else selection ,
124
+ invalidate_dirs = invalidate_dirs ,
125
+ )
126
+ focus = next (
127
+ iter (sorted (new_selection , key = pathsort_key )),
128
+ None ,
129
+ )
127
130
128
- if is_move :
129
- await kill_buffers (
130
- last_used = new_state .window_order ,
131
- paths = selection ,
132
- reopen = {},
133
- )
134
- await lsp_moved (operations )
135
- else :
136
- await lsp_created (new_selection )
137
- return Stage (new_state , focus = focus )
131
+ if is_move :
132
+ await kill_buffers (
133
+ last_used = new_state .window_order ,
134
+ paths = selection ,
135
+ reopen = {},
136
+ )
137
+ await lsp_moved (operations )
138
+ else :
139
+ await lsp_created (new_selection )
140
+ return Stage (new_state , focus = focus )
138
141
139
142
140
143
@rpc (blocking = False )
0 commit comments