Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
8c76afad
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,发现更多精彩内容 >>
未验证
提交
8c76afad
编写于
11月 13, 2020
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fixes #108160: Handle padding in mouse target computation
上级
9d389f03
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
39 addition
and
1 deletion
+39
-1
src/vs/editor/browser/controller/mouseTarget.ts
src/vs/editor/browser/controller/mouseTarget.ts
+13
-1
src/vs/editor/common/viewLayout/linesLayout.ts
src/vs/editor/common/viewLayout/linesLayout.ts
+17
-0
src/vs/editor/common/viewLayout/viewLayout.ts
src/vs/editor/common/viewLayout/viewLayout.ts
+7
-0
src/vs/editor/common/viewModel/viewModel.ts
src/vs/editor/common/viewModel/viewModel.ts
+2
-0
未找到文件。
src/vs/editor/browser/controller/mouseTarget.ts
浏览文件 @
8c76afad
...
...
@@ -329,6 +329,14 @@ export class HitTestContext {
return
this
.
_context
.
viewLayout
.
isAfterLines
(
mouseVerticalOffset
);
}
public
isInTopPadding
(
mouseVerticalOffset
:
number
):
boolean
{
return
this
.
_context
.
viewLayout
.
isInTopPadding
(
mouseVerticalOffset
);
}
public
isInBottomPadding
(
mouseVerticalOffset
:
number
):
boolean
{
return
this
.
_context
.
viewLayout
.
isInBottomPadding
(
mouseVerticalOffset
);
}
public
getVerticalOffsetForLineNumber
(
lineNumber
:
number
):
number
{
return
this
.
_context
.
viewLayout
.
getVerticalOffsetForLineNumber
(
lineNumber
);
}
...
...
@@ -656,8 +664,12 @@ export class MouseTargetFactory {
return
null
;
}
if
(
ctx
.
isInTopPadding
(
request
.
mouseVerticalOffset
))
{
return
request
.
fulfill
(
MouseTargetType
.
CONTENT_EMPTY
,
new
Position
(
1
,
1
),
undefined
,
EMPTY_CONTENT_AFTER_LINES
);
}
// Check if it is below any lines and any view zones
if
(
ctx
.
isAfterLines
(
request
.
mouseVerticalOffset
))
{
if
(
ctx
.
isAfterLines
(
request
.
mouseVerticalOffset
)
||
ctx
.
isInBottomPadding
(
request
.
mouseVerticalOffset
)
)
{
// This most likely indicates it happened after the last view-line
const
lineCount
=
ctx
.
model
.
getLineCount
();
const
maxLineColumn
=
ctx
.
model
.
getLineMaxColumn
(
lineCount
);
...
...
src/vs/editor/common/viewLayout/linesLayout.ts
浏览文件 @
8c76afad
...
...
@@ -546,6 +546,23 @@ export class LinesLayout {
return
verticalOffset
>
totalHeight
;
}
public
isInTopPadding
(
verticalOffset
:
number
):
boolean
{
if
(
this
.
_paddingTop
===
0
)
{
return
false
;
}
this
.
_checkPendingChanges
();
return
(
verticalOffset
<
this
.
_paddingTop
);
}
public
isInBottomPadding
(
verticalOffset
:
number
):
boolean
{
if
(
this
.
_paddingBottom
===
0
)
{
return
false
;
}
this
.
_checkPendingChanges
();
const
totalHeight
=
this
.
getLinesTotalHeight
();
return
(
verticalOffset
>=
totalHeight
-
this
.
_paddingBottom
);
}
/**
* Find the first line number that is at or after vertical offset `verticalOffset`.
* i.e. if getVerticalOffsetForLine(line) is x and getVerticalOffsetForLine(line + 1) is y, then
...
...
src/vs/editor/common/viewLayout/viewLayout.ts
浏览文件 @
8c76afad
...
...
@@ -364,6 +364,13 @@ export class ViewLayout extends Disposable implements IViewLayout {
public
isAfterLines
(
verticalOffset
:
number
):
boolean
{
return
this
.
_linesLayout
.
isAfterLines
(
verticalOffset
);
}
public
isInTopPadding
(
verticalOffset
:
number
):
boolean
{
return
this
.
_linesLayout
.
isInTopPadding
(
verticalOffset
);
}
isInBottomPadding
(
verticalOffset
:
number
):
boolean
{
return
this
.
_linesLayout
.
isInBottomPadding
(
verticalOffset
);
}
public
getLineNumberAtVerticalOffset
(
verticalOffset
:
number
):
number
{
return
this
.
_linesLayout
.
getLineNumberAtOrAfterVerticalOffset
(
verticalOffset
);
}
...
...
src/vs/editor/common/viewModel/viewModel.ts
浏览文件 @
8c76afad
...
...
@@ -61,6 +61,8 @@ export interface IViewLayout {
getWhitespaces
():
IEditorWhitespace
[];
isAfterLines
(
verticalOffset
:
number
):
boolean
;
isInTopPadding
(
verticalOffset
:
number
):
boolean
;
isInBottomPadding
(
verticalOffset
:
number
):
boolean
;
getLineNumberAtVerticalOffset
(
verticalOffset
:
number
):
number
;
getVerticalOffsetForLineNumber
(
lineNumber
:
number
):
number
;
getWhitespaceAtVerticalOffset
(
verticalOffset
:
number
):
IViewWhitespaceViewportData
|
null
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录