Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
437f5cf9
V
vscode
项目概览
xxadev
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
437f5cf9
编写于
3月 26, 2018
作者:
D
Daniel Imms
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Polish command tracking, fix mac keybinding
Part of #45435
上级
bd3bcdc5
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
23 addition
and
24 deletion
+23
-24
src/vs/workbench/parts/terminal/common/terminal.ts
src/vs/workbench/parts/terminal/common/terminal.ts
+2
-2
src/vs/workbench/parts/terminal/electron-browser/terminal.contribution.ts
.../parts/terminal/electron-browser/terminal.contribution.ts
+9
-9
src/vs/workbench/parts/terminal/electron-browser/terminalActions.ts
...kbench/parts/terminal/electron-browser/terminalActions.ts
+8
-8
src/vs/workbench/parts/terminal/node/terminalCommandTracker.ts
...s/workbench/parts/terminal/node/terminalCommandTracker.ts
+4
-5
未找到文件。
src/vs/workbench/parts/terminal/common/terminal.ts
浏览文件 @
437f5cf9
...
...
@@ -448,8 +448,8 @@ export interface ITerminalInstance {
}
export
interface
ITerminalCommandTracker
{
focus
PreviousCommand
():
void
;
focus
NextCommand
():
void
;
scrollTo
PreviousCommand
():
void
;
scrollTo
NextCommand
():
void
;
selectToPreviousCommand
():
void
;
selectToNextCommand
():
void
;
}
\ No newline at end of file
src/vs/workbench/parts/terminal/electron-browser/terminal.contribution.ts
浏览文件 @
437f5cf9
...
...
@@ -18,7 +18,7 @@ import { getTerminalDefaultShellUnixLike, getTerminalDefaultShellWindows } from
import
{
IWorkbenchActionRegistry
,
Extensions
as
ActionExtensions
}
from
'
vs/workbench/common/actions
'
;
import
{
KeyCode
,
KeyMod
}
from
'
vs/base/common/keyCodes
'
;
import
{
ContextKeyExpr
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
KillTerminalAction
,
CopyTerminalSelectionAction
,
CreateNewTerminalAction
,
CreateNewInActiveWorkspaceTerminalAction
,
FocusActiveTerminalAction
,
FocusNextTerminalAction
,
FocusPreviousTerminalAction
,
SelectDefaultShellWindowsTerminalAction
,
RunSelectedTextInTerminalAction
,
RunActiveFileInTerminalAction
,
ScrollDownTerminalAction
,
ScrollDownPageTerminalAction
,
ScrollToBottomTerminalAction
,
ScrollUpTerminalAction
,
ScrollUpPageTerminalAction
,
ScrollToTopTerminalAction
,
TerminalPasteAction
,
ToggleTerminalAction
,
ClearTerminalAction
,
AllowWorkspaceShellTerminalCommand
,
DisallowWorkspaceShellTerminalCommand
,
RenameTerminalAction
,
SelectAllTerminalAction
,
FocusTerminalFindWidgetAction
,
HideTerminalFindWidgetAction
,
ShowNextFindTermTerminalFindWidgetAction
,
ShowPreviousFindTermTerminalFindWidgetAction
,
DeleteWordLeftTerminalAction
,
DeleteWordRightTerminalAction
,
QuickOpenActionTermContributor
,
QuickOpenTermAction
,
TERMINAL_PICKER_PREFIX
,
MoveToLineStartTerminalAction
,
MoveToLineEndTerminalAction
,
SplitTerminalAction
,
FocusPreviousPaneTerminalAction
,
FocusNextPaneTerminalAction
,
ResizePaneLeftTerminalAction
,
ResizePaneRightTerminalAction
,
ResizePaneUpTerminalAction
,
ResizePaneDownTerminalAction
,
FocusPreviousCommandAction
,
Focus
NextCommandAction
,
SelectToPreviousCommandAction
,
SelectToNextCommandAction
}
from
'
vs/workbench/parts/terminal/electron-browser/terminalActions
'
;
import
{
KillTerminalAction
,
CopyTerminalSelectionAction
,
CreateNewTerminalAction
,
CreateNewInActiveWorkspaceTerminalAction
,
FocusActiveTerminalAction
,
FocusNextTerminalAction
,
FocusPreviousTerminalAction
,
SelectDefaultShellWindowsTerminalAction
,
RunSelectedTextInTerminalAction
,
RunActiveFileInTerminalAction
,
ScrollDownTerminalAction
,
ScrollDownPageTerminalAction
,
ScrollToBottomTerminalAction
,
ScrollUpTerminalAction
,
ScrollUpPageTerminalAction
,
ScrollToTopTerminalAction
,
TerminalPasteAction
,
ToggleTerminalAction
,
ClearTerminalAction
,
AllowWorkspaceShellTerminalCommand
,
DisallowWorkspaceShellTerminalCommand
,
RenameTerminalAction
,
SelectAllTerminalAction
,
FocusTerminalFindWidgetAction
,
HideTerminalFindWidgetAction
,
ShowNextFindTermTerminalFindWidgetAction
,
ShowPreviousFindTermTerminalFindWidgetAction
,
DeleteWordLeftTerminalAction
,
DeleteWordRightTerminalAction
,
QuickOpenActionTermContributor
,
QuickOpenTermAction
,
TERMINAL_PICKER_PREFIX
,
MoveToLineStartTerminalAction
,
MoveToLineEndTerminalAction
,
SplitTerminalAction
,
FocusPreviousPaneTerminalAction
,
FocusNextPaneTerminalAction
,
ResizePaneLeftTerminalAction
,
ResizePaneRightTerminalAction
,
ResizePaneUpTerminalAction
,
ResizePaneDownTerminalAction
,
ScrollToPreviousCommandAction
,
ScrollTo
NextCommandAction
,
SelectToPreviousCommandAction
,
SelectToNextCommandAction
}
from
'
vs/workbench/parts/terminal/electron-browser/terminalActions
'
;
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
import
{
ShowAllCommandsAction
}
from
'
vs/workbench/parts/quickopen/browser/commandsHandler
'
;
import
{
SyncActionDescriptor
}
from
'
vs/platform/actions/common/actions
'
;
...
...
@@ -280,8 +280,8 @@ configurationRegistry.registerConfiguration({
ResizePaneRightTerminalAction
.
ID
,
ResizePaneUpTerminalAction
.
ID
,
ResizePaneDownTerminalAction
.
ID
,
Focus
PreviousCommandAction
.
ID
,
Focus
NextCommandAction
.
ID
,
ScrollTo
PreviousCommandAction
.
ID
,
ScrollTo
NextCommandAction
.
ID
,
SelectToPreviousCommandAction
.
ID
,
SelectToNextCommandAction
.
ID
].
sort
()
...
...
@@ -372,7 +372,7 @@ actionRegistry.registerWorkbenchAction(new SyncActionDescriptor(ToggleTerminalAc
mac
:
{
primary
:
KeyMod
.
WinCtrl
|
KeyCode
.
US_BACKTICK
}
}),
'
View: Toggle Integrated Terminal
'
,
nls
.
localize
(
'
viewCategory
'
,
"
View
"
));
actionRegistry
.
registerWorkbenchAction
(
new
SyncActionDescriptor
(
ScrollDownTerminalAction
,
ScrollDownTerminalAction
.
ID
,
ScrollDownTerminalAction
.
LABEL
,
{
primary
:
KeyMod
.
CtrlCmd
|
Key
Code
.
DownArrow
,
primary
:
KeyMod
.
CtrlCmd
|
Key
Mod
.
Alt
|
KeyCode
.
PageDown
,
linux
:
{
primary
:
KeyMod
.
CtrlCmd
|
KeyMod
.
Shift
|
KeyCode
.
DownArrow
}
},
KEYBINDING_CONTEXT_TERMINAL_FOCUS
),
'
Terminal: Scroll Down (Line)
'
,
category
);
actionRegistry
.
registerWorkbenchAction
(
new
SyncActionDescriptor
(
ScrollDownPageTerminalAction
,
ScrollDownPageTerminalAction
.
ID
,
ScrollDownPageTerminalAction
.
LABEL
,
{
...
...
@@ -384,7 +384,7 @@ actionRegistry.registerWorkbenchAction(new SyncActionDescriptor(ScrollToBottomTe
linux
:
{
primary
:
KeyMod
.
Shift
|
KeyCode
.
End
}
},
KEYBINDING_CONTEXT_TERMINAL_FOCUS
),
'
Terminal: Scroll to Bottom
'
,
category
);
actionRegistry
.
registerWorkbenchAction
(
new
SyncActionDescriptor
(
ScrollUpTerminalAction
,
ScrollUpTerminalAction
.
ID
,
ScrollUpTerminalAction
.
LABEL
,
{
primary
:
KeyMod
.
CtrlCmd
|
Key
Code
.
UpArrow
,
primary
:
KeyMod
.
CtrlCmd
|
Key
Mod
.
Alt
|
KeyCode
.
PageUp
,
linux
:
{
primary
:
KeyMod
.
CtrlCmd
|
KeyMod
.
Shift
|
KeyCode
.
UpArrow
},
},
KEYBINDING_CONTEXT_TERMINAL_FOCUS
),
'
Terminal: Scroll Up (Line)
'
,
category
);
actionRegistry
.
registerWorkbenchAction
(
new
SyncActionDescriptor
(
ScrollUpPageTerminalAction
,
ScrollUpPageTerminalAction
.
ID
,
ScrollUpPageTerminalAction
.
LABEL
,
{
...
...
@@ -478,14 +478,14 @@ actionRegistry.registerWorkbenchAction(new SyncActionDescriptor(ResizePaneDownTe
linux
:
{
primary
:
KeyMod
.
CtrlCmd
|
KeyMod
.
Shift
|
KeyCode
.
DownArrow
},
mac
:
{
primary
:
KeyMod
.
CtrlCmd
|
KeyMod
.
WinCtrl
|
KeyCode
.
DownArrow
}
},
KEYBINDING_CONTEXT_TERMINAL_FOCUS
),
'
Terminal: Resize Pane Down
'
,
category
);
actionRegistry
.
registerWorkbenchAction
(
new
SyncActionDescriptor
(
FocusPreviousCommandAction
,
FocusPreviousCommandAction
.
ID
,
Focus
PreviousCommandAction
.
LABEL
,
{
actionRegistry
.
registerWorkbenchAction
(
new
SyncActionDescriptor
(
ScrollToPreviousCommandAction
,
ScrollToPreviousCommandAction
.
ID
,
ScrollTo
PreviousCommandAction
.
LABEL
,
{
primary
:
null
,
mac
:
{
primary
:
KeyMod
.
CtrlCmd
|
KeyCode
.
UpArrow
}
},
KEYBINDING_CONTEXT_TERMINAL_FOCUS
),
'
Terminal:
Focus
Previous Command
'
,
category
);
actionRegistry
.
registerWorkbenchAction
(
new
SyncActionDescriptor
(
FocusNextCommandAction
,
FocusNextCommandAction
.
ID
,
Focus
NextCommandAction
.
LABEL
,
{
},
KEYBINDING_CONTEXT_TERMINAL_FOCUS
),
'
Terminal:
Scroll To
Previous Command
'
,
category
);
actionRegistry
.
registerWorkbenchAction
(
new
SyncActionDescriptor
(
ScrollToNextCommandAction
,
ScrollToNextCommandAction
.
ID
,
ScrollTo
NextCommandAction
.
LABEL
,
{
primary
:
null
,
mac
:
{
primary
:
KeyMod
.
CtrlCmd
|
KeyCode
.
DownArrow
}
},
KEYBINDING_CONTEXT_TERMINAL_FOCUS
),
'
Terminal:
Focus
Next Command
'
,
category
);
},
KEYBINDING_CONTEXT_TERMINAL_FOCUS
),
'
Terminal:
Scroll To
Next Command
'
,
category
);
actionRegistry
.
registerWorkbenchAction
(
new
SyncActionDescriptor
(
SelectToPreviousCommandAction
,
SelectToPreviousCommandAction
.
ID
,
SelectToPreviousCommandAction
.
LABEL
,
{
primary
:
null
,
mac
:
{
primary
:
KeyMod
.
CtrlCmd
|
KeyMod
.
Shift
|
KeyCode
.
UpArrow
}
...
...
src/vs/workbench/parts/terminal/electron-browser/terminalActions.ts
浏览文件 @
437f5cf9
...
...
@@ -982,9 +982,9 @@ export class RenameTerminalQuickOpenAction extends RenameTerminalAction {
}
}
export
class
Focus
PreviousCommandAction
extends
Action
{
public
static
readonly
ID
=
'
workbench.action.terminal.
focus
PreviousCommand
'
;
public
static
readonly
LABEL
=
nls
.
localize
(
'
workbench.action.terminal.
focusPreviousCommand
'
,
"
Focus
Previous Command
"
);
export
class
ScrollTo
PreviousCommandAction
extends
Action
{
public
static
readonly
ID
=
'
workbench.action.terminal.
scrollTo
PreviousCommand
'
;
public
static
readonly
LABEL
=
nls
.
localize
(
'
workbench.action.terminal.
scrollToPreviousCommand
'
,
"
Scroll To
Previous Command
"
);
constructor
(
id
:
string
,
label
:
string
,
...
...
@@ -996,15 +996,15 @@ export class FocusPreviousCommandAction extends Action {
public
run
():
TPromise
<
any
>
{
const
instance
=
this
.
terminalService
.
getActiveInstance
();
if
(
instance
)
{
instance
.
commandTracker
.
focus
PreviousCommand
();
instance
.
commandTracker
.
scrollTo
PreviousCommand
();
}
return
TPromise
.
as
(
void
0
);
}
}
export
class
Focus
NextCommandAction
extends
Action
{
public
static
readonly
ID
=
'
workbench.action.terminal.
focus
NextCommand
'
;
public
static
readonly
LABEL
=
nls
.
localize
(
'
workbench.action.terminal.
focusNextCommand
'
,
"
Focus
Next Command
"
);
export
class
ScrollTo
NextCommandAction
extends
Action
{
public
static
readonly
ID
=
'
workbench.action.terminal.
scrollTo
NextCommand
'
;
public
static
readonly
LABEL
=
nls
.
localize
(
'
workbench.action.terminal.
scrollToNextCommand
'
,
"
Scroll To
Next Command
"
);
constructor
(
id
:
string
,
label
:
string
,
...
...
@@ -1016,7 +1016,7 @@ export class FocusNextCommandAction extends Action {
public
run
():
TPromise
<
any
>
{
const
instance
=
this
.
terminalService
.
getActiveInstance
();
if
(
instance
)
{
instance
.
commandTracker
.
focus
NextCommand
();
instance
.
commandTracker
.
scrollTo
NextCommand
();
}
return
TPromise
.
as
(
void
0
);
}
...
...
src/vs/workbench/parts/terminal/node/terminalCommandTracker.ts
浏览文件 @
437f5cf9
...
...
@@ -43,7 +43,7 @@ export class TerminalCommandTracker implements ITerminalCommandTracker {
}
}
public
focus
PreviousCommand
(
retainSelection
:
boolean
=
false
):
void
{
public
scrollTo
PreviousCommand
(
retainSelection
:
boolean
=
false
):
void
{
if
(
!
retainSelection
)
{
this
.
_selectionStart
=
null
;
}
...
...
@@ -67,7 +67,7 @@ export class TerminalCommandTracker implements ITerminalCommandTracker {
this
.
_xterm
.
scrollToLine
(
this
.
_currentMarker
.
line
);
}
public
focus
NextCommand
(
retainSelection
:
boolean
=
false
):
void
{
public
scrollTo
NextCommand
(
retainSelection
:
boolean
=
false
):
void
{
if
(
!
retainSelection
)
{
this
.
_selectionStart
=
null
;
}
...
...
@@ -95,7 +95,7 @@ export class TerminalCommandTracker implements ITerminalCommandTracker {
if
(
this
.
_selectionStart
===
null
)
{
this
.
_selectionStart
=
this
.
_currentMarker
;
}
this
.
focus
PreviousCommand
(
true
);
this
.
scrollTo
PreviousCommand
(
true
);
this
.
_selectLines
(
this
.
_currentMarker
,
this
.
_selectionStart
);
}
...
...
@@ -103,8 +103,7 @@ export class TerminalCommandTracker implements ITerminalCommandTracker {
if
(
this
.
_selectionStart
===
null
)
{
this
.
_selectionStart
=
this
.
_currentMarker
;
}
this
.
focusNextCommand
(
true
);
// if (!this._currentMarker
this
.
scrollToNextCommand
(
true
);
this
.
_selectLines
(
this
.
_currentMarker
,
this
.
_selectionStart
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录