Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
e8215775
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e8215775
编写于
3月 20, 2018
作者:
P
Peng Lyu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix #45050. Replace should honor findInSelection.
上级
6bf55ba6
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
35 addition
and
19 deletion
+35
-19
src/vs/editor/contrib/find/findModel.ts
src/vs/editor/contrib/find/findModel.ts
+1
-0
src/vs/editor/contrib/find/findWidget.ts
src/vs/editor/contrib/find/findWidget.ts
+34
-19
未找到文件。
src/vs/editor/contrib/find/findModel.ts
浏览文件 @
e8215775
...
...
@@ -28,6 +28,7 @@ export const CONTEXT_FIND_WIDGET_VISIBLE = new RawContextKey<boolean>('findWidge
export
const
CONTEXT_FIND_WIDGET_NOT_VISIBLE
:
ContextKeyExpr
=
CONTEXT_FIND_WIDGET_VISIBLE
.
toNegated
();
// Keep ContextKey use of 'Focussed' to not break when clauses
export
const
CONTEXT_FIND_INPUT_FOCUSED
=
new
RawContextKey
<
boolean
>
(
'
findInputFocussed
'
,
false
);
export
const
CONTEXT_REPLACE_INPUT_FOCUSED
=
new
RawContextKey
<
boolean
>
(
'
replaceInputFocussed
'
,
false
);
export
const
ToggleCaseSensitiveKeybinding
:
IKeybindings
=
{
primary
:
KeyMod
.
Alt
|
KeyCode
.
KEY_C
,
...
...
src/vs/editor/contrib/find/findWidget.ts
浏览文件 @
e8215775
...
...
@@ -21,7 +21,7 @@ import { Widget } from 'vs/base/browser/ui/widget';
import
{
Sash
,
IHorizontalSashLayoutProvider
,
ISashEvent
,
Orientation
}
from
'
vs/base/browser/ui/sash/sash
'
;
import
{
IKeybindingService
}
from
'
vs/platform/keybinding/common/keybinding
'
;
import
{
ICodeEditor
,
IOverlayWidget
,
IOverlayWidgetPosition
,
IViewZone
,
OverlayWidgetPositionPreference
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
FIND_IDS
,
MATCHES_LIMIT
,
CONTEXT_FIND_INPUT_FOCUSED
}
from
'
vs/editor/contrib/find/findModel
'
;
import
{
FIND_IDS
,
MATCHES_LIMIT
,
CONTEXT_FIND_INPUT_FOCUSED
,
CONTEXT_REPLACE_INPUT_FOCUSED
}
from
'
vs/editor/contrib/find/findModel
'
;
import
{
FindReplaceState
,
FindReplaceStateChangedEvent
}
from
'
vs/editor/contrib/find/findState
'
;
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
IContextKeyService
,
IContextKey
}
from
'
vs/platform/contextkey/common/contextkey
'
;
...
...
@@ -104,8 +104,10 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas
private
_isVisible
:
boolean
;
private
_isReplaceVisible
:
boolean
;
private
_focusTracker
:
dom
.
IFocusTracker
;
private
_f
indF
ocusTracker
:
dom
.
IFocusTracker
;
private
_findInputFocused
:
IContextKey
<
boolean
>
;
private
_replaceFocusTracker
:
dom
.
IFocusTracker
;
private
_replaceInputFocused
:
IContextKey
<
boolean
>
;
private
_viewZone
:
FindWidgetViewZone
;
private
_viewZoneId
:
number
;
...
...
@@ -163,28 +165,25 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas
}
}));
this
.
_findInputFocused
=
CONTEXT_FIND_INPUT_FOCUSED
.
bindTo
(
contextKeyService
);
this
.
_focusTracker
=
this
.
_register
(
dom
.
trackFocus
(
this
.
_findInput
.
inputBox
.
inputElement
));
this
.
_register
(
this
.
_focusTracker
.
onDidFocus
(()
=>
{
this
.
_f
indF
ocusTracker
=
this
.
_register
(
dom
.
trackFocus
(
this
.
_findInput
.
inputBox
.
inputElement
));
this
.
_register
(
this
.
_f
indF
ocusTracker
.
onDidFocus
(()
=>
{
this
.
_findInputFocused
.
set
(
true
);
if
(
this
.
_toggleSelectionFind
.
checked
)
{
let
selection
=
this
.
_codeEditor
.
getSelection
();
if
(
selection
.
endColumn
===
1
&&
selection
.
endLineNumber
>
selection
.
startLineNumber
)
{
selection
=
selection
.
setEndPosition
(
selection
.
endLineNumber
-
1
,
1
);
}
let
currentMatch
=
this
.
_state
.
currentMatch
;
if
(
selection
.
startLineNumber
!==
selection
.
endLineNumber
)
{
if
(
!
Range
.
equalsRange
(
selection
,
currentMatch
))
{
// Reseed find scope
this
.
_state
.
change
({
searchScope
:
selection
},
true
);
}
}
}
this
.
_updateSearchScope
();
}));
this
.
_register
(
this
.
_focusTracker
.
onDidBlur
(()
=>
{
this
.
_register
(
this
.
_f
indF
ocusTracker
.
onDidBlur
(()
=>
{
this
.
_findInputFocused
.
set
(
false
);
}));
this
.
_replaceInputFocused
=
CONTEXT_REPLACE_INPUT_FOCUSED
.
bindTo
(
contextKeyService
);
this
.
_replaceFocusTracker
=
this
.
_register
(
dom
.
trackFocus
(
this
.
_replaceInputBox
.
inputElement
));
this
.
_register
(
this
.
_replaceFocusTracker
.
onDidFocus
(()
=>
{
this
.
_replaceInputFocused
.
set
(
true
);
this
.
_updateSearchScope
();
}));
this
.
_register
(
this
.
_replaceFocusTracker
.
onDidBlur
(()
=>
{
this
.
_replaceInputFocused
.
set
(
false
);
}));
this
.
_codeEditor
.
addOverlayWidget
(
this
);
this
.
_viewZone
=
new
FindWidgetViewZone
(
0
);
// Put it before the first line then users can scroll beyond the first line.
...
...
@@ -566,6 +565,22 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas
this
.
_findInput
.
highlightFindOptions
();
}
private
_updateSearchScope
():
void
{
if
(
this
.
_toggleSelectionFind
.
checked
)
{
let
selection
=
this
.
_codeEditor
.
getSelection
();
if
(
selection
.
endColumn
===
1
&&
selection
.
endLineNumber
>
selection
.
startLineNumber
)
{
selection
=
selection
.
setEndPosition
(
selection
.
endLineNumber
-
1
,
1
);
}
let
currentMatch
=
this
.
_state
.
currentMatch
;
if
(
selection
.
startLineNumber
!==
selection
.
endLineNumber
)
{
if
(
!
Range
.
equalsRange
(
selection
,
currentMatch
))
{
// Reseed find scope
this
.
_state
.
change
({
searchScope
:
selection
},
true
);
}
}
}
}
private
_onFindInputMouseDown
(
e
:
IMouseEvent
):
void
{
// on linux, middle key does pasting.
if
(
e
.
middleButton
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录