Skip to content

Commit

Permalink
add padding to terminal size i term::geometry() #686
Browse files Browse the repository at this point in the history
  • Loading branch information
jcubic committed Sep 8, 2021
1 parent c163d79 commit 9c9e5ec
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 15 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* fix `get_output()` on lines that are promises [#687](https://github.com/jcubic/jquery.terminal/issues/687)
* fix echo newline when one of the values is promise or function
* fix invalid css when partial output is no longer partial
* add padding to terminal size i `term::geometry()` [#686](https://github.com/jcubic/jquery.terminal/issues/686)

## 2.29.1
### Bugfix
Expand Down
22 changes: 18 additions & 4 deletions js/jquery.terminal-2.29.1.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
*
* broken image by Sophia Bai from the Noun Project (CC-BY)
*
* Date: Wed, 08 Sep 2021 16:51:59 +0000
* Date: Wed, 08 Sep 2021 17:02:45 +0000
*/
/* global define, Map */
/* eslint-disable */
Expand Down Expand Up @@ -5033,7 +5033,7 @@
// -------------------------------------------------------------------------
$.terminal = {
version: 'DEV',
date: 'Wed, 08 Sep 2021 16:51:59 +0000',
date: 'Wed, 08 Sep 2021 17:02:45 +0000',
// colors from https://www.w3.org/wiki/CSS/Properties/color/keywords
color_names: [
'transparent', 'currentcolor', 'black', 'silver', 'gray', 'white',
Expand Down Expand Up @@ -9373,10 +9373,24 @@
// :: Return size of the terminal instance
// -------------------------------------------------------------
geometry: function() {
var style = window.getComputedStyle(self[0]);
function padding(name) {
return parseInt(style.getPropertyValue('padding-' + name), 10);
}
var left = padding('left');
var right = padding('right');
var top = padding('top');
var bottom = padding('bottom');
return {
terminal: {
width: old_width,
height: old_height
padding: {
left: left,
right: right,
top: top,
bottom: bottom
},
width: old_width + left + right,
height: old_height + top + bottom
},
char: char_size,
cols: this.cols(),
Expand Down
4 changes: 2 additions & 2 deletions js/jquery.terminal-2.29.1.min.js

Large diffs are not rendered by default.

18 changes: 16 additions & 2 deletions js/jquery.terminal-src.js
Original file line number Diff line number Diff line change
Expand Up @@ -9373,10 +9373,24 @@
// :: Return size of the terminal instance
// -------------------------------------------------------------
geometry: function() {
var style = window.getComputedStyle(self[0]);
function padding(name) {
return parseInt(style.getPropertyValue('padding-' + name), 10);
}
var left = padding('left');
var right = padding('right');
var top = padding('top');
var bottom = padding('bottom');
return {
terminal: {
width: old_width,
height: old_height
padding: {
left: left,
right: right,
top: top,
bottom: bottom
},
width: old_width + left + right,
height: old_height + top + bottom
},
char: char_size,
cols: this.cols(),
Expand Down
6 changes: 6 additions & 0 deletions js/jquery.terminal.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ declare namespace JQueryTerminal {
height: number
};
interface geometry {
padding: {
left: number,
right: number,
top: number,
bottom: number
};
terminal: size;
char: size;
cols: number;
Expand Down
22 changes: 18 additions & 4 deletions js/jquery.terminal.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
*
* broken image by Sophia Bai from the Noun Project (CC-BY)
*
* Date: Wed, 08 Sep 2021 16:51:59 +0000
* Date: Wed, 08 Sep 2021 17:02:45 +0000
*/
/* global define, Map */
/* eslint-disable */
Expand Down Expand Up @@ -5033,7 +5033,7 @@
// -------------------------------------------------------------------------
$.terminal = {
version: 'DEV',
date: 'Wed, 08 Sep 2021 16:51:59 +0000',
date: 'Wed, 08 Sep 2021 17:02:45 +0000',
// colors from https://www.w3.org/wiki/CSS/Properties/color/keywords
color_names: [
'transparent', 'currentcolor', 'black', 'silver', 'gray', 'white',
Expand Down Expand Up @@ -9373,10 +9373,24 @@
// :: Return size of the terminal instance
// -------------------------------------------------------------
geometry: function() {
var style = window.getComputedStyle(self[0]);
function padding(name) {
return parseInt(style.getPropertyValue('padding-' + name), 10);
}
var left = padding('left');
var right = padding('right');
var top = padding('top');
var bottom = padding('bottom');
return {
terminal: {
width: old_width,
height: old_height
padding: {
left: left,
right: right,
top: top,
bottom: bottom
},
width: old_width + left + right,
height: old_height + top + bottom
},
char: char_size,
cols: this.cols(),
Expand Down
4 changes: 2 additions & 2 deletions js/jquery.terminal.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/jquery.terminal.min.js.map

Large diffs are not rendered by default.

0 comments on commit 9c9e5ec

Please sign in to comment.