mirror of
https://gittea.dev/nova/th.git
synced 2025-10-21 10:20:15 -04:00
implemented jmp_file_index & int passes -> unsigned long
This commit is contained in:
1
config.h
1
config.h
@@ -48,6 +48,7 @@ static const binding key_binding[] = {
|
|||||||
{ "e", update, NULL, "rerun all backend" }, /* executes the entire backend and redrawing of the screen */
|
{ "e", update, NULL, "rerun all backend" }, /* executes the entire backend and redrawing of the screen */
|
||||||
{ "B", enter_shell, "$SHELL", "enter $SHELL shell" },
|
{ "B", enter_shell, "$SHELL", "enter $SHELL shell" },
|
||||||
{ "/", search, NULL, "search" },
|
{ "/", search, NULL, "search" },
|
||||||
|
{ ":", jmp_file_index, NULL, "jump to file on input number" },
|
||||||
{ "l", search_next, NULL, "search next" },
|
{ "l", search_next, NULL, "search next" },
|
||||||
{ "L", search_previous, NULL, "search previous" },
|
{ "L", search_previous, NULL, "search previous" },
|
||||||
|
|
||||||
|
@@ -42,7 +42,7 @@ extern time_t *seed;
|
|||||||
char search_buffer[255];
|
char search_buffer[255];
|
||||||
unsigned int timeout_time = 0;
|
unsigned int timeout_time = 0;
|
||||||
unsigned int input_pass;
|
unsigned int input_pass;
|
||||||
int parsed_input_number;
|
unsigned long parsed_input_number;
|
||||||
yank yank_files = { 0 };
|
yank yank_files = { 0 };
|
||||||
|
|
||||||
int read_string(WINDOW *win, int y, int x, char *str);
|
int read_string(WINDOW *win, int y, int x, char *str);
|
||||||
@@ -168,7 +168,7 @@ int read_string(WINDOW *win, int y, int x, char *str){
|
|||||||
}
|
}
|
||||||
str[pass] = '\0';
|
str[pass] = '\0';
|
||||||
|
|
||||||
timeout(10);
|
timeout(100);
|
||||||
curs_set(0);
|
curs_set(0);
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
@@ -186,7 +186,7 @@ void select_all(){
|
|||||||
pthread_mutex_unlock(&mutex_mid);
|
pthread_mutex_unlock(&mutex_mid);
|
||||||
pthread_mutex_unlock(&mutex_selection);
|
pthread_mutex_unlock(&mutex_selection);
|
||||||
}
|
}
|
||||||
void move_down(int passes){
|
void move_down(unsigned long passes){
|
||||||
pthread_mutex_lock(&mutex_selection);
|
pthread_mutex_lock(&mutex_selection);
|
||||||
if (passes == 0) {
|
if (passes == 0) {
|
||||||
passes++;
|
passes++;
|
||||||
@@ -199,7 +199,7 @@ void move_down(int passes){
|
|||||||
status |= (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_0);
|
status |= (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_0);
|
||||||
pthread_mutex_unlock(&mutex_selection);
|
pthread_mutex_unlock(&mutex_selection);
|
||||||
}
|
}
|
||||||
void move_up(int passes){
|
void move_up(unsigned long passes){
|
||||||
pthread_mutex_lock(&mutex_selection);
|
pthread_mutex_lock(&mutex_selection);
|
||||||
if (passes == 0) {
|
if (passes == 0) {
|
||||||
passes++;
|
passes++;
|
||||||
@@ -216,11 +216,11 @@ void move_up(int passes){
|
|||||||
status |= (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_MASK);
|
status |= (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_MASK);
|
||||||
pthread_mutex_unlock(&mutex_selection);
|
pthread_mutex_unlock(&mutex_selection);
|
||||||
}
|
}
|
||||||
void move_left(int passes){
|
void move_left(unsigned long passes){
|
||||||
if (passes == 0) {
|
if (passes == 0) {
|
||||||
passes++;
|
passes++;
|
||||||
}
|
}
|
||||||
int i;
|
unsigned long i;
|
||||||
for (i = 0; i < passes; i++) {
|
for (i = 0; i < passes; i++) {
|
||||||
if (chdir("..") != 0) {
|
if (chdir("..") != 0) {
|
||||||
/* TODO(2025-07-09T00:30:05) fix */
|
/* TODO(2025-07-09T00:30:05) fix */
|
||||||
@@ -549,7 +549,7 @@ void makefile(){
|
|||||||
void update(){
|
void update(){
|
||||||
status |= (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_MASK | STATUS_RELOAD_DIRECTORY | STATUS_UPDATE_SCREEN_RELOAD_FULL);
|
status |= (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_MASK | STATUS_RELOAD_DIRECTORY | STATUS_UPDATE_SCREEN_RELOAD_FULL);
|
||||||
}
|
}
|
||||||
void enter_shell(int passes, int index){
|
void enter_shell(unsigned long passes, int index){
|
||||||
(void)passes;
|
(void)passes;
|
||||||
|
|
||||||
#if SETTINGS_UEBERZUG_IMAGE_PREVIEW != 0
|
#if SETTINGS_UEBERZUG_IMAGE_PREVIEW != 0
|
||||||
@@ -562,14 +562,14 @@ void enter_shell(int passes, int index){
|
|||||||
initscr();
|
initscr();
|
||||||
status |= (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_MASK | STATUS_RELOAD_DIRECTORY | STATUS_UPDATE_SCREEN_RELOAD_FULL);
|
status |= (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_MASK | STATUS_RELOAD_DIRECTORY | STATUS_UPDATE_SCREEN_RELOAD_FULL);
|
||||||
}
|
}
|
||||||
void not_implemented(int passes, int index){
|
void not_implemented(unsigned long passes, int index){
|
||||||
(void)passes;
|
(void)passes;
|
||||||
|
|
||||||
mvaddstr(terminal_height-1, 0, key_binding[index].comment);
|
mvaddstr(terminal_height-1, 0, key_binding[index].comment);
|
||||||
mvaddstr(terminal_height-1, strlen(key_binding[index].comment), "\t");
|
mvaddstr(terminal_height-1, strlen(key_binding[index].comment), "\t");
|
||||||
mvaddstr(terminal_height-1, strlen(key_binding[index].comment) + strlen("\t"), "is not yet implemented");
|
mvaddstr(terminal_height-1, strlen(key_binding[index].comment) + strlen("\t"), "is not yet implemented");
|
||||||
}
|
}
|
||||||
void jump_to_dir(int passes, int index){
|
void jump_to_dir(unsigned long passes, int index){
|
||||||
(void)passes;
|
(void)passes;
|
||||||
|
|
||||||
char *ch = (char*)key_binding[index].black_magic;
|
char *ch = (char*)key_binding[index].black_magic;
|
||||||
@@ -626,7 +626,7 @@ void jump_to_dir(int passes, int index){
|
|||||||
}
|
}
|
||||||
status |= (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_MASK | STATUS_RELOAD_DIRECTORY);
|
status |= (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_MASK | STATUS_RELOAD_DIRECTORY);
|
||||||
}
|
}
|
||||||
void order_by(int passes, int index){
|
void order_by(unsigned long passes, int index){
|
||||||
(void)passes;
|
(void)passes;
|
||||||
|
|
||||||
free(seed);
|
free(seed);
|
||||||
@@ -637,7 +637,7 @@ void order_by(int passes, int index){
|
|||||||
order_func = key_binding[index].black_magic;
|
order_func = key_binding[index].black_magic;
|
||||||
status |= (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_MASK | STATUS_RELOAD_DIRECTORY);
|
status |= (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_MASK | STATUS_RELOAD_DIRECTORY);
|
||||||
}
|
}
|
||||||
void cmd_on_selected(int passes, int index){
|
void cmd_on_selected(unsigned long passes, int index){
|
||||||
(void)passes;
|
(void)passes;
|
||||||
pthread_mutex_lock(&mutex_btm);
|
pthread_mutex_lock(&mutex_btm);
|
||||||
|
|
||||||
@@ -725,7 +725,7 @@ void cmd_on_selected(int passes, int index){
|
|||||||
}
|
}
|
||||||
pthread_mutex_unlock(&mutex_btm);
|
pthread_mutex_unlock(&mutex_btm);
|
||||||
}
|
}
|
||||||
void yank_text(int passes, int index){
|
void yank_text(unsigned long passes, int index){
|
||||||
(void)passes;
|
(void)passes;
|
||||||
char *cmd;
|
char *cmd;
|
||||||
if (strncmp((char*)key_binding[index].black_magic, "path", 4) == 0) {
|
if (strncmp((char*)key_binding[index].black_magic, "path", 4) == 0) {
|
||||||
@@ -746,7 +746,7 @@ void yank_text(int passes, int index){
|
|||||||
}
|
}
|
||||||
free(cmd);
|
free(cmd);
|
||||||
}
|
}
|
||||||
void yank_file(int passes, int index){
|
void yank_file(unsigned long passes, int index){
|
||||||
(void)passes;
|
(void)passes;
|
||||||
|
|
||||||
unsigned long i;
|
unsigned long i;
|
||||||
@@ -924,3 +924,25 @@ void search_previous(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
void jmp_file_index(){
|
||||||
|
char *index = malloc(255);
|
||||||
|
memset(index, ' ', 255);
|
||||||
|
index[254] = '\0';
|
||||||
|
unsigned long local_height;
|
||||||
|
local_height = getmaxy(win_b);
|
||||||
|
read_string(win_b, local_height - 1, 0, index);
|
||||||
|
|
||||||
|
unsigned long new_index = 0;
|
||||||
|
while((*index >= '0') && (*index <= '9')) {
|
||||||
|
new_index = (new_index * 10) + (*index - '0');
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
if (new_index > mid_file_count) {
|
||||||
|
selected_file_current = mid_file_count;
|
||||||
|
} else {
|
||||||
|
selected_file_current = new_index;
|
||||||
|
}
|
||||||
|
|
||||||
|
status |= (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_0);
|
||||||
|
update_selected_file();
|
||||||
|
}
|
||||||
|
@@ -9,9 +9,9 @@ void quit_program();
|
|||||||
void toggle_selection();
|
void toggle_selection();
|
||||||
void select_all();
|
void select_all();
|
||||||
void move_right();
|
void move_right();
|
||||||
void move_up(int passes);
|
void move_up(unsigned long passes);
|
||||||
void move_down(int passes);
|
void move_down(unsigned long passes);
|
||||||
void move_left(int passes);
|
void move_left(unsigned long passes);
|
||||||
void jump_bottom();
|
void jump_bottom();
|
||||||
void jump_top();
|
void jump_top();
|
||||||
void toggle_hidden_files();
|
void toggle_hidden_files();
|
||||||
@@ -21,14 +21,15 @@ void delete();
|
|||||||
void makedir();
|
void makedir();
|
||||||
void makefile();
|
void makefile();
|
||||||
void update();
|
void update();
|
||||||
void enter_shell(int passes, int index);
|
void enter_shell(unsigned long passes, int index);
|
||||||
void not_implemented(int passes, int index);
|
void not_implemented(unsigned long passes, int index);
|
||||||
void jump_to_dir(int passes, int index);
|
void jump_to_dir(unsigned long passes, int index);
|
||||||
void order_by(int passes, int index);
|
void order_by(unsigned long passes, int index);
|
||||||
void cmd_on_selected(int passes, int index);
|
void cmd_on_selected(unsigned long passes, int index);
|
||||||
void yank_text(int passes, int index);
|
void yank_text(unsigned long passes, int index);
|
||||||
void yank_file(int passes, int index);
|
void yank_file(unsigned long passes, int index);
|
||||||
void paste();
|
void paste();
|
||||||
void search();
|
void search();
|
||||||
void search_next();
|
void search_next();
|
||||||
void search_previous();
|
void search_previous();
|
||||||
|
void jmp_file_index();
|
||||||
|
Reference in New Issue
Block a user