handling of unimplemented bindings, added unimplemented bindings

This commit is contained in:
nova
2025-07-06 03:52:25 +02:00
parent 36fd160ccb
commit ab5b466336
4 changed files with 48 additions and 20 deletions

View File

@ -17,33 +17,54 @@ static mimetype mimetype_default_cmd[] = {
};
static binding key_binding[] = {
/*key action */
/*key action comment*/
/*you cannot add bindings that include other bindings in its entirety
* possible: mk, mf
* not possible: gg, ggg
* trying to use ggg will always fail as it will execute gg first instead, resetting the input buffer, thus never
* reaching ggg */
{ "q", quit_program },
{ " ", toggle_selection }, /* on hovered file/directory */
{ "u", update }, /* executes the entire backend and redrawing of the screen */
* trying to use ggg will always fail as it will execute gg first instead, resetting the input buffer, thus never reaching ggg */
{ "q", quit_program, "quit" },
{ " ", toggle_selection, "toggle file selection" }, /* on hovered file/directory */
{ "e", update, "rerun all backend" }, /* executes the entire backend and redrawing of the screen */
{ "/", not_implemented, "search" },
{ "h", move_right }, /* moves one dir up */
{ "t", move_down },
{ "n", move_up },
{ "s", move_left }, /* if a dir is hovered, cd into it, if a file is selected, see mimetype_default_cmd */
{ "h", move_right, "move right" }, /* moves one dir up */
{ "t", move_down, "move down" },
{ "n", move_up, "move up" },
{ "s", move_left, "move left" }, /* if a dir is hovered, cd into it, if a file is selected, see mimetype_default_cmd */
{ "\n", open_with }, /* opens the hovered file with an arbitrary command */
{ "r", rename_hovered }, /* renames currently hovered file/directory */
{ "d", delete }, /* deletes currently hovered OR selected file/directory
* this means that it does not delete the hovered files if files are already selected */
{ "\n", open_with, "open \"open with\" dialog" }, /* opens the hovered file with an arbitrary command */
{ "r", rename_hovered, "rename hovered file" }, /* renames currently hovered file/directory */
{ "d", delete, "delete file" }, /* deletes currently hovered OR selected file/directory
* this means that it does not delete the hovered files if files are already selected */
{ "gg", jump_top },
{ "G", jump_bottom },
{ "G", jump_bottom, "jump to last file in dir" },
{ "gg", jump_top, "jump to file 0" },
{ "gh", not_implemented, "jump to ~/" },
{ "gd", not_implemented, "jump to /dev" },
{ "ge", not_implemented, "jump to /etc" },
{ "gm", not_implemented, "jump to /mnt" },
{ "go", not_implemented, "jump to /opt" },
{ "gt", not_implemented, "jump to /tmp" },
{ "gv", not_implemented, "jump to /var" },
{ "mk", makedir },
{ "mf", makefile },
{ "u7", not_implemented, "unzip 7z" },
{ "ub", not_implemented, "unzip bz2" },
{ "ur", not_implemented, "unzip rar" },
{ "ut", not_implemented, "unzip tar" },
{ "ut", not_implemented, "unzip gzip" },
{ "uz", not_implemented, "unzip zip" },
{ "a", toggle_hidden_files },
{ "on", not_implemented, "order natural" },
{ "or", not_implemented, "order reverse" },
{ "oe", not_implemented, "order extension" },
{ "os", not_implemented, "order size" },
{ "ot", not_implemented, "order type" },
{ "oz", not_implemented, "order random" },
{ "mk", makedir, "create directory" },
{ "mf", makefile, "create file" },
{ "a", toggle_hidden_files, "toggle hidden files" },
};
static unsigned long binding_count = sizeof(key_binding) / sizeof(binding);
static unsigned long mimetype_default_count = sizeof(mimetype_default_cmd) / sizeof(mimetype);

View File

@ -73,6 +73,7 @@ typedef struct Mimetype {
typedef struct Binding {
char* key;
void (*func)();
char* comment;
} binding;

View File

@ -462,6 +462,11 @@ void makefile(){
status |= (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_MASK | STATUS_RELOAD_DIRECTORY | STATUS_UPDATE_SCREEN_RELOAD_FULL);
}
void update() {
void update(){
status |= (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_MASK | STATUS_RELOAD_DIRECTORY | STATUS_UPDATE_SCREEN_RELOAD_FULL);
}
void not_implemented(){
mvaddstr(terminal_height-1, 0, input);
mvaddstr(terminal_height-1, strlen(input), "\t");
mvaddstr(terminal_height-1, strlen(input) + strlen("\t"), "is not yet implemented");
}

View File

@ -22,3 +22,4 @@ void delete();
void makedir();
void makefile();
void update();
void not_implemented();