mirror of
https://gittea.dev/nova/th.git
synced 2025-10-22 02:40:15 -04:00
refractoring, fixed enter_shell
This commit is contained in:
1
config.h
1
config.h
@@ -66,6 +66,7 @@ static const binding key_binding[] = {
|
|||||||
{ "gD", jump_to_dir, "$HOME/Downloads", "jump to $HOME/Downloads" },
|
{ "gD", jump_to_dir, "$HOME/Downloads", "jump to $HOME/Downloads" },
|
||||||
{ "gd", jump_to_dir, "/dev", "jump to /dev" },
|
{ "gd", jump_to_dir, "/dev", "jump to /dev" },
|
||||||
{ "ge", jump_to_dir, "/etc", "jump to /etc" },
|
{ "ge", jump_to_dir, "/etc", "jump to /etc" },
|
||||||
|
{ "gp", jump_to_dir, "/etc/portage", "jump to /etc/portage" },
|
||||||
{ "gm", jump_to_dir, "/mnt", "jump to /mnt" },
|
{ "gm", jump_to_dir, "/mnt", "jump to /mnt" },
|
||||||
{ "go", jump_to_dir, "/opt", "jump to /opt" },
|
{ "go", jump_to_dir, "/opt", "jump to /opt" },
|
||||||
{ "gt", jump_to_dir, "/tmp", "jump to /tmp" },
|
{ "gt", jump_to_dir, "/tmp", "jump to /tmp" },
|
||||||
|
1
dir.c
1
dir.c
@@ -336,7 +336,6 @@ void update_selected_file(){
|
|||||||
}
|
}
|
||||||
void dir_set_selected_file_current(unsigned long selected_file_current){
|
void dir_set_selected_file_current(unsigned long selected_file_current){
|
||||||
current_dir->selected_file_current = selected_file_current;
|
current_dir->selected_file_current = selected_file_current;
|
||||||
mvwaddch(stdscr, 0,0, selected_file_current + '0');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long dir_get_selected_file_current(){
|
unsigned long dir_get_selected_file_current(){
|
||||||
|
@@ -523,16 +523,25 @@ 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(int passes, int index){
|
||||||
|
(void)passes;
|
||||||
|
|
||||||
|
endwin();
|
||||||
if (system(key_binding[index].black_magic) != 0) {
|
if (system(key_binding[index].black_magic) != 0) {
|
||||||
/*do nothing*/
|
/*do nothing*/
|
||||||
}
|
}
|
||||||
|
initscr();
|
||||||
|
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(int passes, int index){
|
||||||
mvaddstr(terminal_height-1, 0, key_binding[index].comment);
|
(void)passes;
|
||||||
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, 0, key_binding[index].comment);
|
||||||
|
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");
|
||||||
}
|
}
|
||||||
void jump_to_dir(int passes, int index){
|
void jump_to_dir(int passes, int index){
|
||||||
|
(void)passes;
|
||||||
|
|
||||||
char *ch = (char*)key_binding[index].black_magic;
|
char *ch = (char*)key_binding[index].black_magic;
|
||||||
char slash = 0;
|
char slash = 0;
|
||||||
unsigned int env_len = 0;
|
unsigned int env_len = 0;
|
||||||
@@ -588,11 +597,14 @@ 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(int passes, int index){
|
||||||
|
(void)passes;
|
||||||
|
|
||||||
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(int passes, int index){
|
||||||
|
(void)passes;
|
||||||
|
|
||||||
unsigned int i = 0;
|
unsigned int i = 0;
|
||||||
unsigned int hits = 0;
|
unsigned int hits = 0;
|
||||||
char *file_str = " ";
|
char *file_str = " ";
|
||||||
@@ -675,6 +687,8 @@ void cmd_on_selected(int passes, int index){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
void yank_file(int passes, int index){
|
void yank_file(int passes, int index){
|
||||||
|
(void)passes;
|
||||||
|
|
||||||
unsigned long i;
|
unsigned long i;
|
||||||
if (yank_files.status & YANK_IS_USED) {
|
if (yank_files.status & YANK_IS_USED) {
|
||||||
free(yank_files.path);
|
free(yank_files.path);
|
||||||
|
4
main.c
4
main.c
@@ -117,9 +117,9 @@ int main(){
|
|||||||
delwin(win_t);
|
delwin(win_t);
|
||||||
delwin(win_b);
|
delwin(win_b);
|
||||||
noraw();
|
noraw();
|
||||||
endwin();
|
|
||||||
curs_set(1);
|
|
||||||
echo();
|
echo();
|
||||||
|
curs_set(1);
|
||||||
|
endwin();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -146,6 +146,8 @@ void *thread_lft(void *data){
|
|||||||
}
|
}
|
||||||
void *thread_rgt(void *data){
|
void *thread_rgt(void *data){
|
||||||
unsigned int status = *(unsigned int*)data;
|
unsigned int status = *(unsigned int*)data;
|
||||||
|
(void)status;
|
||||||
|
|
||||||
pthread_mutex_lock(&mutex_rgt);
|
pthread_mutex_lock(&mutex_rgt);
|
||||||
pthread_mutex_lock(&mutex_wait);
|
pthread_mutex_lock(&mutex_wait);
|
||||||
wait_count++;
|
wait_count++;
|
||||||
@@ -206,6 +208,8 @@ void *thread_rgt(void *data){
|
|||||||
}
|
}
|
||||||
void *thread_top(void *data){
|
void *thread_top(void *data){
|
||||||
unsigned int status = *(unsigned int*)data;
|
unsigned int status = *(unsigned int*)data;
|
||||||
|
(void)status;
|
||||||
|
|
||||||
pthread_mutex_lock(&mutex_top);
|
pthread_mutex_lock(&mutex_top);
|
||||||
free(top_buffer);
|
free(top_buffer);
|
||||||
|
|
||||||
@@ -225,6 +229,8 @@ void *thread_top(void *data){
|
|||||||
}
|
}
|
||||||
void *thread_btm(void *data){
|
void *thread_btm(void *data){
|
||||||
unsigned int status = *(unsigned int*)data;
|
unsigned int status = *(unsigned int*)data;
|
||||||
|
(void)status;
|
||||||
|
|
||||||
pthread_mutex_lock(&mutex_btm);
|
pthread_mutex_lock(&mutex_btm);
|
||||||
pthread_mutex_lock(&mutex_wait);
|
pthread_mutex_lock(&mutex_wait);
|
||||||
wait_count++;
|
wait_count++;
|
||||||
|
@@ -1,5 +1,9 @@
|
|||||||
#include <curses.h>
|
#include <curses.h>
|
||||||
|
|
||||||
|
#ifndef THREADING_GUARD
|
||||||
|
#define THREADING_GUARD
|
||||||
#include "threading.c"
|
#include "threading.c"
|
||||||
|
#endif
|
||||||
|
|
||||||
void *thread_lft(void *data);
|
void *thread_lft(void *data);
|
||||||
void *thread_mid(void *data);
|
void *thread_mid(void *data);
|
||||||
|
Reference in New Issue
Block a user