Add tabsort option to control how tabs are sorted. default = per index, mru = most recent

This commit is contained in:
yuri 2020-01-31 10:55:04 +01:00
parent 9a0937a4f0
commit 9bf2643252
2 changed files with 11 additions and 1 deletions

View file

@ -3,6 +3,7 @@ import { browserBg } from "@src/lib/webext.ts"
import { enumerate } from "@src/lib/itertools"
import * as Containers from "@src/lib/containers"
import * as Completions from "@src/completions"
import * as config from "@src/lib/config"
class BufferCompletionOption extends Completions.CompletionOptionHTML
implements Completions.CompletionOptionFuse {
@ -152,7 +153,11 @@ export class BufferCompletionSource extends Completions.CompletionSourceFuse {
// Get alternative tab, defined as last accessed tab.
tabs.sort((a, b) => (b.lastAccessed - a.lastAccessed))
const alt = tabs[1]
tabs.sort((a, b) => (a.index - b.index))
const useMruTabOrder = (config.get("tabsort") === "mru")
if (!useMruTabOrder) {
tabs.sort((a, b) => (a.index - b.index))
}
for (const tab of tabs) {
options.push(

View file

@ -690,6 +690,11 @@ export class default_config {
*/
tabopenpos: "next" | "last" = "next"
/**
* Controls which tab order to use when opening the tab/buffer list. Either mru = sort by most recent tab or default = by tab index
*/
tabsort: "mru" | "default" = "default"
/**
* Where to open tabs opened with hinting - as if it had been middle clicked, to the right of the current tab, or at the end of the tabs.
*/