~ruther/CTU-FEE-B0B35APO-Semestral-project

cb2e9cb8adf0656a8e68f252bdb1c7e25848b6f9 — František Boháček 3 years ago 2749ce8
fix: list container scroll
2 files changed, 10 insertions(+), 2 deletions(-)

M file-browser/src/window_browser.c
M lib-gui/src/gui_list_container.c
M file-browser/src/window_browser.c => file-browser/src/window_browser.c +1 -1
@@ 240,7 240,7 @@ static void browser_window_job(void *state) {

  char tmp[MAX_COLUMN_CHARS];
  for (int i = 0; i < COLUMNS_COUNT; i++) {
    uint16_t max_size = 0;
    uint16_t max_size = font_measure_text(bstate->font, column_names[i]).x;
    for (int j = 0; j < bstate->current_directory->files_count; j++) {
      char *data = browser_get_column_data(bstate->current_directory->files, i, tmp);
      if (data == NULL) {

M lib-gui/src/gui_list_container.c => lib-gui/src/gui_list_container.c +9 -1
@@ 137,7 137,15 @@ void gui_list_container_update(gui_t *gui, container_t *container) {
  if (first_visible_index < 0) {
    first_visible_index = 0;
  }
  uint32_t items_count = container->height / item_full_height - 1;

  uint32_t container_height = container->height;

  bool header = list.render_header_fn != NULL;
  if (header) {
    container_height -= item_full_height;
  }

  uint32_t items_count = (double)(container_height) / item_full_height - 1;
  uint32_t last_visible_index = first_visible_index + items_count;

  uint32_t selected_index = list.selected_index;

Do not follow this link