while (file_i < vec_size(frame->workdir->vfiles)){
File_T* file = (File_T*)vec_at(frame->workdir->vfiles, file_i);
bool dir = is_dir(file->path);
- if(frame == state_get_focused_frame() && file_i == frame->workdir->idx){
- wattron(frame->p_win, A_STANDOUT | A_BOLD);
- }
if(dir) wattron(frame->p_win, COLOR_PAIR(DIRECTORY));
mvwaddnstr(frame->p_win, frame_i, 1, file->name, cols-2);
frame_i++;
file_i++;
if((frame_i+FrameBotBuffer) > rows) break;
}
+ if(frame == state_get_focused_frame()) frame_set_highlighting(frame, true, false);
}
int line = FrameTopBuffer + count_double_lines_to_idx(frame, false) + frame->workdir->idx - frame->top_index;
attr_t newattr= highlight ? (A_STANDOUT|A_BOLD) : A_NORMAL;
File_T* file = (File_T*) vec_at(frame->workdir->vfiles, frame->workdir->idx);
- short color = (is_dir(file->path) ? DIRECTORY : 0);
+ short color = (file && is_dir(file->path) ? DIRECTORY : 0);
mvwchgat(frame->p_win, line, 0, -1, newattr, color, NULL);
- if(file->expanded) mvwchgat(frame->p_win, line+1, color, -1, newattr, 0, NULL);
+ if(file && file->expanded) mvwchgat(frame->p_win, line+1, color, -1, newattr, 0, NULL);
if(frame_scroll(frame)) state_set_screen_dirty(true);
if(refresh_win) wrefresh(frame->p_win);
}
void screen_close(void) {
if (Frame_List->head != Frame_List->tail) {
int i = get_focused_frame_index();
- list_node_t* new_focus = state_get_focused_node()->next;
if(i >= 0){ /* negative if node not found */
+ list_node_t* doomed_node = state_get_focused_node();
+ mem_retain(doomed_node);
+ list_node_t* new_focus = doomed_node->next;
/* TODO: add function to list that allows removing with node pointer instead of just index */
list_delete(Frame_List, i);
// new_focus will be null if rm-d tail: set it to new tail
state_set_focused_node(new_focus);
state_set_screen_dirty(true);
state_set_screen_resized(true);
+ mem_release(doomed_node);
}
}
}