Changeset fdf55a3 in mainline


Ignore:
Timestamp:
2022-06-02T19:13:12Z (23 months ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
453f9645
Parents:
03fc3a9
Message:

Do not select/open last entry if user clicks below

This behavior, meticulously copied from NC, is not really meaningful,
especially considering other circumstances. We also did it for double
click / open, which is very confusing.

Location:
uspace/lib/ui
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/ui/src/filelist.c

    r03fc3a9 rfdf55a3  
    934934/** Find the n-th entry of the current file list page.
    935935 *
    936  * If the page is short and has less than n+1 entries, return the last entry.
    937  *
    938936 * @param flist File list
    939937 * @param n Which entry to get (starting from 0)
     
    945943{
    946944        ui_file_list_entry_t *entry;
    947         ui_file_list_entry_t *next;
    948945        size_t i;
    949946        size_t idx;
     
    957954        idx = flist->page_idx;
    958955        for (i = 0; i < n; i++) {
    959                 next = ui_file_list_next(entry);
    960                 if (next == NULL)
    961                         break;
    962 
    963                 entry = next;
     956                entry = ui_file_list_next(entry);
     957                if (entry == NULL)
     958                        return NULL;
     959
    964960                ++idx;
    965961        }
  • uspace/lib/ui/test/filelist.c

    r03fc3a9 rfdf55a3  
    283283        PCUT_ASSERT_INT_EQUALS(2, flist->cursor->size);
    284284
    285         /* Clicking below the last entry should select it */
    286         event.hpos = 20;
    287         event.vpos = 200;
    288         claimed = ui_file_list_pos_event(flist, &event);
    289         PCUT_ASSERT_EQUALS(ui_claimed, claimed);
    290 
    291         PCUT_ASSERT_NOT_NULL(flist->cursor);
    292         PCUT_ASSERT_STR_EQUALS("c", flist->cursor->name);
    293         PCUT_ASSERT_INT_EQUALS(3, flist->cursor->size);
    294 
    295285        /* Clicking on the top edge should do a page-up */
    296286        event.hpos = 20;
     
    10141004
    10151005        entry = ui_file_list_page_nth_entry(flist, 0, &idx);
     1006        PCUT_ASSERT_NOT_NULL(entry);
    10161007        PCUT_ASSERT_STR_EQUALS("b", entry->name);
    10171008        PCUT_ASSERT_INT_EQUALS(1, idx);
    10181009
    10191010        entry = ui_file_list_page_nth_entry(flist, 1, &idx);
     1011        PCUT_ASSERT_NOT_NULL(entry);
    10201012        PCUT_ASSERT_STR_EQUALS("c", entry->name);
    10211013        PCUT_ASSERT_INT_EQUALS(2, idx);
    10221014
    10231015        entry = ui_file_list_page_nth_entry(flist, 2, &idx);
    1024         PCUT_ASSERT_STR_EQUALS("c", entry->name);
    1025         PCUT_ASSERT_INT_EQUALS(2, idx);
    1026 
    1027         entry = ui_file_list_page_nth_entry(flist, 3, &idx);
    1028         PCUT_ASSERT_STR_EQUALS("c", entry->name);
    1029         PCUT_ASSERT_INT_EQUALS(2, idx);
     1016        PCUT_ASSERT_NULL(entry);
    10301017
    10311018        ui_file_list_destroy(flist);
Note: See TracChangeset for help on using the changeset viewer.