ansiterm 0.4.1 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/ansiterm/buffer.rb +12 -0
- data/lib/ansiterm/version.rb +1 -1
- data/visual-spec/buffer.rb +18 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 769f26bf92779ce6c3530bd496dc889cccbcbda18b6447472d910b00810749b4
|
4
|
+
data.tar.gz: 9f4599f5b8146011dcb6b56101536a14b4a4317baa2f528e3f947170d6c42366
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d2656c8bdee346170e74c725712fe202474cb779d3c74067b9df42769a8fdc736ecc550859a658b1e4f44ff827a5657e49627ab437de464fa5427c8b126cc822
|
7
|
+
data.tar.gz: 998ee1fa03b7d442edcd5f2535d9ad8c5ff16ea7c26795e35e9f42a9540b374608194ab3a32aef627e4e6daf4c1b3e85402c548222333052df4e223c38e497f4
|
data/lib/ansiterm/buffer.rb
CHANGED
@@ -61,6 +61,18 @@ module AnsiTerm
|
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
64
|
+
# This scrolls the *buffer* up
|
65
|
+
# If you want it to also scroll the *cache*
|
66
|
+
# pass `scroll_cache: true`. This will presume
|
67
|
+
# that you've scrolled the *terminal* yourself.
|
68
|
+
def scroll_up(num=1, scroll_cache: false)
|
69
|
+
@lines.slice!(0)
|
70
|
+
@lines << AnsiTerm::String.new
|
71
|
+
if scroll_cache
|
72
|
+
@cache.slice!(0)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
64
76
|
def to_s
|
65
77
|
out = ""
|
66
78
|
cachehit=0
|
data/lib/ansiterm/version.rb
CHANGED
data/visual-spec/buffer.rb
CHANGED
@@ -6,7 +6,7 @@ require 'io/console'
|
|
6
6
|
|
7
7
|
h,w = IO.console.winsize
|
8
8
|
|
9
|
-
t = AnsiTerm::Buffer.new(w,h)
|
9
|
+
t = AnsiTerm::Buffer.new(w,h-1)
|
10
10
|
|
11
11
|
t.cls
|
12
12
|
t.move_cursor(1,1)
|
@@ -20,6 +20,22 @@ t.print("LR")
|
|
20
20
|
t.move_cursor(0,h-2)
|
21
21
|
t.print("LL")
|
22
22
|
t.move_cursor(1,2)
|
23
|
-
t.print ("Hello world")
|
23
|
+
t.print ("Hello world. UL/UR/LL/LR should fit the corners but one line above the bottom.")
|
24
|
+
print t.to_s
|
25
|
+
gets
|
26
|
+
t.scroll_up
|
27
|
+
t.move_cursor(0,0)
|
28
|
+
t.print("ul")
|
29
|
+
t.move_cursor(w-2,0)
|
30
|
+
t.print("ur")
|
31
|
+
t.move_cursor(w-2,h-2)
|
32
|
+
t.print("lr")
|
33
|
+
t.move_cursor(0,h-2)
|
34
|
+
t.print("ll")
|
35
|
+
|
36
|
+
t.move_cursor(1,2)
|
37
|
+
t.print ("We've scrolled one line up. This should display right below the Hello World.")
|
38
|
+
t.move_cursor(1,3)
|
39
|
+
t.print ("Old LL/LR should be visible one line up; new, lower case ones replacing them")
|
24
40
|
print t.to_s
|
25
41
|
gets
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ansiterm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vidar Hokstad
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-10-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|