aboutsummaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/SettingData.ts3
-rw-r--r--src/shared/Settings.ts3
-rw-r--r--src/shared/operations.ts18
3 files changed, 16 insertions, 8 deletions
diff --git a/src/shared/SettingData.ts b/src/shared/SettingData.ts
index 1c085cf..94d1e21 100644
--- a/src/shared/SettingData.ts
+++ b/src/shared/SettingData.ts
@@ -353,7 +353,8 @@ export const DefaultSettingData: SettingData = SettingData.valueOf({
"G": { "type": "scroll.bottom" },
"$": { "type": "scroll.end" },
"d": { "type": "tabs.close" },
- "D": { "type": "tabs.close.right" },
+ "D": { "type": "tabs.close", "selectLeft": true },
+ "gd": { "type": "tabs.close.right" },
"!d": { "type": "tabs.close.force" },
"u": { "type": "tabs.reopen" },
"K": { "type": "tabs.prev" },
diff --git a/src/shared/Settings.ts b/src/shared/Settings.ts
index 0bef342..c51cbc5 100644
--- a/src/shared/Settings.ts
+++ b/src/shared/Settings.ts
@@ -146,7 +146,8 @@ export const DefaultSetting: Settings = {
'G': { 'type': 'scroll.bottom' },
'$': { 'type': 'scroll.end' },
'd': { 'type': 'tabs.close' },
- 'D': { 'type': 'tabs.close.right' },
+ 'D': { 'type': 'tabs.close', 'selectLeft': true },
+ 'gd': { 'type': 'tabs.close.right' },
'!d': { 'type': 'tabs.close.force' },
'u': { 'type': 'tabs.reopen' },
'K': { 'type': 'tabs.prev' },
diff --git a/src/shared/operations.ts b/src/shared/operations.ts
index 2b03d9d..f657db1 100644
--- a/src/shared/operations.ts
+++ b/src/shared/operations.ts
@@ -201,6 +201,7 @@ export interface PageHomeOperation {
export interface TabCloseOperation {
type: typeof TAB_CLOSE;
+ selectLeft?: boolean;
}
export interface TabCloseForceOperation {
@@ -367,28 +368,28 @@ export type Operation =
const assertOptionalBoolean = (obj: any, name: string) => {
if (Object.prototype.hasOwnProperty.call(obj, name) &&
typeof obj[name] !== 'boolean') {
- throw new TypeError(`Not a boolean parameter '${name}'`);
+ throw new TypeError(`Not a boolean parameter: '${name}'`);
}
};
const assertRequiredNumber = (obj: any, name: string) => {
if (!Object.prototype.hasOwnProperty.call(obj, name) ||
typeof obj[name] !== 'number') {
- throw new TypeError(`Missing number parameter '${name}`);
+ throw new TypeError(`Missing number parameter: '${name}`);
}
};
const assertRequiredString = (obj: any, name: string) => {
if (!Object.prototype.hasOwnProperty.call(obj, name) ||
typeof obj[name] !== 'string') {
- throw new TypeError(`Missing string parameter '${name}`);
+ throw new TypeError(`Missing string parameter: '${name}`);
}
};
// eslint-disable-next-line complexity, max-lines-per-function
export const valueOf = (o: any): Operation => {
if (!Object.prototype.hasOwnProperty.call(o, 'type')) {
- throw new TypeError(`missing 'type' field`);
+ throw new TypeError(`Missing 'type' field`);
}
switch (o.type) {
case COMMAND_SHOW_OPEN:
@@ -416,6 +417,12 @@ export const valueOf = (o: any): Operation => {
type: PAGE_HOME,
newTab: Boolean(typeof o.newTab === undefined ? false : o.newTab),
};
+ case TAB_CLOSE:
+ assertOptionalBoolean(o, 'selectLeft');
+ return {
+ type: TAB_CLOSE,
+ selectLeft: Boolean(typeof o.selectLeft === undefined ? false : o.selectLeft), // eslint-disable-line max-len
+ };
case TAB_RELOAD:
assertOptionalBoolean(o, 'cache');
return {
@@ -458,7 +465,6 @@ export const valueOf = (o: any): Operation => {
case NAVIGATE_ROOT:
case FOCUS_INPUT:
case PAGE_SOURCE:
- case TAB_CLOSE:
case TAB_CLOSE_FORCE:
case TAB_CLOSE_RIGHT:
case TAB_REOPEN:
@@ -483,5 +489,5 @@ export const valueOf = (o: any): Operation => {
case REPEAT_LAST:
return { type: o.type };
}
- throw new TypeError('unknown operation type: ' + o.type);
+ throw new TypeError('Unknown operation type: ' + o.type);
};