Skip to content

Commit 59f51cc

Browse files
committed
Improve whitespace handling more
1 parent dfce548 commit 59f51cc

4 files changed

Lines changed: 11 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# v2.0.3
2+
- Improve whitespace handling more
3+
14
# v2.0.2
25
- Improve whitespace handling
36

lib/tty_string/screen.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class Screen
1212

1313
def initialize(initial_style:)
1414
@cursor = Cursor.new
15-
@screen = []
15+
@screen = [Row.new(newline_style: initial_style)]
1616
@current_style = @initial_style = initial_style
1717
end
1818

lib/tty_string/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

33
module TTYString
4-
VERSION = '2.0.2'
4+
VERSION = '2.0.3'
55
end

spec/tty_string_spec.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,12 @@
479479
)
480480
end
481481

482+
it 'puts the newline in the right place when scrolling' do
483+
expect("\033[1;41mcat\n\n\n\033[0m\033[3T").to render_with_style_as(
484+
"\n\n\n\e[1;41mcat\e[0m"
485+
)
486+
end
487+
482488
it 'fills clears with styled spaces' do
483489
expect("abcd\033[2D\033[41m\033[1K\033[0m").to render_with_style_as(
484490
"\e[41m \e[0md"

0 commit comments

Comments
 (0)