@@ -32,31 +32,12 @@ draw(terminal::Terminal, buffer1::Buffer, buffer2::Buffer) = draw(stdout, termin
3232
3333function 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 ()
6142end
6243
0 commit comments