irb-theme-rk2025 0.1.0 → 0.1.1
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/irb/theme/rk2025.rb +55 -38
- 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: 508b6c16e31f5488182ec2e0bf4f447a1786aa53481623df8c7eee08248cc746
|
4
|
+
data.tar.gz: 032671b0b2d4e369c15f07f640cd205b701e9edac287c1f33deeaff590e8d50d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97ca9d0206e7b9ae4c9741c2e0da3d2c4a0fab18313b918597c02aba126d514aafb11c1b3943f1a19b453a86299b0c78c408ed0482bf491df2c2c676feb80665
|
7
|
+
data.tar.gz: efb29e9c18fa41606e5be83479a0ac50e39f2bb9863fea77089506dbbac33427051a968c6d4ee774bd85adf8f3fbcf49660535339a3b0b59d464b2cedfe77cc3
|
data/lib/irb/theme/rk2025.rb
CHANGED
@@ -35,31 +35,41 @@ module IRB2025Mikan
|
|
35
35
|
output = +''
|
36
36
|
background = color = nil
|
37
37
|
x = 0
|
38
|
+
chars = line ? line.grapheme_clusters.flat_map { |c|
|
39
|
+
case Reline::Unicode.get_mbchar_width(c)
|
40
|
+
when 2
|
41
|
+
[[c, 2], :skip]
|
42
|
+
when 1
|
43
|
+
[[c, 1]]
|
44
|
+
else
|
45
|
+
[]
|
46
|
+
end
|
47
|
+
} : []
|
38
48
|
while x < @w do
|
39
49
|
m = @masks[y][x] || 0
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
line = "\0" + line if w == 2
|
45
|
-
tlen = w
|
50
|
+
c, cw = chars[x]
|
51
|
+
if c == :skip
|
52
|
+
x += 1
|
53
|
+
next
|
46
54
|
end
|
47
|
-
c =
|
55
|
+
c = nil if c == ' '
|
56
|
+
|
57
|
+
col = @colors[y][x]
|
48
58
|
bg = default_background
|
49
|
-
if
|
50
|
-
bg = m == 0 ? default_background :
|
51
|
-
|
52
|
-
x +=
|
59
|
+
if c && x + cw <= @w
|
60
|
+
bg = m == 0 ? default_background : col || default_background
|
61
|
+
col = text_color
|
62
|
+
x += cw
|
53
63
|
else
|
54
64
|
x += 1
|
55
65
|
end
|
56
|
-
if color !=
|
57
|
-
output << "\e[38;5;#{color =
|
66
|
+
if color != col
|
67
|
+
output << "\e[38;5;#{color = col}m"
|
58
68
|
end
|
59
69
|
if background != bg
|
60
70
|
output << "\e[48;5;#{background = bg}m"
|
61
71
|
end
|
62
|
-
output << (
|
72
|
+
output << (c || CHARS[m])
|
63
73
|
end
|
64
74
|
output << "\e[m"
|
65
75
|
output_lines << output
|
@@ -93,34 +103,42 @@ module IRB2025Mikan
|
|
93
103
|
end
|
94
104
|
end
|
95
105
|
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
106
|
+
def self.params
|
107
|
+
prev_color = nil
|
108
|
+
@params ||= 100.times.map do |i|
|
109
|
+
bi = rand(0.02..0.05)
|
110
|
+
bo = rand(0.05..0.1)
|
111
|
+
bm = bo * rand(1.0..2.0)
|
112
|
+
color = prev_color
|
113
|
+
color = 16+36*5+6*rand(3..5)+rand(1..2) while color == prev_color
|
114
|
+
prev_color = color
|
115
|
+
{
|
116
|
+
cx: rand,
|
117
|
+
cy: 15 * i + rand(10),
|
118
|
+
segments: rand(7..9),
|
119
|
+
theta: 2 * Math::PI * rand,
|
120
|
+
rot: (0.2 + 0.4 * rand) * (rand > 0.5 ? 1 : -1),
|
121
|
+
bi:, bm:, bo:,
|
122
|
+
radius: rand(12..24),
|
123
|
+
color:
|
124
|
+
}
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
def self.reset_params
|
129
|
+
@params = nil
|
114
130
|
end
|
115
131
|
|
116
132
|
def self.start
|
117
133
|
Reline::LineEditor.prepend Module.new {
|
118
134
|
def colorize_completion_dialog
|
119
135
|
dialog = @dialogs[0]
|
120
|
-
|
136
|
+
unless dialog&.contents
|
137
|
+
IRB2025Mikan.reset_params
|
138
|
+
return
|
139
|
+
end
|
121
140
|
|
122
141
|
canvas = Canvas.new(dialog.width, dialog.contents.size)
|
123
|
-
y = dialog.scroll_top
|
124
142
|
face = Reline::Face[:completion_dialog]
|
125
143
|
time = Time.now.to_f
|
126
144
|
original_contents = dialog.contents.instance_eval { @original ||= dup }
|
@@ -129,11 +147,10 @@ module IRB2025Mikan
|
|
129
147
|
line.gsub(/\e\[[\d;]*m/, '')
|
130
148
|
end
|
131
149
|
canvas.lines = uncolored_lines
|
132
|
-
|
133
|
-
PARAMS.each do |param|
|
150
|
+
IRB2025Mikan.params.each do |param|
|
134
151
|
param in { cx:, cy:, segments:, theta:, rot:, bo:, bi:, bm:, radius:, color: }
|
135
152
|
cy = (cy - dialog.scroll_top) % 1500 - 100
|
136
|
-
theta +=
|
153
|
+
theta += time * rot
|
137
154
|
canvas.draw(5 + (canvas.w - 5)*cx, cy, radius+0.5, color){|x,y|
|
138
155
|
z = x+y.i
|
139
156
|
a = z.arg
|
@@ -172,4 +189,4 @@ module IRB2025Mikan
|
|
172
189
|
end
|
173
190
|
end
|
174
191
|
|
175
|
-
IRB2025Mikan.start
|
192
|
+
IRB2025Mikan.start
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: irb-theme-rk2025
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- tompng
|
8
8
|
bindir: exe
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-03-
|
10
|
+
date: 2025-03-09 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: reline
|