Skip to content

Commit

Permalink
add --char-width and --char-height CSS variables
Browse files Browse the repository at this point in the history
  • Loading branch information
jcubic committed Nov 18, 2024
1 parent 473e835 commit b89a7b3
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 9 deletions.
5 changes: 5 additions & 0 deletions css/jquery.terminal-src.css
Original file line number Diff line number Diff line change
Expand Up @@ -989,6 +989,11 @@ terminal .terminal-output > div {
inherits: true;
initial-value: auto;
}
@property --cols {
syntax: '<number> | auto';
inherits: true;
initial-value: auto;
}
@supports (-ms-ime-align:auto) {
.terminal h1::selection,
.terminal h2::selection,
Expand Down
7 changes: 6 additions & 1 deletion css/jquery.terminal.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* Copyright (c) 2011-2024 Jakub T. Jankiewicz <https://jcubic.pl/me>
* Released under the MIT license
*
* Date: Sun, 17 Nov 2024 13:13:41 +0000
* Date: Mon, 18 Nov 2024 22:45:17 +0000
*/
.terminal .terminal-output .format, .cmd .format,
.cmd-prompt, .cmd-prompt div {
Expand Down Expand Up @@ -989,6 +989,11 @@ terminal .terminal-output > div {
inherits: true;
initial-value: auto;
}
@property --cols {
syntax: '<number> | auto';
inherits: true;
initial-value: auto;
}
@supports (-ms-ime-align:auto) {
.terminal h1::selection,
.terminal h2::selection,
Expand Down
4 changes: 2 additions & 2 deletions css/jquery.terminal.min.css

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions js/jquery.terminal-src.js
Original file line number Diff line number Diff line change
Expand Up @@ -12580,9 +12580,18 @@
});
function calculate_char_size() {
var width = char_size.width;
var height = char_size.height;
char_size = get_char_size(self);
var css_vars = {};
if (width !== char_size.width) {
command_line.option('charWidth', char_size.width).refresh();
css_vars['char-width'] = char_size.width;
}
if (height !== char_size.height) {
css_vars['char-height'] = char_size.height;
}
if (Object.keys(css_vars).length) {
css(self[0], css_vars);
}
}
resize();
Expand Down
13 changes: 11 additions & 2 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: Sun, 17 Nov 2024 13:32:31 +0000
* Date: Mon, 18 Nov 2024 22:45:16 +0000
*/
/* global define, Map, BigInt */
/* eslint-disable */
Expand Down Expand Up @@ -5345,7 +5345,7 @@
// -------------------------------------------------------------------------
$.terminal = {
version: 'DEV',
date: 'Sun, 17 Nov 2024 13:32:31 +0000',
date: 'Mon, 18 Nov 2024 22:45:16 +0000',
// colors from https://www.w3.org/wiki/CSS/Properties/color/keywords
color_names: [
'transparent', 'currentcolor', 'black', 'silver', 'gray', 'white',
Expand Down Expand Up @@ -12580,9 +12580,18 @@
});
function calculate_char_size() {
var width = char_size.width;
var height = char_size.height;
char_size = get_char_size(self);
var css_vars = {};
if (width !== char_size.width) {
command_line.option('charWidth', char_size.width).refresh();
css_vars['char-width'] = char_size.width;
}
if (height !== char_size.height) {
css_vars['char-height'] = char_size.height;
}
if (Object.keys(css_vars).length) {
css(self[0], css_vars);
}
}
resize();
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 b89a7b3

Please sign in to comment.