Skip to content

Commit c9647c2

Browse files
authored
fix(floating-big-letter): correct padding and positioning (#91)
* fix(ansi-shadow): remove trailing whitespace This fixes inconsistent/incorrect padding * fix(floating-big-letter): replace whole buffer There is always at least one, empty line in a buffer. When replacing the range [0,0[, the new contents are inserted before said empty line. As of nvim 0.10, this results in the new contents being scrolled up by one row, breaking the vertical centering. Fix this by ensuring that the entire buffer content is overridden.
1 parent c959032 commit c9647c2

File tree

2 files changed

+38
-48
lines changed

2 files changed

+38
-48
lines changed

lua/window-picker/hints/data/ansi-shadow.lua

+37-47
Original file line numberDiff line numberDiff line change
@@ -5,282 +5,272 @@ local M = {
55
███████║
66
██╔══██║
77
██║ ██║
8-
╚═╝ ╚═╝ ]],
8+
╚═╝ ╚═╝]],
99

1010
b = [[
1111
██████╗
1212
██╔══██╗
1313
██████╔╝
1414
██╔══██╗
1515
██████╔╝
16-
╚═════╝ ]],
16+
╚═════╝]],
1717

1818
c = [[
1919
██████╗
2020
██╔════╝
2121
██║
2222
██║
2323
╚██████╗
24-
╚═════╝ ]],
24+
╚═════╝]],
2525

2626
d = [[
2727
██████╗
2828
██╔══██╗
2929
██║ ██║
3030
██║ ██║
3131
██████╔╝
32-
╚═════╝ ]],
32+
╚═════╝]],
3333

3434
e = [[
3535
███████╗
3636
██╔════╝
3737
█████╗
3838
██╔══╝
3939
███████╗
40-
╚══════╝ ]],
40+
╚══════╝]],
4141

4242
f = [[
4343
███████╗
4444
██╔════╝
4545
█████╗
4646
██╔══╝
4747
██║
48-
╚═╝ ]],
48+
╚═╝]],
4949

5050
g = [[
5151
██████╗
5252
██╔════╝
5353
██║ ███╗
5454
██║ ██║
5555
╚██████╔╝
56-
╚═════╝ ]],
56+
╚═════╝]],
5757

5858
h = [[
5959
██╗ ██╗
6060
██║ ██║
6161
███████║
6262
██╔══██║
6363
██║ ██║
64-
╚═╝ ╚═╝ ]],
64+
╚═╝ ╚═╝]],
6565

6666
i = [[
6767
██╗
6868
██║
6969
██║
7070
██║
7171
██║
72-
╚═╝ ]],
72+
╚═╝]],
7373

7474
j = [[
7575
██╗
7676
██║
7777
██║
7878
██ ██║
7979
╚█████╔╝
80-
╚════╝ ]],
80+
╚════╝]],
8181

8282
k = [[
8383
██╗ ██╗
8484
██║ ██╔╝
8585
█████╔╝
8686
██╔═██╗
8787
██║ ██╗
88-
╚═╝ ╚═╝ ]],
88+
╚═╝ ╚═╝]],
8989

9090
l = [[
9191
██╗
9292
██║
9393
██║
9494
██║
9595
███████╗
96-
╚══════╝ ]],
96+
╚══════╝]],
9797

9898
m = [[
9999
███╗ ███╗
100100
████╗ ████║
101101
██╔████╔██║
102102
██║╚██╔╝██║
103103
██║ ╚═╝ ██║
104-
╚═╝ ╚═╝ ]],
104+
╚═╝ ╚═╝]],
105105

106106
n = [[
107107
███╗ ██╗
108108
████╗ ██║
109109
██╔██╗ ██║
110110
██║╚██╗██║
111111
██║ ╚████║
112-
╚═╝ ╚═══╝ ]],
112+
╚═╝ ╚═══╝]],
113113

114114
o = [[
115115
██████╗
116116
██╔═══██╗
117117
██║ ██║
118118
██║ ██║
119119
╚██████╔╝
120-
╚═════╝ ]],
120+
╚═════╝]],
121121

122122
p = [[
123123
██████╗
124124
██╔══██╗
125125
██████╔╝
126126
██╔═══╝
127127
██║
128-
╚═╝
129-
]],
128+
╚═╝]],
130129
q = [[
131130
██████╗
132131
██╔═══██╗
133132
██║ ██║
134133
██║▄▄ ██║
135134
╚██████╔╝
136-
╚══▀▀═╝
137-
]],
135+
╚══▀▀═╝]],
138136
r = [[
139137
██████╗
140138
██╔══██╗
141139
██████╔╝
142140
██╔══██╗
143141
██║ ██║
144-
╚═╝ ╚═╝
145-
]],
142+
╚═╝ ╚═╝]],
146143
s = [[
147144
███████╗
148145
██╔════╝
149146
███████╗
150147
╚════██║
151148
███████║
152-
╚══════╝
153-
]],
149+
╚══════╝]],
154150
t = [[
155151
████████╗
156152
╚══██╔══╝
157153
██║
158154
██║
159155
██║
160-
╚═╝
161-
]],
156+
╚═╝]],
162157
u = [[
163158
██╗ ██╗
164159
██║ ██║
165160
██║ ██║
166161
██║ ██║
167162
╚██████╔╝
168-
╚═════╝
169-
]],
163+
╚═════╝]],
170164
v = [[
171165
██╗ ██╗
172166
██║ ██║
173167
██║ ██║
174168
╚██╗ ██╔╝
175169
╚████╔╝
176-
╚═══╝
177-
]],
170+
╚═══╝]],
178171
w = [[
179172
██╗ ██╗
180173
██║ ██║
181174
██║ █╗ ██║
182175
██║███╗██║
183176
╚███╔███╔╝
184-
╚══╝╚══╝
185-
]],
177+
╚══╝╚══╝]],
186178
x = [[
187179
██╗ ██╗
188180
╚██╗██╔╝
189181
╚███╔╝
190182
██╔██╗
191183
██╔╝ ██╗
192-
╚═╝ ╚═╝
193-
]],
184+
╚═╝ ╚═╝]],
194185
y = [[
195186
██╗ ██╗
196187
╚██╗ ██╔╝
197188
╚████╔╝
198189
╚██╔╝
199190
██║
200-
╚═╝
201-
]],
191+
╚═╝]],
202192
z = [[
203193
███████╗
204194
╚══███╔╝
205195
███╔╝
206196
███╔╝
207197
███████╗
208-
╚══════╝ ]],
198+
╚══════╝]],
209199
['1'] = [[
210200
██╗
211201
███║
212202
╚██║
213203
██║
214204
██║
215-
╚═╝ ]],
205+
╚═╝]],
216206
['2'] = [[
217207
██████╗
218208
╚════██╗
219209
█████╔╝
220210
██╔═══╝
221211
███████╗
222-
╚══════╝ ]],
212+
╚══════╝]],
223213
['3'] = [[
224214
██████╗
225215
╚════██╗
226216
█████╔╝
227217
╚═══██╗
228218
██████╔╝
229-
╚═════╝ ]],
219+
╚═════╝]],
230220
['4'] = [[
231221
██╗ ██╗
232222
██║ ██║
233223
███████║
234224
╚════██║
235225
██║
236-
╚═╝ ]],
226+
╚═╝]],
237227
['5'] = [[
238228
███████╗
239229
██╔════╝
240230
███████╗
241231
╚════██║
242232
███████║
243-
╚══════╝ ]],
233+
╚══════╝]],
244234
['6'] = [[
245235
██████╗
246236
██╔════╝
247237
███████╗
248238
██╔═══██╗
249239
╚██████╔╝
250-
╚═════╝ ]],
240+
╚═════╝]],
251241
['7'] = [[
252242
███████╗
253243
╚════██║
254244
██╔╝
255245
██╔╝
256246
██║
257-
╚═╝ ]],
247+
╚═╝]],
258248
['8'] = [[
259249
█████╗
260250
██╔══██╗
261251
╚█████╔╝
262252
██╔══██╗
263253
╚█████╔╝
264-
╚════╝ ]],
254+
╚════╝]],
265255
['9'] = [[
266256
█████╗
267257
██╔══██╗
268258
╚██████║
269259
╚═══██║
270260
█████╔╝
271-
╚════╝ ]],
261+
╚════╝]],
272262
['0'] = [[
273263
██████╗
274264
██╔═████╗
275265
██║██╔██║
276266
████╔╝██║
277267
╚██████╔╝
278-
╚═════╝ ]],
268+
╚═════╝]],
279269
[';'] = [[
280270
██╗
281271
╚═╝
282272
▄█╗
283-
▀═╝ ]],
273+
▀═╝]],
284274
}
285275

286276
return M

lua/window-picker/hints/floating-big-letter-hint.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ function M:_show_letter_in_window(window, char)
119119
border = border,
120120
})
121121

122-
vim.api.nvim_buf_set_lines(buffer_id, 0, 0, true, lines)
122+
vim.api.nvim_buf_set_lines(buffer_id, 0, -1, true, lines)
123123

124124
return window_id
125125
end

0 commit comments

Comments
 (0)