@@ -165,7 +165,14 @@ config.plugins.terminal = common.merge({
165
165
antialiasing = " subpixel" ,
166
166
hinting = " slight"
167
167
}
168
- }
168
+ },
169
+ on_apply = function ()
170
+ if not config .plugins .terminal .bold_font then
171
+ config .plugins .terminal .bold_font = config .plugins .terminal .font :copy (
172
+ config .plugins .terminal .font :get_size (), { smoothing = true }
173
+ )
174
+ end
175
+ end
169
176
},
170
177
{
171
178
label = " Bold Text in Bright Colors" ,
@@ -183,7 +190,14 @@ config.plugins.terminal = common.merge({
183
190
}
184
191
}
185
192
}, config .plugins .terminal )
186
- if not config .plugins .terminal .bold_font then config .plugins .terminal .bold_font = config .plugins .terminal .font :copy (style .code_font :get_size (), { smoothing = true }) end
193
+
194
+ core .add_thread (function ()
195
+ if not config .plugins .terminal .bold_font then
196
+ config .plugins .terminal .bold_font = config .plugins .terminal .font :copy (
197
+ config .plugins .terminal .font :get_size (), { smoothing = true }
198
+ )
199
+ end
200
+ end )
187
201
188
202
-- contrast functions pulled from https://github.com/xtermjs/xterm.js/blob/99df13b085aecb051f1373c5b7f8e819c4f41442/src/common/Color.ts#L285.
189
203
local function contrastRatio (l1 , l2 )
@@ -276,6 +290,17 @@ function TerminalView:new(options)
276
290
self .modified_since_last_focus = false
277
291
end
278
292
293
+ function TerminalView :on_scale_change (new_scale , prev_scale )
294
+ if self .options .font ~= style .code_font then
295
+ self .options .font :set_size (
296
+ self .options .font :get_size () * (new_scale / prev_scale )
297
+ )
298
+ end
299
+ self .options .bold_font :set_size (
300
+ self .options .bold_font :get_size () * (new_scale / prev_scale )
301
+ )
302
+ end
303
+
279
304
function TerminalView :shift_selection_update ()
280
305
local shifts = self .terminal :update ()
281
306
if shifts and not self .focused then self .modified_since_last_focus = true end
305
330
306
331
307
332
function TerminalView :update ()
333
+ TerminalView .super .update (self )
308
334
if self .size .x > 0 and self .size .y > 0 and not self .terminal or self .last_size .x ~= self .size .x or self .last_size .y ~= self .size .y then
309
335
self .columns = math.max (math.floor ((self .size .x - self .options .padding .x * 2 ) / self .options .font :get_width (" W" )), 1 )
310
336
self .lines = math.max (math.floor ((self .size .y - self .options .padding .y * 2 ) / self .options .font :get_height ()), 1 )
@@ -429,6 +455,7 @@ function TerminalView:draw()
429
455
local offset = 0
430
456
local foreground , background , text_style
431
457
for i = 1 , # line , 2 do
458
+ line [i ] = math.tointeger (line [i ])
432
459
background = self :convert_color (bit .band (line [i ], 0xFFFFFFFF ), " background" )
433
460
foreground , text_style = self :convert_color (bit .rshift (line [i ], 32 ), " foreground" , self .options .bold_text_in_bright_colors )
434
461
0 commit comments