xaizek / vifm (License: GPLv2+) (since 2018-12-07)
Vifm is a file manager with curses interface, which provides Vi[m]-like environment for managing objects within file systems, extended with some useful ideas from mutt.
Commit b4bca679ffaa2907385ad3636749ec90685557af

Extract try_ressurect_abandoned() in view.c
Either makes use of abandoned view or prunes it.
Author: xaizek
Author date (UTC): 2013-10-29 19:25
Committer name: xaizek
Committer date (UTC): 2013-10-29 19:25
Parent(s): 19b6301e7b1cb27b5c46898ca758790c6731be84
Signing key:
Tree: abe238552f49d9d02834735be25222c3c3aaf864
File Lines added Lines deleted
src/modes/view.c 28 11
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 { {
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/vifm

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/vifm

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master