mirror of
https://gittea.dev/nova/th.git
synced 2026-01-30 08:40:10 -05:00
-fsanitize=address related stuff
This commit is contained in:
2
dir.c
2
dir.c
@@ -327,7 +327,7 @@ char update_selected_file(){
|
|||||||
if (selected_file_current >= mid_file_count) {
|
if (selected_file_current >= mid_file_count) {
|
||||||
selected_file_current = mid_file_count-1;
|
selected_file_current = mid_file_count-1;
|
||||||
}
|
}
|
||||||
if (selected_file_current != selected_file_last) {
|
if (selected_file_current != selected_file_last && selected_file_last <= mid_file_count) {
|
||||||
mid_content[selected_file_last].status &= ~FILE_STATUS_HOVER;
|
mid_content[selected_file_last].status &= ~FILE_STATUS_HOVER;
|
||||||
ret = 1;
|
ret = 1;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -417,41 +417,21 @@ void delete(){
|
|||||||
|
|
||||||
werase(win_b);
|
werase(win_b);
|
||||||
mvwin(win_b, terminal_height-6, 0);
|
mvwin(win_b, terminal_height-6, 0);
|
||||||
if (strlen(file_str) < (BTM_WINDOW_HEIGHT_ON_STR_INTERACTION-1) * (terminal_width/3)) {
|
wresize(win_b, BTM_WINDOW_HEIGHT_ON_STR_INTERACTION, terminal_width);
|
||||||
wresize(win_b, BTM_WINDOW_HEIGHT_ON_STR_INTERACTION, terminal_width/3); /*the div3 just looks cool*/
|
btm_buffer = malloc(BTM_WINDOW_HEIGHT_ON_STR_INTERACTION * terminal_width);
|
||||||
btm_buffer = malloc(BTM_WINDOW_HEIGHT_ON_STR_INTERACTION * (terminal_width/3));
|
memset(btm_buffer, ' ', BTM_WINDOW_HEIGHT_ON_STR_INTERACTION * terminal_width);
|
||||||
memset(btm_buffer, ' ', (BTM_WINDOW_HEIGHT_ON_STR_INTERACTION * (terminal_width/3)));
|
|
||||||
|
|
||||||
memcpy(btm_buffer, ui_delete_text ,strlen(ui_delete_text));
|
memcpy(btm_buffer, ui_delete_text ,strlen(ui_delete_text));
|
||||||
if (hits) {
|
|
||||||
memcpy(btm_buffer + strlen(ui_delete_text)+1, file_str, strlen(file_str));
|
|
||||||
} else {
|
|
||||||
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)"));
|
/*this horrendous check tries to copy everything until the last line, while keeping said last line unwritten*/
|
||||||
btm_buffer[BTM_WINDOW_HEIGHT_ON_STR_INTERACTION * (terminal_width/3)] = '\0';
|
/*lets hope im never gonna need to format something like this ever again*/
|
||||||
|
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)));
|
||||||
|
|
||||||
} else {
|
memcpy(btm_buffer + (BTM_WINDOW_HEIGHT_ON_STR_INTERACTION * terminal_width - terminal_width) , "(y/N)", strlen("(y/N)"));
|
||||||
/*since more data is present than can be represented using div3, we do the uncool thing*/
|
btm_buffer[BTM_WINDOW_HEIGHT_ON_STR_INTERACTION * terminal_width-1] = '\0';
|
||||||
wresize(win_b, BTM_WINDOW_HEIGHT_ON_STR_INTERACTION, terminal_width);
|
|
||||||
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, 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(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)));
|
|
||||||
|
|
||||||
memcpy(btm_buffer + (BTM_WINDOW_HEIGHT_ON_STR_INTERACTION * terminal_width - terminal_width) , "(y/N)", strlen("(y/N)"));
|
|
||||||
btm_buffer[BTM_WINDOW_HEIGHT_ON_STR_INTERACTION * terminal_width] = '\0';
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user