Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How Can Create A Fullscreen Terminal #22

Closed
bvallelunga opened this issue Feb 7, 2014 · 1 comment
Closed

How Can Create A Fullscreen Terminal #22

bvallelunga opened this issue Feb 7, 2014 · 1 comment

Comments

@bvallelunga
Copy link

@chjj thank you for building an awesome terminal. How would I set up the terminal so that it has 100% width and height?

@liuzheng
Copy link

here is my code for you, with angularjs

$scope.textSize = function () {
    function getCharSize() {
        var $span = $("<span>", {text: "qwertyuiopasdfghjklzxcvbnm"});
        $('#terminal').append($span);
        var size = {
            width: $span.outerWidth()/26
            , height: $span.outerHeight()
        };
        $span.remove();
        return size;
    }
    function getwindowSize() {
        var e = window,
            a = 'inner';
        if (!('innerWidth' in window )) {
            a = 'client';
            e = document.documentElement || document.body;
        }
        return {width: e[a + 'Width'], height: e[a + 'Height']};
    }
    var charSize = getCharSize();
    var windowSize = getwindowSize();
    return {
        x: Math.floor(windowSize.width / charSize.width)
        , y: Math.floor(windowSize.height / charSize.height)
    };
};
var rc = $scope.textSize();
var term = new Terminal({
    rows:rc.y,
    cols:rc.x,
    screenKeys: false,
    cursorBlink: false
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants