some ui stuff
This commit is contained in:
18
config.h
18
config.h
@@ -118,11 +118,11 @@ static const char size_unit[] = { 'B', 'K', 'M', 'G', 'T', 'P' }; /* this define
|
|||||||
|
|
||||||
static const char ui_btm_text_storage_left[] = "total free";
|
static const char ui_btm_text_storage_left[] = "total free";
|
||||||
static const char ui_btm_current_dir_size[] = "sum of dir,";
|
static const char ui_btm_current_dir_size[] = "sum of dir,";
|
||||||
static const char ui_open_with_text_0[] = "open"; /*ui_open_with_text_0 \"selected_file\" ui_open_with_text_1*/
|
static const char ui_open_with_text[] = "open "SETTINGS_COMMAND_REPLACE_STR" with:";
|
||||||
static const char ui_open_with_text_1[] = "with:";
|
static const char ui_rename_text[] = "rename "SETTINGS_COMMAND_REPLACE_STR" to:";
|
||||||
static const char ui_rename_text_0[] = "rename"; /*ui_rename_text_0 \"selected_file\" ui_rename_text_1*/
|
static const char ui_mkdir_text[] = "mkdir:";
|
||||||
static const char ui_rename_text_1[] = "to:";
|
static const char ui_touch_text[] = "touch:";
|
||||||
static const char ui_delete_text[] = "delete:";
|
static const char ui_delete_text[] = "delete: "SETTINGS_COMMAND_REPLACE_STR;
|
||||||
|
|
||||||
/* {{{ */
|
/* {{{ */
|
||||||
static const unsigned long binding_count = sizeof(key_binding) / sizeof(binding);
|
static const unsigned long binding_count = sizeof(key_binding) / sizeof(binding);
|
||||||
@@ -139,10 +139,10 @@ static const unsigned long mimetype_default_count;
|
|||||||
static const unsigned long file_extension_default_count;
|
static const unsigned long file_extension_default_count;
|
||||||
static const char size_unit[];
|
static const char size_unit[];
|
||||||
static const char size_unit_count;
|
static const char size_unit_count;
|
||||||
static const char ui_open_with_text_0[];
|
static const char ui_open_with_text[];
|
||||||
static const char ui_open_with_text_1[];
|
static const char ui_rename_text[];
|
||||||
static const char ui_rename_text_0[];
|
static const char ui_mkdir_text[];
|
||||||
static const char ui_rename_text_1[];
|
static const char ui_touch_text[];
|
||||||
static const char ui_delete_text[];
|
static const char ui_delete_text[];
|
||||||
#endif
|
#endif
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|||||||
@@ -128,18 +128,18 @@ int read_string(WINDOW *win, int y, int x, char *str){
|
|||||||
break;
|
break;
|
||||||
} else if (ch == '\t') { /* tab */
|
} else if (ch == '\t') { /* tab */
|
||||||
memcpy(str + pass, mid_dir.current_file->file_name, strlen(mid_dir.current_file->file_name));
|
memcpy(str + pass, mid_dir.current_file->file_name, strlen(mid_dir.current_file->file_name));
|
||||||
mvwaddstr(win, y, x +pass, mid_dir.current_file->file_name);
|
mvwaddstr(win, y, x + pass, mid_dir.current_file->file_name);
|
||||||
pass += strlen(mid_dir.current_file->file_name);
|
pass += strlen(mid_dir.current_file->file_name);
|
||||||
} else if (ch == 127) { /* backspace */
|
} else if (ch == 127) { /* backspace */
|
||||||
if (pass > 0) {
|
if (pass > 0) {
|
||||||
pass--;
|
pass--;
|
||||||
mvwdelch(win, y, pass);
|
mvwdelch(win, y, x + pass);
|
||||||
}
|
}
|
||||||
} else if (ch == 27) { /* esc key */
|
} else if (ch == 27) { /* esc key */
|
||||||
err = 1;
|
err = 1;
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
mvwaddch(win, y, x +pass, ch);
|
mvwaddch(win, y, x + pass, ch);
|
||||||
str[pass] = ch;
|
str[pass] = ch;
|
||||||
pass++;
|
pass++;
|
||||||
}
|
}
|
||||||
@@ -293,7 +293,8 @@ void makedir(){
|
|||||||
wclear(win_b);
|
wclear(win_b);
|
||||||
file tmp;
|
file tmp;
|
||||||
tmp.file_name = malloc(INPUT_BUFFER_SIZE);
|
tmp.file_name = malloc(INPUT_BUFFER_SIZE);
|
||||||
if (read_string(win_b, 0, 0, tmp.file_name) == 0) {
|
mvwprintw(win_b, 0, 0, ui_mkdir_text);
|
||||||
|
if (read_string(win_b, 0, strlen(ui_mkdir_text)+1, tmp.file_name) == 0) {
|
||||||
char *cmd = parse_cmd("mkdir ", &tmp);
|
char *cmd = parse_cmd("mkdir ", &tmp);
|
||||||
system(cmd);
|
system(cmd);
|
||||||
free(cmd);
|
free(cmd);
|
||||||
@@ -305,7 +306,8 @@ void makefile(){
|
|||||||
wclear(win_b);
|
wclear(win_b);
|
||||||
file tmp;
|
file tmp;
|
||||||
tmp.file_name = malloc(INPUT_BUFFER_SIZE);
|
tmp.file_name = malloc(INPUT_BUFFER_SIZE);
|
||||||
if (read_string(win_b, 0, 0, tmp.file_name) == 0) {
|
mvwprintw(win_b, 0, 0, ui_touch_text);
|
||||||
|
if (read_string(win_b, 0, strlen(ui_touch_text)+1, tmp.file_name) == 0) {
|
||||||
char *cmd = parse_cmd("touch ", &tmp);
|
char *cmd = parse_cmd("touch ", &tmp);
|
||||||
system(cmd);
|
system(cmd);
|
||||||
free(cmd);
|
free(cmd);
|
||||||
|
|||||||
Reference in New Issue
Block a user