pazz / alot

Terminal-based Mail User Agent
GNU General Public License v3.0
683 stars 163 forks source link

configurable limit on move last #1562

Closed paretje closed 3 years ago

paretje commented 3 years ago

As discussed in #1561, I added an option to configure the maximum number of results before using the reverse order heuristic for move last. I kept the default at 200, although search_threads_rebuild_limit is unlimited by default, as we do have the heuristic approach as a fallback.

I also disabled restoring focus after the building the reversed threadlist, as that is limited by search_threads_rebuild_limit, making this heuristic pointless by default, as you still load the whole threadbuffer, while getting an inexact order. And even when search_threads_rebuild_limit is set to a different value, it would still be unnecessarily slow.

paretje commented 3 years ago

Regarding the Codacy failure: the SearchBuffer.rebuild function signature already differed before, supporting the reverse keyword argument. I guess I could rename rebuild to _rebulld, and defining rebuild to call _rebuild, and use the internal _rebuild when we want some specific behaviour while performing a jump.

pazz commented 3 years ago

Thanks! I think this is a great solution. I was not able to talk codacity into ignoring the issue. IMO that issue is unproblematic because if ever called from outside contexts, the one or zero-parameter invocation still works as expected because you added a sensible default value to the new parameter.