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 3878e4bcd4816d1fd41ec76a7bded091027cc6c6

Change get_typed_{ current => entry }_fpath()
This can be used with get_current_entry().
Author: xaizek
Author date (UTC): 2016-02-07 20:04
Committer name: xaizek
Committer date (UTC): 2016-02-07 20:04
Parent(s): 46343b8d1c4393e98a4b7d98e1139c41e4d31fcc
Signing key:
Tree: 1e8548acd93224db210dbe18b29d06d5da8551eb
File Lines added Lines deleted
src/cmd_completion.c 1 1
src/filelist.c 1 3
src/filelist.h 3 3
src/menus/filetypes_menu.c 1 1
src/running.c 2 2
File src/cmd_completion.c changed (mode: 100644) (index fb6af8ed2..e897a8150)
... ... complete_chown(const char *str)
434 434 static void static void
435 435 complete_filetype(const char *str) complete_filetype(const char *str)
436 436 { {
437 char *const typed_fname = get_typed_current_fpath(curr_view);
437 char *const typed_fname = get_typed_entry_fpath(get_current_entry(curr_view));
438 438 assoc_records_t ft = ft_get_all_programs(typed_fname); assoc_records_t ft = ft_get_all_programs(typed_fname);
439 439
440 440 complete_progs(str, ft); complete_progs(str, ft);
File src/filelist.c changed (mode: 100644) (index c0fa55f44..ca8958f38)
... ... win_to_unix_time(FILETIME ft)
1416 1416 #endif #endif
1417 1417
1418 1418 char * char *
1419 get_typed_current_fpath(const FileView *view)
1419 get_typed_entry_fpath(const dir_entry_t *entry)
1420 1420 { {
1421 dir_entry_t *entry;
1422 1421 const char *type_suffix; const char *type_suffix;
1423 1422 char full_path[PATH_MAX]; char full_path[PATH_MAX];
1424 1423
1425 entry = get_current_entry((FileView *)view);
1426 1424 type_suffix = is_directory_entry(entry) ? "/" : ""; type_suffix = is_directory_entry(entry) ? "/" : "";
1427 1425
1428 1426 get_full_path_of(entry, sizeof(full_path), full_path); get_full_path_of(entry, sizeof(full_path), full_path);
File src/filelist.h changed (mode: 100644) (index f8487aa72..acc7c2b1a)
... ... void clean_positions_in_history(FileView *view);
180 180
181 181 /* Typed (with trailing slash for directories) file name functions. */ /* Typed (with trailing slash for directories) file name functions. */
182 182
183 /* Gets typed filename (not path, just name) for current entry of the view.
184 * Allocates memory, that should be freed by the caller. */
185 char * get_typed_current_fpath(const FileView *view);
183 /* Gets typed path for the entry. On return allocates memory, that should be
184 * freed by the caller. */
185 char * get_typed_entry_fpath(const dir_entry_t *entry);
186 186 /* Gets typed filename (not path, just name) for the entry. Allocates memory, /* Gets typed filename (not path, just name) for the entry. Allocates memory,
187 187 * that should be freed by the caller. */ * that should be freed by the caller. */
188 188 char * get_typed_entry_fname(const dir_entry_t *entry); char * get_typed_entry_fname(const dir_entry_t *entry);
File src/menus/filetypes_menu.c changed (mode: 100644) (index bd9c2a4a0..0f2dc16e5)
... ... show_file_menu(FileView *view, int background)
56 56 int i; int i;
57 57 int max_len; int max_len;
58 58
59 char *const typed_name = get_typed_current_fpath(view);
59 char *const typed_name = get_typed_entry_fpath(get_current_entry(view));
60 60 assoc_records_t ft = ft_get_all_programs(typed_name); assoc_records_t ft = ft_get_all_programs(typed_name);
61 61 assoc_records_t magic = get_magic_handlers(typed_name); assoc_records_t magic = get_magic_handlers(typed_name);
62 62 free(typed_name); free(typed_name);
File src/running.c changed (mode: 100644) (index df5322cd6..667ce16c2)
... ... run_file(FileView *view, int dont_execute)
407 407 clean_selected_files(view); clean_selected_files(view);
408 408 } }
409 409
410 typed_fname = get_typed_current_fpath(view);
410 typed_fname = get_typed_entry_fpath(get_current_entry(view));
411 411 multi_prog_cmd = ft_get_program(typed_fname); multi_prog_cmd = ft_get_program(typed_fname);
412 412 free(typed_fname); free(typed_fname);
413 413
 
... ... set_pwd_in_screen(const char path[])
1120 1120 int int
1121 1121 run_with_filetype(FileView *view, const char beginning[], int background) run_with_filetype(FileView *view, const char beginning[], int background)
1122 1122 { {
1123 char *const typed_fname = get_typed_current_fpath(view);
1123 char *const typed_fname = get_typed_entry_fpath(get_current_entry(view));
1124 1124 assoc_records_t ft = ft_get_all_programs(typed_fname); assoc_records_t ft = ft_get_all_programs(typed_fname);
1125 1125 assoc_records_t magic = get_magic_handlers(typed_fname); assoc_records_t magic = get_magic_handlers(typed_fname);
1126 1126 free(typed_fname); free(typed_fname);
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