Diffusion Kate 2fdd8c14268e

[PATCH] Quick Open: fix LRU listing regression

Authored by cullmann on Jul 10 2019, 5:59 PM.

Description

[PATCH] Quick Open: fix LRU listing regression

The quick open list used to be sorted by order of access (the old code
called it LRU order). Commit d6e38c0cbd3d6d7f76 broke this.

The first sort() call is changed to stable_sort() in order to preserve
the "bold" field and the new "sort_id" field. A comment warns about this
subtle and easy to break requirement. This change was needed to sort the
file list by LRU (files not in the sortedViews list have no sort_id set,
and thus are sorted below all LRU sorted entries).

stable_sort() should be slower than sort(), although the C++ standard
promises the same algorithmic complexity. On the other hand, this change
also lets us get rid of the openedUrls string list and the associated
linear search.

The second sort must always be a stable_sort(). This is a bug in the
previous code. It sorted only on the "bold" field, which means
everything else can be reordered as sort() likes. Even if it "worked",
it was buggy.

To completely restore the old behavior, select the second entry by
default in the quick open list. This is so that you can quickly switch
between the two last recently accessed files. The old code actually
selected the first entry if the sortedViews list contained less than 2
elements - keep that behavior too.

Author: Vincent Lang

BUG: 407103

Details

Committed
cullmannJul 10 2019, 5:59 PM
Parents
R40:24bd4c5011f4: lspclient: make location treeview more informative
Branches
Unknown
Tags
Unknown