Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 16 additions & 24 deletions src/filemanager/panel.c
Original file line number Diff line number Diff line change
Expand Up @@ -803,46 +803,42 @@ repaint_file (WPanel *panel, int file_index, file_attr_t attr)
int offset = 0;
filename_scroll_flag_t ret_frm;
int ypos = 0;
gboolean panel_is_split;
int fln = 0;

panel_is_split = panel->list_cols > 1;
width = w->rect.cols - 2;
// Divide into panel->list_cols equally wide columns, plus maybe some leftover space: #4906
width = w->rect.cols - 1;

if (panel_is_split)
{
nth_column = (file_index - panel->top) / panel_lines (panel);
width /= panel->list_cols;
nth_column = (file_index - panel->top) / panel_lines (panel);
width /= panel->list_cols;

offset = width * nth_column;
offset = width * nth_column;

if (nth_column + 1 >= panel->list_cols)
width = w->rect.cols - offset - 2;
}
if (nth_column + 1 >= panel->list_cols)
width = w->rect.cols - offset - 1;

width--;

// Nothing to paint
if (width <= 0)
return;

ypos = file_index - panel->top;

if (panel_is_split)
ypos %= panel_lines (panel);
ypos %= panel_lines (panel);

ypos += 2; // top frame and header
widget_gotoyx (w, ypos, offset + 1);

ret_frm = format_file (panel, file_index, width, attr, FALSE, &fln);

if (panel_is_split && nth_column + 1 < panel->list_cols)
if (nth_column + 1 < panel->list_cols)
{
tty_setcolor (NORMAL_COLOR);
tty_print_one_vline (TRUE);
}

if (ret_frm != FILENAME_NOSCROLL)
{
if (!panel_is_split && fln > 0)
if (panel->list_cols == 1 && fln > 0)
{
if (panel->list_format != list_long)
width = fln;
Expand All @@ -868,9 +864,7 @@ repaint_file (WPanel *panel, int file_index, file_attr_t attr)

if ((ret_frm & FILENAME_SCROLL_RIGHT) != 0)
{
offset += width;
if (nth_column + 1 >= panel->list_cols)
offset++;
offset += width + 1;

const int scroll_right_char_color =
panel->list_format != list_long && g_slist_length (panel->format) > 2
Expand Down Expand Up @@ -1816,14 +1810,12 @@ use_display_format (WPanel *panel, const char *format, char **error, gboolean is

panel->dirty = TRUE;

usable_columns = WIDGET (panel)->rect.cols - 2;
// Divide into panel->list_cols equally wide columns, plus maybe some leftover space: #4906
usable_columns = WIDGET (panel)->rect.cols - 1;
// Status needn't to be split
if (!isstatus)
{
usable_columns /= panel->list_cols;
if (panel->list_cols > 1)
usable_columns--;
}
usable_columns--;

// Look for the expandable fields and set field_len based on the requested field len
for (darr = home; darr != NULL && expand_top < MAX_EXPAND; darr = g_slist_next (darr))
Expand Down
Loading