File src/modes/view.c changed (mode: 100644) (index d9e9a893d..81cdace3a) |
... |
... |
enum |
84 |
84 |
VI_COUNT, /* Number of view information structures. */ |
VI_COUNT, /* Number of view information structures. */ |
85 |
85 |
}; |
}; |
86 |
86 |
|
|
|
87 |
|
static int try_ressurect_abandoned(const char full_path[], int explore); |
87 |
88 |
static void reset_view_info(view_info_t *vi); |
static void reset_view_info(view_info_t *vi); |
88 |
89 |
static void init_view_info(view_info_t *vi); |
static void init_view_info(view_info_t *vi); |
89 |
90 |
static void free_view_info(view_info_t *vi); |
static void free_view_info(view_info_t *vi); |
|
... |
... |
enter_view_mode(int explore) |
283 |
284 |
} |
} |
284 |
285 |
|
|
285 |
286 |
/* Either make use of abandoned view or prune it. */ |
/* Either make use of abandoned view or prune it. */ |
286 |
|
if(vi->filename != NULL && stroscmp(vi->filename, full_path) == 0) |
|
|
287 |
|
if(try_ressurect_abandoned(full_path, explore) == 0) |
287 |
288 |
{ |
{ |
288 |
|
if(explore) |
|
289 |
|
{ |
|
290 |
|
vi->view->explore_mode = 0; |
|
291 |
|
reset_view_info(vi); |
|
292 |
|
} |
|
293 |
|
else |
|
294 |
|
{ |
|
295 |
|
*mode = VIEW_MODE; |
|
296 |
|
return; |
|
297 |
|
} |
|
|
289 |
|
return; |
298 |
290 |
} |
} |
299 |
291 |
|
|
300 |
292 |
pick_vi(explore); |
pick_vi(explore); |
|
... |
... |
enter_view_mode(int explore) |
323 |
315 |
view_redraw(); |
view_redraw(); |
324 |
316 |
} |
} |
325 |
317 |
|
|
|
318 |
|
/* Either makes use of abandoned view or prunes it. Returns zero on success, |
|
319 |
|
* otherwise non-zero is returned. */ |
|
320 |
|
static int |
|
321 |
|
try_ressurect_abandoned(const char full_path[], int explore) |
|
322 |
|
{ |
|
323 |
|
const int same_file = vi->filename != NULL |
|
324 |
|
&& stroscmp(vi->filename, full_path) == 0; |
|
325 |
|
if(!same_file) |
|
326 |
|
{ |
|
327 |
|
return 1; |
|
328 |
|
} |
|
329 |
|
|
|
330 |
|
if(explore) |
|
331 |
|
{ |
|
332 |
|
vi->view->explore_mode = 0; |
|
333 |
|
reset_view_info(vi); |
|
334 |
|
return 1; |
|
335 |
|
} |
|
336 |
|
else |
|
337 |
|
{ |
|
338 |
|
*mode = VIEW_MODE; |
|
339 |
|
return 0; |
|
340 |
|
} |
|
341 |
|
} |
|
342 |
|
|
326 |
343 |
void |
void |
327 |
344 |
try_activate_view_mode(void) |
try_activate_view_mode(void) |
328 |
345 |
{ |
{ |