fancy_buff 2.1.0 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fancy_buff.rb +13 -3
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 919af51ebb70ff27b989e17db097db51eaae6c588200d86cc081c5e2c1e8d523
|
4
|
+
data.tar.gz: '049b9b7c4233e5aee2e807e16e5027fd703da72b6683231e348645df141889ee'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fcb544d92688baa82919afb8fafcbc7761bc83db052759a0b6d25f15532f3b0a5d23a93628aecc1882dfcbc3a856b38241e9c846d7edae3536a1629ad18513e3
|
7
|
+
data.tar.gz: 4aa39cc8ac44c11c0bc3b31bd9f9ba882611e752bed58248301cfec5e3ad85e71c85c1e88b1312beeed36552c9894980557c06a230b74768832729bc158860e8
|
data/lib/fancy_buff.rb
CHANGED
@@ -13,12 +13,19 @@ class FancyBuff
|
|
13
13
|
attr_accessor :win
|
14
14
|
|
15
15
|
# gives you a default, empty, zero slice
|
16
|
-
|
16
|
+
#
|
17
|
+
# formatter - a Rouge formatter
|
18
|
+
# lexer - a Rouge lexer
|
19
|
+
def initialize(formatter, lexer)
|
20
|
+
@formatter = formatter
|
21
|
+
@lexer = lexer
|
22
|
+
|
17
23
|
# size tracking
|
18
24
|
@chars = 0 # the number of characters in the buffer (not the same as the number of bytes)
|
19
25
|
@bytes = 0 # the number of bytes in the buffer (not the same as the number of characters)
|
20
26
|
@lines = []
|
21
27
|
@max_char_width = 0
|
28
|
+
@all_buff = @lines.join("\n")
|
22
29
|
|
23
30
|
@marks = {}
|
24
31
|
@selections = {}
|
@@ -52,8 +59,11 @@ class FancyBuff
|
|
52
59
|
|
53
60
|
return [] if h == 0 || w == 0
|
54
61
|
|
55
|
-
|
56
|
-
.
|
62
|
+
text = @formatter
|
63
|
+
.format(@lexer.lex(@lines.join("\n")))
|
64
|
+
.lines[r..(r + visible_lines - 1)]
|
65
|
+
.map.with_index{|row, i| "#{(i + r + 1).to_s.rjust(3)} #{row.chars[c..(c + w - 1 - 4)]&.join}" }
|
66
|
+
.map{|l| l.chomp + "\e[0K" } +
|
57
67
|
Array.new(blank_lines) { "\e[0K" }
|
58
68
|
end
|
59
69
|
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fancy_buff
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeff Lunt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-06-
|
11
|
+
date: 2023-06-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rouge
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '4.1'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '4.1'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: minitest
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|