Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
99a6160b
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,发现更多精彩内容 >>
提交
99a6160b
编写于
3月 23, 2017
作者:
R
rebornix
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Mitigate #22900. Use setInterval instead of animation for blinking on mac and linux.
上级
209f12a0
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
25 addition
and
6 deletion
+25
-6
src/vs/editor/browser/viewParts/viewCursors/viewCursors.css
src/vs/editor/browser/viewParts/viewCursors/viewCursors.css
+1
-1
src/vs/editor/browser/viewParts/viewCursors/viewCursors.ts
src/vs/editor/browser/viewParts/viewCursors/viewCursors.ts
+24
-5
未找到文件。
src/vs/editor/browser/viewParts/viewCursors/viewCursors.css
浏览文件 @
99a6160b
...
...
@@ -81,7 +81,7 @@
}
}
.cursor-blink
{
.
windows
.
cursor-blink
{
animation
:
monaco-cursor-blink
1s
step-start
0s
infinite
;
}
...
...
src/vs/editor/browser/viewParts/viewCursors/viewCursors.ts
浏览文件 @
99a6160b
...
...
@@ -7,6 +7,7 @@
import
'
vs/css!./viewCursors
'
;
import
*
as
editorCommon
from
'
vs/editor/common/editorCommon
'
;
import
{
isWindows
}
from
'
vs/base/common/platform
'
;
import
{
ClassNames
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
ViewPart
}
from
'
vs/editor/browser/view/viewPart
'
;
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
...
...
@@ -14,7 +15,7 @@ import { IViewCursorRenderData, ViewCursor } from 'vs/editor/browser/viewParts/v
import
{
ViewContext
}
from
'
vs/editor/common/view/viewContext
'
;
import
{
RenderingContext
,
RestrictedRenderingContext
}
from
'
vs/editor/common/view/renderingContext
'
;
import
{
FastDomNode
,
createFastDomNode
}
from
'
vs/base/browser/fastDomNode
'
;
import
{
TimeoutTimer
}
from
'
vs/base/common/async
'
;
import
{
TimeoutTimer
,
IntervalTimer
}
from
'
vs/base/common/async
'
;
import
*
as
viewEvents
from
'
vs/editor/common/view/viewEvents
'
;
import
{
registerThemingParticipant
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
editorCursor
}
from
'
vs/editor/common/view/editorColorRegistry
'
;
...
...
@@ -33,6 +34,7 @@ export class ViewCursors extends ViewPart {
private
_domNode
:
FastDomNode
<
HTMLElement
>
;
private
_startCursorBlinkAnimation
:
TimeoutTimer
;
private
_cursorFlatBlinkInterval
:
IntervalTimer
;
private
_blinkingEnabled
:
boolean
;
private
_editorHasFocus
:
boolean
;
...
...
@@ -59,6 +61,8 @@ export class ViewCursors extends ViewPart {
this
.
_domNode
.
domNode
.
appendChild
(
this
.
_primaryCursor
.
getDomNode
());
this
.
_startCursorBlinkAnimation
=
new
TimeoutTimer
();
this
.
_cursorFlatBlinkInterval
=
new
IntervalTimer
();
this
.
_blinkingEnabled
=
false
;
this
.
_editorHasFocus
=
false
;
...
...
@@ -68,6 +72,7 @@ export class ViewCursors extends ViewPart {
public
dispose
():
void
{
super
.
dispose
();
this
.
_startCursorBlinkAnimation
.
dispose
();
this
.
_cursorFlatBlinkInterval
.
dispose
();
}
public
getDomNode
():
HTMLElement
{
...
...
@@ -206,6 +211,7 @@ export class ViewCursors extends ViewPart {
private
_updateBlinking
():
void
{
this
.
_startCursorBlinkAnimation
.
cancel
();
this
.
_cursorFlatBlinkInterval
.
cancel
();
let
blinkingStyle
=
this
.
_getCursorBlinking
();
...
...
@@ -213,6 +219,9 @@ export class ViewCursors extends ViewPart {
let
isHidden
=
(
blinkingStyle
===
editorCommon
.
TextEditorCursorBlinkingStyle
.
Hidden
);
let
isSolid
=
(
blinkingStyle
===
editorCommon
.
TextEditorCursorBlinkingStyle
.
Solid
);
// flat blinking is handled by JavaScript on Mac and Linux to save battery life due to Chromium step timing issue https://bugs.chromium.org/p/chromium/issues/detail?id=361587
let
isFlatBlinkingOnInx
=
(
blinkingStyle
===
editorCommon
.
TextEditorCursorBlinkingStyle
.
Blink
)
&&
!
isWindows
;
if
(
isHidden
)
{
this
.
_hide
();
}
else
{
...
...
@@ -223,10 +232,20 @@ export class ViewCursors extends ViewPart {
this
.
_updateDomClassName
();
if
(
!
isHidden
&&
!
isSolid
)
{
this
.
_startCursorBlinkAnimation
.
setIfNotSet
(()
=>
{
this
.
_blinkingEnabled
=
true
;
this
.
_updateDomClassName
();
},
ViewCursors
.
BLINK_INTERVAL
);
if
(
isFlatBlinkingOnInx
)
{
this
.
_cursorFlatBlinkInterval
.
cancelAndSet
(()
=>
{
if
(
this
.
_isVisible
)
{
this
.
_hide
();
}
else
{
this
.
_show
();
}
},
ViewCursors
.
BLINK_INTERVAL
);
}
else
{
this
.
_startCursorBlinkAnimation
.
setIfNotSet
(()
=>
{
this
.
_blinkingEnabled
=
true
;
this
.
_updateDomClassName
();
},
ViewCursors
.
BLINK_INTERVAL
);
}
}
}
// --- end blinking logic
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录