Skip to content

Commit a3d4451

Browse files
authored
Always allow ctrl+up to focus the chat list on windows (microsoft#203982)
1 parent dbd391e commit a3d4451

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

src/vs/workbench/contrib/chat/browser/actions/chatActions.ts

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import { IChatDetail, IChatService } from 'vs/workbench/contrib/chat/common/chat
3434
import { IChatWidgetHistoryService } from 'vs/workbench/contrib/chat/common/chatWidgetHistoryService';
3535
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
3636
import { LifecyclePhase } from 'vs/workbench/services/lifecycle/common/lifecycle';
37+
import { IsLinuxContext, IsWindowsContext } from 'vs/platform/contextkey/common/contextkeys';
3738

3839
export const CHAT_CATEGORY = localize2('chat.category', 'Chat');
3940
export const CHAT_OPEN_ACTION_ID = 'workbench.action.chat.open';
@@ -192,13 +193,22 @@ export function registerChatActions() {
192193
super({
193194
id: 'chat.action.focus',
194195
title: localize2('actions.interactiveSession.focus', 'Focus Chat List'),
195-
precondition: ContextKeyExpr.and(CONTEXT_IN_CHAT_INPUT, CONTEXT_CHAT_INPUT_CURSOR_AT_TOP),
196+
precondition: CONTEXT_IN_CHAT_INPUT,
196197
category: CHAT_CATEGORY,
197-
keybinding: {
198-
when: EditorContextKeys.textInputFocus,
199-
primary: KeyMod.CtrlCmd | KeyCode.UpArrow,
200-
weight: KeybindingWeight.EditorContrib
201-
}
198+
keybinding: [
199+
// On mac, require that the cursor is at the top of the input, to avoid stealing cmd+up to move the cursor to the top
200+
{
201+
when: CONTEXT_CHAT_INPUT_CURSOR_AT_TOP,
202+
primary: KeyMod.CtrlCmd | KeyCode.UpArrow,
203+
weight: KeybindingWeight.EditorContrib,
204+
},
205+
// On win/linux, ctrl+up can always focus the chat list
206+
{
207+
when: ContextKeyExpr.or(IsWindowsContext, IsLinuxContext),
208+
primary: KeyMod.CtrlCmd | KeyCode.UpArrow,
209+
weight: KeybindingWeight.EditorContrib,
210+
}
211+
]
202212
});
203213
}
204214

0 commit comments

Comments
 (0)