Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
后端镜像
Tabby
提交
46720e32
T
Tabby
项目概览
后端镜像
/
Tabby
通知
38
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Tabby
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
46720e32
编写于
6月 05, 2019
作者:
E
Eugene Pankov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
webgl test
上级
c3693f5d
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
271 addition
and
13 deletion
+271
-13
terminus-terminal/package.json
terminus-terminal/package.json
+1
-1
terminus-terminal/src/frontends/xterm.css
terminus-terminal/src/frontends/xterm.css
+174
-0
terminus-terminal/src/frontends/xtermAddonFit.ts
terminus-terminal/src/frontends/xtermAddonFit.ts
+79
-0
terminus-terminal/src/frontends/xtermFrontend.ts
terminus-terminal/src/frontends/xtermFrontend.ts
+12
-6
terminus-terminal/src/services/sessions.service.ts
terminus-terminal/src/services/sessions.service.ts
+2
-2
terminus-terminal/yarn.lock
terminus-terminal/yarn.lock
+3
-4
未找到文件。
terminus-terminal/package.json
浏览文件 @
46720e32
...
...
@@ -27,7 +27,7 @@
"file-loader"
:
"^0.11.2"
,
"slug"
:
"^1.1.0"
,
"uuid"
:
"^3.3.2"
,
"xterm"
:
"
3.14.2
"
,
"xterm"
:
"
https://registry.npmjs.org/@terminus-term/xterm/-/xterm-3.14.1.tgz
"
,
"xterm-addon-ligatures"
:
"^0.1.0-beta-2"
},
"peerDependencies"
:
{
...
...
terminus-terminal/src/frontends/xterm.css
浏览文件 @
46720e32
/**
* Copyright (c) 2014 The xterm.js authors. All rights reserved.
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
* https://github.com/chjj/term.js
* @license MIT
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Originally forked from (with the author's permission):
* Fabrice Bellard's javascript vt100 for jslinux:
* http://bellard.org/jslinux/
* Copyright (c) 2011 Fabrice Bellard
* The original design remains. The terminal itself
* has been extended to include xterm CSI codes, among
* other features.
*/
/**
* Default styles for xterm.js
*/
.xterm
{
font-feature-settings
:
"liga"
0
;
position
:
relative
;
user-select
:
none
;
-ms-user-select
:
none
;
-webkit-user-select
:
none
;
}
.xterm.focus
,
.xterm
:focus
{
outline
:
none
;
}
.xterm
.xterm-helpers
{
position
:
absolute
;
top
:
0
;
/**
* The z-index of the helpers must be higher than the canvases in order for
* IMEs to appear on top.
*/
z-index
:
10
;
}
.xterm
.xterm-helper-textarea
{
/*
* HACK: to fix IE's blinking cursor
* Move textarea out of the screen to the far left, so that the cursor is not visible.
*/
position
:
absolute
;
opacity
:
0
;
left
:
-9999em
;
top
:
0
;
width
:
0
;
height
:
0
;
z-index
:
-10
;
/** Prevent wrapping so the IME appears against the textarea at the correct position */
white-space
:
nowrap
;
overflow
:
hidden
;
resize
:
none
;
}
.xterm
.composition-view
{
/* TODO: Composition position got messed up somewhere */
background
:
#000
;
color
:
#FFF
;
display
:
none
;
position
:
absolute
;
white-space
:
nowrap
;
z-index
:
1
;
}
.xterm
.composition-view.active
{
display
:
block
;
}
.xterm
.xterm-viewport
{
/* On OS X this is required in order for the scroll bar to appear fully opaque */
background-color
:
#000
;
overflow-y
:
scroll
;
cursor
:
default
;
position
:
absolute
;
right
:
0
;
left
:
0
;
top
:
0
;
bottom
:
0
;
}
.xterm
.xterm-screen
{
position
:
relative
;
}
.xterm
.xterm-screen
canvas
{
position
:
absolute
;
left
:
0
;
top
:
0
;
}
.xterm
.xterm-scroll-area
{
visibility
:
hidden
;
}
.xterm-char-measure-element
{
display
:
inline-block
;
visibility
:
hidden
;
position
:
absolute
;
top
:
0
;
left
:
-9999em
;
line-height
:
normal
;
}
.xterm
{
cursor
:
text
;
}
.xterm.enable-mouse-events
{
/* When mouse events are enabled (eg. tmux), revert to the standard pointer cursor */
cursor
:
default
;
}
.xterm.xterm-cursor-pointer
{
cursor
:
pointer
;
}
.xterm.column-select.focus
{
/* Column selection mode */
cursor
:
crosshair
;
}
.xterm
.xterm-accessibility
,
.xterm
.xterm-message
{
position
:
absolute
;
left
:
0
;
top
:
0
;
bottom
:
0
;
right
:
0
;
z-index
:
100
;
color
:
transparent
;
}
.xterm
.live-region
{
position
:
absolute
;
left
:
-9999px
;
width
:
1px
;
height
:
1px
;
overflow
:
hidden
;
}
.xterm-dim
{
opacity
:
0.5
;
}
.xterm-underline
{
text-decoration
:
underline
;
}
/*----*/
.xterm-viewport
::-webkit-scrollbar
{
background
:
rgba
(
0
,
0
,
0
,
.125
);
}
...
...
terminus-terminal/src/frontends/xtermAddonFit.ts
0 → 100644
浏览文件 @
46720e32
/**
* Copyright (c) 2017 The xterm.js authors. All rights reserved.
* @license MIT
*/
import
{
Terminal
,
ITerminalAddon
}
from
'
xterm
'
;
interface
ITerminalDimensions
{
/**
* The number of rows in the terminal.
*/
rows
:
number
;
/**
* The number of columns in the terminal.
*/
cols
:
number
;
}
export
class
FitAddon
implements
ITerminalAddon
{
private
_terminal
:
Terminal
|
undefined
;
constructor
()
{}
public
activate
(
terminal
:
Terminal
):
void
{
this
.
_terminal
=
terminal
;
}
public
dispose
():
void
{}
public
fit
():
void
{
const
dims
=
this
.
proposeDimensions
();
if
(
!
dims
||
!
this
.
_terminal
)
{
return
;
}
// TODO: Remove reliance on private API
const
core
=
(
<
any
>
this
.
_terminal
).
_core
;
// Force a full render
if
(
this
.
_terminal
.
rows
!==
dims
.
rows
||
this
.
_terminal
.
cols
!==
dims
.
cols
)
{
core
.
_renderCoordinator
.
clear
();
this
.
_terminal
.
resize
(
dims
.
cols
,
dims
.
rows
);
}
}
public
proposeDimensions
():
ITerminalDimensions
|
undefined
{
if
(
!
this
.
_terminal
)
{
return
undefined
;
}
if
(
!
this
.
_terminal
.
element
.
parentElement
)
{
return
undefined
;
}
// TODO: Remove reliance on private API
const
core
=
(
<
any
>
this
.
_terminal
).
_core
;
const
parentElementStyle
=
window
.
getComputedStyle
(
this
.
_terminal
.
element
.
parentElement
);
const
parentElementHeight
=
parseInt
(
parentElementStyle
.
getPropertyValue
(
'
height
'
));
const
parentElementWidth
=
Math
.
max
(
0
,
parseInt
(
parentElementStyle
.
getPropertyValue
(
'
width
'
)));
const
elementStyle
=
window
.
getComputedStyle
(
this
.
_terminal
.
element
);
const
elementPadding
=
{
top
:
parseInt
(
elementStyle
.
getPropertyValue
(
'
padding-top
'
)),
bottom
:
parseInt
(
elementStyle
.
getPropertyValue
(
'
padding-bottom
'
)),
right
:
parseInt
(
elementStyle
.
getPropertyValue
(
'
padding-right
'
)),
left
:
parseInt
(
elementStyle
.
getPropertyValue
(
'
padding-left
'
))
};
const
elementPaddingVer
=
elementPadding
.
top
+
elementPadding
.
bottom
;
const
elementPaddingHor
=
elementPadding
.
right
+
elementPadding
.
left
;
const
availableHeight
=
parentElementHeight
-
elementPaddingVer
;
const
availableWidth
=
parentElementWidth
-
elementPaddingHor
-
core
.
viewport
.
scrollBarWidth
;
const
geometry
=
{
cols
:
Math
.
floor
(
availableWidth
/
core
.
_renderCoordinator
.
dimensions
.
actualCellWidth
),
rows
:
Math
.
floor
(
availableHeight
/
core
.
_renderCoordinator
.
dimensions
.
actualCellHeight
)
};
return
geometry
;
}
}
terminus-terminal/src/frontends/xtermFrontend.ts
浏览文件 @
46720e32
import
{
Frontend
}
from
'
./frontend
'
import
{
Terminal
,
ITheme
}
from
'
xterm
'
import
{
fit
}
from
'
xterm/src/addons/fit/f
it
'
import
{
FitAddon
}
from
'
./xtermAddonF
it
'
import
{
enableLigatures
}
from
'
xterm-addon-ligatures
'
import
'
xterm/lib/xterm.css
'
import
'
./xterm.css
'
import
deepEqual
=
require
(
'
deep-equal
'
)
...
...
@@ -16,13 +15,13 @@ export class XTermFrontend extends Frontend {
private
resizeHandler
:
()
=>
void
private
configuredTheme
:
ITheme
=
{}
private
copyOnSelect
=
false
private
fitAddon
=
new
FitAddon
()
private
opened
=
false
constructor
()
{
super
()
this
.
xterm
=
new
Terminal
({
allowTransparency
:
true
,
enableBold
:
true
,
experimentalCharAtlas
:
'
dynamic
'
,
})
this
.
xtermCore
=
(
this
.
xterm
as
any
).
_core
...
...
@@ -40,6 +39,7 @@ export class XTermFrontend extends Frontend {
this
.
copySelection
()
}
})
this
.
xterm
.
loadAddon
(
this
.
fitAddon
)
const
keyboardEventHandler
=
(
name
:
string
,
event
:
KeyboardEvent
)
=>
{
this
.
hotkeysService
.
pushKeystroke
(
name
,
event
)
...
...
@@ -72,7 +72,7 @@ export class XTermFrontend extends Frontend {
this
.
resizeHandler
=
()
=>
{
try
{
fit
(
this
.
xterm
)
this
.
fitAddon
.
fit
(
)
}
catch
{
// tends to throw when element wasn't shown yet
}
...
...
@@ -86,6 +86,12 @@ export class XTermFrontend extends Frontend {
attach
(
host
:
HTMLElement
):
void
{
this
.
xterm
.
open
(
host
)
this
.
opened
=
true
;(
this
.
xterm
as
any
).
loadWebgl
(
false
)
if
(
this
.
configService
.
store
.
terminal
.
ligatures
)
{
enableLigatures
(
this
.
xterm
)
}
this
.
ready
.
next
(
null
)
this
.
ready
.
complete
()
...
...
@@ -188,7 +194,7 @@ export class XTermFrontend extends Frontend {
this
.
configuredTheme
=
theme
}
if
(
config
.
terminal
.
ligatures
&&
this
.
xterm
.
element
)
{
if
(
this
.
opened
&&
config
.
terminal
.
ligatures
)
{
enableLigatures
(
this
.
xterm
)
}
}
...
...
terminus-terminal/src/services/sessions.service.ts
浏览文件 @
46720e32
...
...
@@ -146,7 +146,7 @@ export class Session extends BaseSession {
this
.
open
=
true
this
.
pty
.
on
(
'
data-buffered
'
,
data
=>
{
this
.
pty
.
on
Data
(
data
=>
{
data
=
this
.
processOSC1337
(
data
)
this
.
emitOutput
(
data
)
if
(
process
.
platform
===
'
win32
'
)
{
...
...
@@ -321,7 +321,7 @@ export class SessionsService {
constructor
(
log
:
LogService
,
)
{
require
(
'
../bufferizedPTY
'
)(
nodePTY
)
//
require('../bufferizedPTY')(nodePTY)
this
.
logger
=
log
.
create
(
'
sessions
'
)
}
...
...
terminus-terminal/yarn.lock
浏览文件 @
46720e32
...
...
@@ -254,10 +254,9 @@ xterm-addon-ligatures@^0.1.0-beta-2:
font-finder "^1.0.2"
font-ligatures "^1.3.1"
xterm@3.14.2:
version "3.14.2"
resolved "https://registry.yarnpkg.com/xterm/-/xterm-3.14.2.tgz#f1285288bdc7df7056ef4bde64311900748c3e5d"
integrity sha512-L50XMhfAC953/3EzmL+lq8jyD6CQ3SZ83UDrxalpKzE3d7Wo5JqehSd4yOrHYZYrijOT3pX6kBsZEI9uuZ1lmQ==
"xterm@https://registry.npmjs.org/@terminus-term/xterm/-/xterm-3.14.1.tgz":
version "3.14.1"
resolved "https://registry.npmjs.org/@terminus-term/xterm/-/xterm-3.14.1.tgz#f3f7c0b4726fc60c22af17bac95c1b8058eca317"
yallist@^2.1.2:
version "2.1.2"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录