• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

chjj/term.js: A terminal written in javascript.

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

chjj/term.js

开源软件地址:

https://github.com/chjj/term.js

开源编程语言:

JavaScript 98.5%

开源软件介绍:

term.js

A full xterm clone written in javascript. Used by tty.js.

⚠️ This project is no longer maintained ⚠️. For a maintained fork take a look at sourcelair/xterm.js.

Example

Server:

var term = require('term.js');
app.use(term.middleware());
...

Client:

window.addEventListener('load', function() {
  var socket = io.connect();
  socket.on('connect', function() {
    var term = new Terminal({
      cols: 80,
      rows: 24,
      screenKeys: true
    });

    term.on('data', function(data) {
      socket.emit('data', data);
    });

    term.on('title', function(title) {
      document.title = title;
    });

    term.open(document.body);

    term.write('\x1b[31mWelcome to term.js!\x1b[m\r\n');

    socket.on('data', function(data) {
      term.write(data);
    });

    socket.on('disconnect', function() {
      term.destroy();
    });
  });
}, false);

Tmux-like

While term.js has always supported copy/paste using the mouse, it now also supports several keyboard based solutions for copy/paste.

term.js includes a tmux-like selection mode (enabled with the screenKeys option) which makes copy and paste very simple. Ctrl-A enters prefix mode, from here you can type Ctrl-V to paste. Press [ in prefix mode to enter selection mode. To select text press v (or space) to enter visual mode, use hjkl to navigate and create a selection, and press Ctrl-C to copy.

Ctrl-C (in visual mode) and Ctrl-V (in prefix mode) should work in any OS for copy and paste. y (in visual mode) will work for copying only on X11 systems. It will copy to the primary selection.

Note: Ctrl-C will also work in prefix mode for the regular OS/browser selection. If you want to select text with your mouse and copy it to the clipboard, simply select the text and type Ctrl-A + Ctrl-C, and Ctrl-A + Ctrl-V to paste it.

For mac users: consider Ctrl to be Command/Apple above.

Contribution and License Agreement

If you contribute code to this project, you are implicitly allowing your code to be distributed under the MIT license. You are also implicitly verifying that all code is your original work. </legalese>

License

Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap