Skip to content

Commit

Permalink
fix number of rows when using different --size #969
Browse files Browse the repository at this point in the history
  • Loading branch information
jcubic committed Sep 21, 2024
1 parent 55ebd7c commit ab5f1fa
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 13 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.43.3
### Bugfix
* fix number of rows when using different `--size` [#969](https://github.com/jcubic/jquery.terminal/issues/969)

## 2.43.2
### Bugfix
* fix scroll to bottom when using `terminal::import_view`
Expand Down
1 change: 1 addition & 0 deletions css/jquery.terminal-src.css
Original file line number Diff line number Diff line change
Expand Up @@ -845,6 +845,7 @@ terminal .terminal-output > div {
}
.terminal .terminal-output > :not(.raw) > div,
.cmd div,
.terminal,
.terminal.external div {
line-height: var(--terminal-line, 1em);
}
Expand Down
5 changes: 3 additions & 2 deletions css/jquery.terminal.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
* __ / // // // // // _ // _// // / / // _ // _// // // \/ // _ \/ /
* / / // // // // // ___// / / // / / // ___// / / / / // // /\ // // / /__
* \___//____ \\___//____//_/ _\_ / /_//____//_/ /_/ /_//_//_/ /_/ \__\_\___/
* \/ /____/ version 2.43.1
* \/ /____/ version DEV
* http://terminal.jcubic.pl
*
* This file is part of jQuery Terminal.
*
* Copyright (c) 2011-2024 Jakub T. Jankiewicz <https://jcubic.pl/me>
* Released under the MIT license
*
* Date: Sun, 08 Sep 2024 09:58:43 +0000
* Date: Sat, 21 Sep 2024 22:04:00 +0000
*/
.terminal .terminal-output .format, .cmd .format,
.cmd-prompt, .cmd-prompt div {
Expand Down Expand Up @@ -845,6 +845,7 @@ terminal .terminal-output > div {
}
.terminal .terminal-output > :not(.raw) > div,
.cmd div,
.terminal,
.terminal.external div {
line-height: var(--terminal-line, 1em);
}
Expand Down
6 changes: 3 additions & 3 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.

11 changes: 10 additions & 1 deletion js/jquery.terminal-src.js
Original file line number Diff line number Diff line change
Expand Up @@ -7328,6 +7328,15 @@
return result;
}
// -----------------------------------------------------------------------
// :: fix rounding issue #969
// -----------------------------------------------------------------------
function aproximation(number) {
if (number - Math.floor(number) > 0.99) {
return Math.ceil(number);
}
return Math.floor(number);
}
// -----------------------------------------------------------------------
// :: calculate numbers of characters
// -----------------------------------------------------------------------
function get_num_chars(terminal, char_size) {
Expand All @@ -7343,7 +7352,7 @@
function get_num_rows(terminal, char_size) {
var filler = terminal.find('.terminal-fill');
var height = filler.height();
return Math.floor(height / char_size.height);
return aproximation(height / char_size.height);
}
// -----------------------------------------------------------------------
function all(array, fn) {
Expand Down
15 changes: 12 additions & 3 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, 15 Sep 2024 23:29:58 +0000
* Date: Sat, 21 Sep 2024 22:03:59 +0000
*/
/* global define, Map, BigInt */
/* eslint-disable */
Expand Down Expand Up @@ -5323,7 +5323,7 @@
// -------------------------------------------------------------------------
$.terminal = {
version: 'DEV',
date: 'Sun, 15 Sep 2024 23:29:58 +0000',
date: 'Sat, 21 Sep 2024 22:03:59 +0000',
// colors from https://www.w3.org/wiki/CSS/Properties/color/keywords
color_names: [
'transparent', 'currentcolor', 'black', 'silver', 'gray', 'white',
Expand Down Expand Up @@ -7328,6 +7328,15 @@
return result;
}
// -----------------------------------------------------------------------
// :: fix rounding issue #969
// -----------------------------------------------------------------------
function aproximation(number) {
if (number - Math.floor(number) > 0.99) {
return Math.ceil(number);
}
return Math.floor(number);
}
// -----------------------------------------------------------------------
// :: calculate numbers of characters
// -----------------------------------------------------------------------
function get_num_chars(terminal, char_size) {
Expand All @@ -7343,7 +7352,7 @@
function get_num_rows(terminal, char_size) {
var filler = terminal.find('.terminal-fill');
var height = filler.height();
return Math.floor(height / char_size.height);
return aproximation(height / char_size.height);
}
// -----------------------------------------------------------------------
function all(array, fn) {
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 ab5f1fa

Please sign in to comment.