Skip to content

Commit

Permalink
feat: add shift for instant search
Browse files Browse the repository at this point in the history
Closes crimx#232
  • Loading branch information
crimx committed Nov 1, 2018
1 parent a0470af commit 20a942a
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/app-config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export interface AppConfigMutable {
/** cursor instant capture */
instant: {
enable: boolean
key: 'direct' | 'ctrl' | 'alt'
key: 'direct' | 'ctrl' | 'alt' | 'shift'
delay: number
}
},
Expand All @@ -123,7 +123,7 @@ export interface AppConfigMutable {
/** cursor instant capture */
instant: {
enable: boolean
key: 'direct' | 'ctrl' | 'alt'
key: 'direct' | 'ctrl' | 'alt' | 'shift'
delay: number
}
},
Expand All @@ -143,7 +143,7 @@ export interface AppConfigMutable {
/** cursor instant capture */
instant: {
enable: boolean
key: 'direct' | 'ctrl' | 'alt'
key: 'direct' | 'ctrl' | 'alt' | 'shift'
delay: number
}
},
Expand All @@ -163,7 +163,7 @@ export interface AppConfigMutable {
/** cursor instant capture */
instant: {
enable: boolean
key: 'direct' | 'ctrl' | 'alt'
key: 'direct' | 'ctrl' | 'alt' | 'shift'
delay: number
}
},
Expand Down
8 changes: 4 additions & 4 deletions src/app-config/merge-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export function mergeConfig (oldConfig: AppConfig, baseConfig?: AppConfig): AppC
mergeBoolean('mode.holding.ctrl')
mergeBoolean('mode.holding.meta')
mergeBoolean('mode.instant.enable')
merge('mode.instant.key', val => val === 'direct' || val === 'ctrl' || val === 'alt')
merge('mode.instant.key', val => /^(direct|ctrl|alt|shift)$/.test(val))
mergeNumber('mode.instant.delay')

mergeBoolean('pinMode.direct')
Expand All @@ -58,7 +58,7 @@ export function mergeConfig (oldConfig: AppConfig, baseConfig?: AppConfig): AppC
mergeBoolean('pinMode.holding.ctrl')
mergeBoolean('pinMode.holding.meta')
mergeBoolean('pinMode.instant.enable')
merge('pinMode.instant.key', val => val === 'direct' || val === 'ctrl' || val === 'alt')
merge('pinMode.instant.key', val => /^(direct|ctrl|alt|shift)$/.test(val))
mergeNumber('pinMode.instant.delay')

mergeBoolean('panelMode.direct')
Expand All @@ -67,7 +67,7 @@ export function mergeConfig (oldConfig: AppConfig, baseConfig?: AppConfig): AppC
mergeBoolean('panelMode.holding.ctrl')
mergeBoolean('panelMode.holding.meta')
mergeBoolean('panelMode.instant.enable')
merge('panelMode.instant.key', val => val === 'direct' || val === 'ctrl' || val === 'alt')
merge('panelMode.instant.key', val => /^(direct|ctrl|alt|shift)$/.test(val))
mergeNumber('panelMode.instant.delay')

mergeBoolean('qsPanelMode.direct')
Expand All @@ -76,7 +76,7 @@ export function mergeConfig (oldConfig: AppConfig, baseConfig?: AppConfig): AppC
mergeBoolean('qsPanelMode.holding.ctrl')
mergeBoolean('qsPanelMode.holding.meta')
mergeBoolean('qsPanelMode.instant.enable')
merge('qsPanelMode.instant.key', val => val === 'direct' || val === 'ctrl' || val === 'alt')
merge('qsPanelMode.instant.key', val => /^(direct|ctrl|alt|shift)$/.test(val))
mergeNumber('qsPanelMode.instant.delay')

mergeNumber('doubleClickDelay')
Expand Down
1 change: 1 addition & 0 deletions src/options/OptMode.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
<select class="form-control" v-model="mode.instant.key">
<option value="alt">{{ $t('opt:mode_instant_alt') }}</option>
<option value="ctrl">{{ $t('opt:mode_instant_ctrl') }}</option>
<option value="shift">Shift</option>
<option value="direct">{{ $t('opt:mode_instant_direct') }}</option>
</select>
</label>
Expand Down
1 change: 1 addition & 0 deletions src/options/OptPanelMode.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
<select class="form-control" v-model="panelMode.instant.key">
<option value="alt">{{ $t('opt:mode_instant_alt') }}</option>
<option value="ctrl">{{ $t('opt:mode_instant_ctrl') }}</option>
<option value="shift">Shift</option>
<option value="direct">{{ $t('opt:mode_instant_direct') }}</option>
</select>
</label>
Expand Down
1 change: 1 addition & 0 deletions src/options/OptPinMode.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
<select class="form-control" v-model="pinMode.instant.key">
<option value="alt">{{ $t('opt:mode_instant_alt') }}</option>
<option value="ctrl">{{ $t('opt:mode_instant_ctrl') }}</option>
<option value="shift">Shift</option>
<option value="direct">{{ $t('opt:mode_instant_direct') }}</option>
</select>
</label>
Expand Down
1 change: 1 addition & 0 deletions src/options/OptTripleCtrl.vue
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
<select class="form-control" v-model="qsPanelMode.instant.key">
<option value="alt">{{ $t('opt:mode_instant_alt') }}</option>
<option value="ctrl">{{ $t('opt:mode_instant_ctrl') }}</option>
<option value="shift">Shift</option>
<option value="direct">{{ $t('opt:mode_instant_direct') }}</option>
</select>
</label>
Expand Down
1 change: 1 addition & 0 deletions src/selection/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ combineLatest(
fromEvent<MouseEvent>(window, 'mousemove', { capture: true }).pipe(map(e => {
if ((instant === 'direct' && !(e.ctrlKey || e.metaKey || e.altKey)) ||
(instant === 'alt' && e.altKey) ||
(instant === 'shift' && e.shiftKey) ||
(instant === 'ctrl' && (e.ctrlKey || e.metaKey))
) {
// harmless side effects
Expand Down

0 comments on commit 20a942a

Please sign in to comment.