mirror of
https://gittea.dev/nova/th.git
synced 2025-12-09 09:10:10 -05:00
moving ui text into config.h
This commit is contained in:
10
config.h
10
config.h
@@ -111,6 +111,11 @@ static const char size_unit[] = { 'B', 'K', 'M', 'G', 'T', 'P' }; /* this define
|
||||
static const char clipboard_cmd[] = "xsel -ib --trim"; /* assembles the following shell cmd: echo "hovered_file" | clipboard_cmd */
|
||||
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_open_with_text_0[] = "open"; /*ui_open_with_text_0 \"selected_file\" ui_open_with_text_1*/
|
||||
static const char ui_open_with_text_1[] = "with:";
|
||||
static const char ui_rename_text_0[] = "rename"; /*ui_rename_text_0 \"selected_file\" ui_rename_text_1*/
|
||||
static const char ui_rename_text_1[] = "to:";
|
||||
static const char ui_delete_text[] = "delete:";
|
||||
|
||||
/* {{{ */
|
||||
static const unsigned long binding_count = sizeof(key_binding) / sizeof(binding);
|
||||
@@ -127,5 +132,10 @@ static const unsigned long mimetype_default_count;
|
||||
static const unsigned long file_extension_default_count;
|
||||
static const char size_unit[];
|
||||
static const char size_unit_count;
|
||||
static const char ui_open_with_text_0[];
|
||||
static const char ui_open_with_text_1[];
|
||||
static const char ui_rename_text_0[];
|
||||
static const char ui_rename_text_1[];
|
||||
static const char ui_delete_text[];
|
||||
#endif
|
||||
/* }}} */
|
||||
|
||||
@@ -316,8 +316,11 @@ void open_with(){
|
||||
mvwin(win_b, terminal_height-6, 0);
|
||||
wresize(win_b, BTM_WINDOW_HEIGHT_ON_STR_INTERACTION, terminal_width/3); /*the div3 just looks cool*/
|
||||
|
||||
concat(btm_buffer, "open \"", mid_content[selected_file_current].file_name, 0);
|
||||
concat(btm_buffer, btm_buffer, "\" with:", 1);
|
||||
concat(btm_buffer, ui_open_with_text_0, " \"", 0);
|
||||
concat(btm_buffer, btm_buffer, mid_content[selected_file_current].file_name, 1);
|
||||
concat(btm_buffer, btm_buffer, "\" ", 1);
|
||||
concat(btm_buffer, btm_buffer, ui_open_with_text_1, 1);
|
||||
|
||||
|
||||
window_btm(win_b, 1);
|
||||
|
||||
@@ -360,8 +363,10 @@ void rename_hovered(){
|
||||
mvwin(win_b, terminal_height-6, 0);
|
||||
wresize(win_b, BTM_WINDOW_HEIGHT_ON_STR_INTERACTION, terminal_width/3); /*the div3 just looks cool*/
|
||||
|
||||
concat(btm_buffer, "rename \"", mid_content[selected_file_current].file_name, 0);
|
||||
concat(btm_buffer, btm_buffer, "\" to:", 1);
|
||||
concat(btm_buffer, ui_rename_text_0, " \"", 0);
|
||||
concat(btm_buffer, btm_buffer, mid_content[selected_file_current].file_name, 1);
|
||||
concat(btm_buffer, btm_buffer, "\" ", 1);
|
||||
concat(btm_buffer, btm_buffer, ui_rename_text_1, 1);
|
||||
|
||||
window_btm(win_b, 1);
|
||||
|
||||
@@ -417,13 +422,13 @@ void delete(){
|
||||
btm_buffer = malloc(BTM_WINDOW_HEIGHT_ON_STR_INTERACTION * (terminal_width/3));
|
||||
memset(btm_buffer, ' ', (BTM_WINDOW_HEIGHT_ON_STR_INTERACTION * (terminal_width/3)));
|
||||
|
||||
memcpy(btm_buffer, "delete: ",strlen("delete: "));
|
||||
memcpy(btm_buffer, ui_delete_text ,strlen(ui_delete_text));
|
||||
if (hits) {
|
||||
memcpy(btm_buffer + strlen("delete: "), file_str, strlen(file_str));
|
||||
memcpy(btm_buffer + strlen(ui_delete_text)+1, file_str, strlen(file_str));
|
||||
} else {
|
||||
btm_buffer[strlen("delete: ")] = '"';
|
||||
memcpy(btm_buffer + strlen("delete: ") + sizeof(char), mid_content[selected_file_current].file_name, strlen(mid_content[selected_file_current].file_name)-1);
|
||||
btm_buffer[strlen("delete: ") + sizeof(char) + strlen(mid_content[selected_file_current].file_name)] = '"';
|
||||
btm_buffer[strlen(ui_delete_text)+1] = '"';
|
||||
memcpy(btm_buffer + strlen(ui_delete_text) +1 + sizeof(char), mid_content[selected_file_current].file_name, strlen(mid_content[selected_file_current].file_name));
|
||||
btm_buffer[strlen(ui_delete_text)+1 + sizeof(char) + strlen(mid_content[selected_file_current].file_name)] = '"';
|
||||
}
|
||||
|
||||
memcpy(btm_buffer + (BTM_WINDOW_HEIGHT_ON_STR_INTERACTION * (terminal_width/3) - (terminal_width/3)) , "(y/N)", strlen("(y/N)"));
|
||||
@@ -435,11 +440,11 @@ void delete(){
|
||||
btm_buffer = malloc(BTM_WINDOW_HEIGHT_ON_STR_INTERACTION * terminal_width);
|
||||
memset(btm_buffer, ' ', BTM_WINDOW_HEIGHT_ON_STR_INTERACTION * terminal_width);
|
||||
|
||||
memcpy(btm_buffer, "delete: ",strlen("delete: "));
|
||||
memcpy(btm_buffer, ui_delete_text ,strlen(ui_delete_text));
|
||||
|
||||
/*this horrendous check tries to copy everything until the last line, while keeping said last line unwritten*/
|
||||
/*lets hope im never gonna need to format something like this ever again*/
|
||||
memcpy(btm_buffer + strlen("delete: "), file_str,
|
||||
memcpy(btm_buffer + strlen(ui_delete_text)+1, file_str,
|
||||
(strlen(file_str) > ((BTM_WINDOW_HEIGHT_ON_STR_INTERACTION * terminal_width) - terminal_width) ?
|
||||
((BTM_WINDOW_HEIGHT_ON_STR_INTERACTION * terminal_width) - terminal_width) :
|
||||
strlen(file_str)));
|
||||
|
||||
Reference in New Issue
Block a user