Skip to content

Commit 6f6e530

Browse files
committed
fix(dev): close the help view with ? as well as h
1 parent 34714dc commit 6f6e530

3 files changed

Lines changed: 10 additions & 2 deletions

File tree

‎packages/nuxt-cli/src/dev/tui/help-overlay.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export class HelpOverlay extends ScreenOverlay {
2323
}
2424

2525
protectedgetcloseKeys(): readonlystring[]{
26-
return['h']
26+
return['h','?']
2727
}
2828

2929
protectedrenderTitle(): string{

‎packages/nuxt-cli/src/dev/tui/screen.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ export abstract class ScreenOverlay {
163163
voidthis.#copySelected()
164164
return
165165
default:
166-
if(key.name&&this.closeKeys.includes(key.name)){
166+
if((key.name&&this.closeKeys.includes(key.name))||(key.sequence&&this.closeKeys.includes(key.sequence))){
167167
returnthis.close()
168168
}
169169
if(!this.handleViewKey(key)){

‎packages/nuxt-cli/test/unit/dev-tui.spec.ts‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1416,6 +1416,14 @@ describe('help overlay', () => {
14161416
expect(overlay.isOpen).toBe(false)
14171417
expect(closed()).toBe(1)
14181418
})
1419+
1420+
it('closes on ? as well, the key that opened it',()=>{
1421+
const{ overlay, closed }=create()
1422+
overlay.open()
1423+
overlay.handleKey({sequence: '?'})
1424+
expect(overlay.isOpen).toBe(false)
1425+
expect(closed()).toBe(1)
1426+
})
14191427
})
14201428

14211429
describe('info overlay',()=>{

0 commit comments

Comments
 (0)