Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell11
提交
375e760e
D
dragonwell11
项目概览
openanolis
/
dragonwell11
通知
7
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell11
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
375e760e
编写于
11月 02, 2017
作者:
J
jlahoda
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8189595: jshell tool: line redrawn on each completion
Reviewed-by: rfield
上级
a2311204
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
37 addition
and
12 deletion
+37
-12
src/jdk.jshell/share/classes/jdk/internal/jshell/tool/ConsoleIOContext.java
...re/classes/jdk/internal/jshell/tool/ConsoleIOContext.java
+11
-7
test/langtools/jdk/jshell/ToolTabCommandTest.java
test/langtools/jdk/jshell/ToolTabCommandTest.java
+0
-4
test/langtools/jdk/jshell/ToolTabSnippetTest.java
test/langtools/jdk/jshell/ToolTabSnippetTest.java
+26
-1
未找到文件。
src/jdk.jshell/share/classes/jdk/internal/jshell/tool/ConsoleIOContext.java
浏览文件 @
375e760e
...
...
@@ -237,7 +237,11 @@ class ConsoleIOContext extends IOContext {
.
distinct
()
.
count
()
==
2
;
boolean
tooManyItems
=
suggestions
.
size
()
>
in
.
getAutoprintThreshold
();
CompletionTask
ordinaryCompletion
=
new
OrdinaryCompletionTask
(
suggestions
,
anchor
[
0
],
!
command
&&
!
doc
.
isEmpty
(),
hasSmart
);
CompletionTask
ordinaryCompletion
=
new
OrdinaryCompletionTask
(
suggestions
,
anchor
[
0
],
!
command
&&
!
doc
.
isEmpty
(),
hasBoth
);
CompletionTask
allCompletion
=
new
AllSuggestionsCompletionTask
(
suggestions
,
anchor
[
0
]);
todo
=
new
ArrayList
<>();
...
...
@@ -439,16 +443,16 @@ class ConsoleIOContext extends IOContext {
private
final
List
<
Suggestion
>
suggestions
;
private
final
int
anchor
;
private
final
boolean
cont
;
private
final
boolean
smart
;
private
final
boolean
s
howS
mart
;
public
OrdinaryCompletionTask
(
List
<
Suggestion
>
suggestions
,
int
anchor
,
boolean
cont
,
boolean
smart
)
{
boolean
s
howS
mart
)
{
this
.
suggestions
=
suggestions
;
this
.
anchor
=
anchor
;
this
.
cont
=
cont
;
this
.
s
mart
=
s
mart
;
this
.
s
howSmart
=
showS
mart
;
}
@Override
...
...
@@ -460,7 +464,7 @@ class ConsoleIOContext extends IOContext {
public
Result
perform
(
String
text
,
int
cursor
)
throws
IOException
{
List
<
CharSequence
>
toShow
;
if
(
smart
)
{
if
(
s
howS
mart
)
{
toShow
=
suggestions
.
stream
()
.
filter
(
Suggestion:
:
matchesType
)
...
...
@@ -487,7 +491,7 @@ class ConsoleIOContext extends IOContext {
String
prefixStr
=
prefix
.
orElse
(
""
).
substring
(
cursor
-
anchor
);
in
.
putString
(
prefixStr
);
boolean
showItems
=
toShow
.
size
()
>
1
||
smart
;
boolean
showItems
=
toShow
.
size
()
>
1
||
s
howS
mart
;
if
(
showItems
)
{
in
.
println
();
...
...
@@ -495,7 +499,7 @@ class ConsoleIOContext extends IOContext {
}
if
(!
prefixStr
.
isEmpty
())
return
showItems
?
Result
.
SKIP
:
Result
.
SKIP_NOREPAINT
;
return
showItems
?
Result
.
FINISH
:
Result
.
SKIP_NOREPAINT
;
return
cont
?
Result
.
CONTINUE
:
Result
.
FINISH
;
}
...
...
test/langtools/jdk/jshell/ToolTabCommandTest.java
浏览文件 @
375e760e
...
...
@@ -84,10 +84,6 @@ public class ToolTabCommandTest extends UITesting {
inputSink
.
write
(
"\u0003/env \011"
);
waitOutput
(
out
,
"\u0005/env -\n"
+
"-add-exports -add-modules -class-path -module-path \n"
+
"\r\u0005/env -"
);
inputSink
.
write
(
"\011"
);
waitOutput
(
out
,
"-add-exports -add-modules -class-path -module-path \n"
+
"\n"
+
Pattern
.
quote
(
getResource
(
"jshell.console.see.synopsis"
))
+
"\n"
+
"\r\u0005/env -"
);
...
...
test/langtools/jdk/jshell/ToolTabSnippetTest.java
浏览文件 @
375e760e
...
...
@@ -23,7 +23,7 @@
/**
* @test
* @bug 8177076 8185426
* @bug 8177076 8185426
8189595
* @modules
* jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.main
...
...
@@ -227,6 +227,31 @@ public class ToolTabSnippetTest extends UITesting {
});
}
public
void
testNoRepeat
()
throws
Exception
{
doRunTest
((
inputSink
,
out
)
->
{
inputSink
.
write
(
"String xyzAA;\n"
);
waitOutput
(
out
,
"\u0005"
);
//xyz<tab>
inputSink
.
write
(
"String s = xyz\011"
);
waitOutput
(
out
,
"^String s = xyzAA"
);
inputSink
.
write
(
"."
);
waitOutput
(
out
,
"^\\."
);
inputSink
.
write
(
"\u0003"
);
waitOutput
(
out
,
"\u0005"
);
inputSink
.
write
(
"double xyzAB;\n"
);
waitOutput
(
out
,
"\u0005"
);
//xyz<tab>
inputSink
.
write
(
"String s = xyz\011"
);
String
allCompletions
=
Pattern
.
quote
(
getResource
(
"jshell.console.completion.all.completions"
));
waitOutput
(
out
,
".*xyzAA.*"
+
allCompletions
+
".*\u0005String s = xyzA"
);
});
}
private
Path
prepareZip
()
{
String
clazz1
=
"package jshelltest;\n"
+
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录