Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
3c52e0de
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,发现更多精彩内容 >>
提交
3c52e0de
编写于
5月 10, 2017
作者:
R
rebornix
提交者:
Dirk Baeumer
5月 26, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
draft version
上级
fab8dabc
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
73 addition
and
14 deletion
+73
-14
src/vs/editor/contrib/find/browser/findWidget.css
src/vs/editor/contrib/find/browser/findWidget.css
+24
-10
src/vs/editor/contrib/find/browser/findWidget.ts
src/vs/editor/contrib/find/browser/findWidget.ts
+49
-4
未找到文件。
src/vs/editor/contrib/find/browser/findWidget.css
浏览文件 @
3c52e0de
...
@@ -51,7 +51,9 @@
...
@@ -51,7 +51,9 @@
height
:
64px
;
/* find input height + replace input height */
height
:
64px
;
/* find input height + replace input height */
}
}
.monaco-editor
.find-widget.replaceToggled
>
.replace-part
{
.monaco-editor
.find-widget.replaceToggled
>
.replace-part
{
display
:
inline-block
;
display
:
flex
;
display
:
-webkit-flex
;
align-items
:
center
;
}
}
.monaco-editor
.find-widget.visible
,
.monaco-editor
.find-widget.visible
,
...
@@ -81,6 +83,9 @@
...
@@ -81,6 +83,9 @@
.monaco-editor
.find-widget
>
.replace-part
{
.monaco-editor
.find-widget
>
.replace-part
{
margin
:
4px
0
0
17px
;
margin
:
4px
0
0
17px
;
font-size
:
12px
;
font-size
:
12px
;
display
:
flex
;
display
:
-webkit-flex
;
align-items
:
center
;
}
}
.monaco-editor
.find-widget
>
.find-part
.monaco-inputbox
,
.monaco-editor
.find-widget
>
.find-part
.monaco-inputbox
,
...
@@ -95,8 +100,9 @@
...
@@ -95,8 +100,9 @@
}
}
.monaco-editor
.find-widget
.monaco-findInput
{
.monaco-editor
.find-widget
.monaco-findInput
{
display
:
inline-block
;
vertical-align
:
middle
;
vertical-align
:
middle
;
display
:
flex
;
flex
:
1
;
}
}
.monaco-editor
.find-widget
.matchesCount
{
.monaco-editor
.find-widget
.matchesCount
{
...
@@ -111,6 +117,7 @@
...
@@ -111,6 +117,7 @@
}
}
.monaco-editor
.find-widget
.button
{
.monaco-editor
.find-widget
.button
{
min-width
:
20px
;
width
:
20px
;
width
:
20px
;
height
:
20px
;
height
:
20px
;
display
:
inline-block
;
display
:
inline-block
;
...
@@ -227,7 +234,8 @@
...
@@ -227,7 +234,8 @@
}
}
.monaco-editor
.find-widget
>
.replace-part
>
.replace-input
{
.monaco-editor
.find-widget
>
.replace-part
>
.replace-input
{
display
:
inline-block
;
display
:
flex
;
flex
:
1
;
vertical-align
:
middle
;
vertical-align
:
middle
;
}
}
...
@@ -242,12 +250,9 @@
...
@@ -242,12 +250,9 @@
}
}
/* NARROW (SMALLER THAN REDUCED) */
/* NARROW (SMALLER THAN REDUCED) */
.monaco-editor
.find-widget.narrow-find-widget
>
.find-part
.monaco-findInput
,
.monaco-editor
.find-widget.narrow-find-widget
>
.find-part
,
.monaco-editor
.find-widget.narrow-find-widget
>
.replace-part
.replace-input
{
.monaco-editor
.find-widget.narrow-find-widget
>
.replace-part
{
width
:
171px
!important
;
width
:
240px
!important
;
}
.monaco-editor
.find-widget.narrow-find-widget
>
.find-part
.monaco-inputbox
>
.wrapper
>
.input
{
width
:
105px
!important
;
}
}
/* COLLAPSED (SMALLER THAN NARROW) */
/* COLLAPSED (SMALLER THAN NARROW) */
...
@@ -258,10 +263,14 @@
...
@@ -258,10 +263,14 @@
.monaco-editor
.find-widget.collapsed-find-widget
>
.find-part
.monaco-findInput
.controls
{
.monaco-editor
.find-widget.collapsed-find-widget
>
.find-part
.monaco-findInput
.controls
{
display
:
none
;
display
:
none
;
}
}
.monaco-editor
.find-widget.collapsed-find-widget
>
.find-part
,
.monaco-editor
.find-widget.collapsed-find-widget
>
.replace-part
{
max-width
:
94px
!important
;
}
.monaco-editor
.find-widget.collapsed-find-widget
>
.find-part
.monaco-findInput
,
.monaco-editor
.find-widget.collapsed-find-widget
>
.find-part
.monaco-findInput
,
.monaco-editor
.find-widget.collapsed-find-widget
>
.replace-part
.replace-input
,
.monaco-editor
.find-widget.collapsed-find-widget
>
.replace-part
.replace-input
,
.monaco-editor
.find-widget.collapsed-find-widget
>
.find-part
.monaco-inputbox
>
.wrapper
>
.input
{
.monaco-editor
.find-widget.collapsed-find-widget
>
.find-part
.monaco-inputbox
>
.wrapper
>
.input
{
width
:
71px
!important
;
max-
width
:
71px
!important
;
}
}
.monaco-editor
.findMatch
{
.monaco-editor
.findMatch
{
...
@@ -275,6 +284,11 @@
...
@@ -275,6 +284,11 @@
animation-name
:
inherit
!important
;
animation-name
:
inherit
!important
;
}
}
.monaco-editor
.find-widget
.monaco-sash
{
background
:
grey
;
margin-left
:
-4px
;
}
.monaco-editor.hc-black
.find-widget
.previous
,
.monaco-editor.hc-black
.find-widget
.previous
,
.monaco-editor.vs-dark
.find-widget
.previous
{
.monaco-editor.vs-dark
.find-widget
.previous
{
background-image
:
url('images/previous-inverse.svg')
;
background-image
:
url('images/previous-inverse.svg')
;
...
...
src/vs/editor/contrib/find/browser/findWidget.ts
浏览文件 @
3c52e0de
...
@@ -16,6 +16,7 @@ import { IContextViewProvider } from 'vs/base/browser/ui/contextview/contextview
...
@@ -16,6 +16,7 @@ import { IContextViewProvider } from 'vs/base/browser/ui/contextview/contextview
import
{
FindInput
,
IFindInputStyles
}
from
'
vs/base/browser/ui/findinput/findInput
'
;
import
{
FindInput
,
IFindInputStyles
}
from
'
vs/base/browser/ui/findinput/findInput
'
;
import
{
IMessage
as
InputBoxMessage
,
InputBox
}
from
'
vs/base/browser/ui/inputbox/inputBox
'
;
import
{
IMessage
as
InputBoxMessage
,
InputBox
}
from
'
vs/base/browser/ui/inputbox/inputBox
'
;
import
{
Widget
}
from
'
vs/base/browser/ui/widget
'
;
import
{
Widget
}
from
'
vs/base/browser/ui/widget
'
;
import
{
Sash
,
IHorizontalSashLayoutProvider
,
ISashEvent
}
from
'
vs/base/browser/ui/sash/sash
'
;
import
{
IKeybindingService
}
from
'
vs/platform/keybinding/common/keybinding
'
;
import
{
IKeybindingService
}
from
'
vs/platform/keybinding/common/keybinding
'
;
import
{
ICodeEditor
,
IOverlayWidget
,
IOverlayWidgetPosition
,
IViewZone
,
OverlayWidgetPositionPreference
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
ICodeEditor
,
IOverlayWidget
,
IOverlayWidgetPosition
,
IViewZone
,
OverlayWidgetPositionPreference
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
FIND_IDS
,
MATCHES_LIMIT
}
from
'
vs/editor/contrib/find/common/findModel
'
;
import
{
FIND_IDS
,
MATCHES_LIMIT
}
from
'
vs/editor/contrib/find/common/findModel
'
;
...
@@ -68,7 +69,9 @@ export class FindWidgetViewZone implements IViewZone {
...
@@ -68,7 +69,9 @@ export class FindWidgetViewZone implements IViewZone {
}
}
}
}
export
class
FindWidget
extends
Widget
implements
IOverlayWidget
{
export
class
FindWidget
extends
Widget
implements
IOverlayWidget
,
IHorizontalSashLayoutProvider
{
private
static
ID
=
'
editor.contrib.findWidget
'
;
private
static
ID
=
'
editor.contrib.findWidget
'
;
private
static
PART_WIDTH
=
275
;
private
static
PART_WIDTH
=
275
;
...
@@ -104,6 +107,8 @@ export class FindWidget extends Widget implements IOverlayWidget {
...
@@ -104,6 +107,8 @@ export class FindWidget extends Widget implements IOverlayWidget {
private
_viewZone
:
FindWidgetViewZone
;
private
_viewZone
:
FindWidgetViewZone
;
private
_viewZoneId
:
number
;
private
_viewZoneId
:
number
;
private
_resizeSash
:
Sash
;
constructor
(
constructor
(
codeEditor
:
ICodeEditor
,
codeEditor
:
ICodeEditor
,
controller
:
IFindController
,
controller
:
IFindController
,
...
@@ -126,6 +131,26 @@ export class FindWidget extends Widget implements IOverlayWidget {
...
@@ -126,6 +131,26 @@ export class FindWidget extends Widget implements IOverlayWidget {
this
.
_register
(
this
.
_state
.
addChangeListener
((
e
)
=>
this
.
_onStateChanged
(
e
)));
this
.
_register
(
this
.
_state
.
addChangeListener
((
e
)
=>
this
.
_onStateChanged
(
e
)));
this
.
_buildDomNode
();
this
.
_buildDomNode
();
this
.
_resizeSash
=
new
Sash
(
this
.
_domNode
,
this
,
{
orientation
:
0
});
let
data
:
{
startX
:
number
;
};
let
originalWidth
=
411
;
this
.
_register
(
this
.
_resizeSash
.
addListener
(
'
start
'
,
(
e
:
ISashEvent
)
=>
{
data
=
{
startX
:
e
.
startX
,
};
originalWidth
=
dom
.
getTotalWidth
(
this
.
_domNode
);
}));
this
.
_register
(
this
.
_resizeSash
.
addListener
(
'
end
'
,
()
=>
{
data
=
undefined
;
}));
this
.
_register
(
this
.
_resizeSash
.
addListener
(
'
change
'
,
(
evt
:
ISashEvent
)
=>
{
if
(
data
)
{
this
.
_domNode
.
style
.
width
=
`
${
originalWidth
+
data
.
startX
-
evt
.
currentX
}
px`
;
this
.
_findInput
.
setWidth
(
FindWidget
.
FIND_INPUT_AREA_WIDTH
+
Math
.
max
(
0
,
data
.
startX
-
evt
.
currentX
));
}
}));
this
.
_updateButtons
();
this
.
_updateButtons
();
let
checkEditorWidth
=
()
=>
{
let
checkEditorWidth
=
()
=>
{
...
@@ -134,18 +159,27 @@ export class FindWidget extends Widget implements IOverlayWidget {
...
@@ -134,18 +159,27 @@ export class FindWidget extends Widget implements IOverlayWidget {
let
collapsedFindWidget
=
false
;
let
collapsedFindWidget
=
false
;
let
reducedFindWidget
=
false
;
let
reducedFindWidget
=
false
;
let
narrowFindWidget
=
false
;
let
narrowFindWidget
=
false
;
if
(
WIDGET_FIXED_WIDTH
+
28
>=
editorWidth
+
50
)
{
let
widgetWidth
=
Math
.
max
(
411
,
dom
.
getTotalWidth
(
this
.
_domNode
))
-
69
;
if
(
widgetWidth
+
28
>=
editorWidth
+
50
)
{
collapsedFindWidget
=
true
;
collapsedFindWidget
=
true
;
}
}
if
(
WIDGET_FIXED_WIDTH
+
28
>=
editorWidth
)
{
if
(
widgetWidth
+
28
>=
editorWidth
)
{
narrowFindWidget
=
true
;
narrowFindWidget
=
true
;
}
}
if
(
WIDGET_FIXED_WIDTH
+
MAX_MATCHES_COUNT_WIDTH
+
28
+
minimapWidth
>=
editorWidth
)
{
if
(
widgetWidth
+
MAX_MATCHES_COUNT_WIDTH
+
28
+
minimapWidth
>=
editorWidth
)
{
reducedFindWidget
=
true
;
reducedFindWidget
=
true
;
}
}
dom
.
toggleClass
(
this
.
_domNode
,
'
collapsed-find-widget
'
,
collapsedFindWidget
);
dom
.
toggleClass
(
this
.
_domNode
,
'
collapsed-find-widget
'
,
collapsedFindWidget
);
dom
.
toggleClass
(
this
.
_domNode
,
'
reduced-find-widget
'
,
reducedFindWidget
);
dom
.
toggleClass
(
this
.
_domNode
,
'
reduced-find-widget
'
,
reducedFindWidget
);
dom
.
toggleClass
(
this
.
_domNode
,
'
narrow-find-widget
'
,
narrowFindWidget
);
dom
.
toggleClass
(
this
.
_domNode
,
'
narrow-find-widget
'
,
narrowFindWidget
);
if
(
collapsedFindWidget
)
{
this
.
_domNode
.
style
.
maxWidth
=
'
111px
'
;
}
else
if
(
narrowFindWidget
)
{
this
.
_domNode
.
style
.
maxWidth
=
'
257px
'
;
}
else
{
this
.
_domNode
.
style
.
maxWidth
=
`
${
editorWidth
-
28
-
minimapWidth
-
15
}
px`
;
}
};
};
checkEditorWidth
();
checkEditorWidth
();
...
@@ -552,6 +586,17 @@ export class FindWidget extends Widget implements IOverlayWidget {
...
@@ -552,6 +586,17 @@ export class FindWidget extends Widget implements IOverlayWidget {
}
}
}
}
// ----- sash
public
getHorizontalSashTop
(
sash
:
Sash
):
number
{
return
0
;
}
public
getHorizontalSashLeft
?(
sash
:
Sash
):
number
{
return
0
;
}
public
getHorizontalSashWidth
?(
sash
:
Sash
):
number
{
return
500
;
}
// ----- initialization
// ----- initialization
private
_keybindingLabelFor
(
actionId
:
string
):
string
{
private
_keybindingLabelFor
(
actionId
:
string
):
string
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录