Skip to content

Commit 7b9ed3f

Browse files
authored
Merge pull request #4910 from egmontkob/4906-brief-mode-columns
Ticket #4906: Brief listing mode: make column widths more even
2 parents 9e9f67a + 5fa5428 commit 7b9ed3f

File tree

1 file changed

+16
-24
lines changed

1 file changed

+16
-24
lines changed

src/filemanager/panel.c

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -803,46 +803,42 @@ repaint_file (WPanel *panel, int file_index, file_attr_t attr)
803803
int offset = 0;
804804
filename_scroll_flag_t ret_frm;
805805
int ypos = 0;
806-
gboolean panel_is_split;
807806
int fln = 0;
808807

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

812-
if (panel_is_split)
813-
{
814-
nth_column = (file_index - panel->top) / panel_lines (panel);
815-
width /= panel->list_cols;
811+
nth_column = (file_index - panel->top) / panel_lines (panel);
812+
width /= panel->list_cols;
816813

817-
offset = width * nth_column;
814+
offset = width * nth_column;
818815

819-
if (nth_column + 1 >= panel->list_cols)
820-
width = w->rect.cols - offset - 2;
821-
}
816+
if (nth_column + 1 >= panel->list_cols)
817+
width = w->rect.cols - offset - 1;
818+
819+
width--;
822820

823821
// Nothing to paint
824822
if (width <= 0)
825823
return;
826824

827825
ypos = file_index - panel->top;
828-
829-
if (panel_is_split)
830-
ypos %= panel_lines (panel);
826+
ypos %= panel_lines (panel);
831827

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

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

837-
if (panel_is_split && nth_column + 1 < panel->list_cols)
833+
if (nth_column + 1 < panel->list_cols)
838834
{
839835
tty_setcolor (NORMAL_COLOR);
840836
tty_print_one_vline (TRUE);
841837
}
842838

843839
if (ret_frm != FILENAME_NOSCROLL)
844840
{
845-
if (!panel_is_split && fln > 0)
841+
if (panel->list_cols == 1 && fln > 0)
846842
{
847843
if (panel->list_format != list_long)
848844
width = fln;
@@ -868,9 +864,7 @@ repaint_file (WPanel *panel, int file_index, file_attr_t attr)
868864

869865
if ((ret_frm & FILENAME_SCROLL_RIGHT) != 0)
870866
{
871-
offset += width;
872-
if (nth_column + 1 >= panel->list_cols)
873-
offset++;
867+
offset += width + 1;
874868

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

18171811
panel->dirty = TRUE;
18181812

1819-
usable_columns = WIDGET (panel)->rect.cols - 2;
1813+
// Divide into panel->list_cols equally wide columns, plus maybe some leftover space: #4906
1814+
usable_columns = WIDGET (panel)->rect.cols - 1;
18201815
// Status needn't to be split
18211816
if (!isstatus)
1822-
{
18231817
usable_columns /= panel->list_cols;
1824-
if (panel->list_cols > 1)
1825-
usable_columns--;
1826-
}
1818+
usable_columns--;
18271819

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

0 commit comments

Comments
 (0)