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) {
|
||||
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;
|
||||
ret = 1;
|
||||
} else {
|
||||
|
||||
@@ -417,25 +417,6 @@ void delete(){
|
||||
|
||||
werase(win_b);
|
||||
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/3); /*the div3 just looks cool*/
|
||||
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, 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)"));
|
||||
btm_buffer[BTM_WINDOW_HEIGHT_ON_STR_INTERACTION * (terminal_width/3)] = '\0';
|
||||
|
||||
} else {
|
||||
/*since more data is present than can be represented using div3, we do the uncool thing*/
|
||||
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);
|
||||
@@ -450,8 +431,7 @@ void delete(){
|
||||
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';
|
||||
}
|
||||
btm_buffer[BTM_WINDOW_HEIGHT_ON_STR_INTERACTION * terminal_width-1] = '\0';
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user