Skip to content

Commit 3e095ff

Browse files
committed
Update files
1 parent 2189248 commit 3e095ff

File tree

2 files changed

+6
-25
lines changed

2 files changed

+6
-25
lines changed

src/terminal.jl

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -32,31 +32,12 @@ draw(terminal::Terminal, buffer1::Buffer, buffer2::Buffer) = draw(stdout, termin
3232

3333
function draw(io, t::Terminal, buffer1::Buffer, buffer2::Buffer)
3434
save_cursor()
35-
b1 = buffer1.content[:]
36-
b2 = buffer2.content[:]
37-
# a move cursor requires writing a string of 6 - 8 characters
38-
# doing styles require writing a string of 5 characters
39-
# undoing styles require writing a string of 5 characters
40-
# might as well calculate what we need to write and do it in one shot
41-
# for every character in the diff we need to write 16 - 18 additional characters if we use a diff based algorithm
42-
# optimize for the case if changes are minimal, moving the cursor is more efficient
43-
if count(==(0), b1 .== b2) <= length(b2) ÷ 20
44-
R, C = size(buffer2.content)
45-
for r = 1:R, c = 1:C
46-
if buffer1.content[r, c] != buffer2.content[r, c]
47-
move_cursor(r, c)
48-
cell = buffer2.content[r, c]
49-
print(io, cell.style, cell.char, inv(cell.style))
50-
end
51-
end
52-
else
53-
move_cursor(1, 1)
54-
iob = IOBuffer()
55-
for cell in permutedims(buffer2.content)[:]
56-
print(iob, cell.style, cell.char, inv(cell.style))
57-
end
58-
print(io, String(take!(iob)))
35+
move_cursor(1, 1)
36+
iob = IOBuffer()
37+
for cell in permutedims(buffer2.content)[:]
38+
print(iob, cell.style, cell.char, inv(cell.style))
5939
end
40+
print(io, String(take!(iob)))
6041
restore_cursor()
6142
end
6243

src/widgets/progressbar.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ function draw(pg::ProgressBar, rect::Rect, buf::Buffer)
1414

1515
center = height(inner_area) ÷ 2 + top(inner_area)
1616

17-
crayon = Crayon(foreground = :white, background = :black)
17+
crayon = Crayon(foreground = (255, 255, 255), background = (0, 0, 0))
1818

1919
for y in top(inner_area):bottom(inner_area)
2020
for x in left(inner_area):right(inner_area)

0 commit comments

Comments
 (0)