13 lines
356 B
Plaintext
13 lines
356 B
Plaintext
adjust_scrollbar = function(state, y)
|
|
local s = (y-state.top) / (state.bottom-state.top)
|
|
local screen_line = s*state.screen_line_count
|
|
local line = 1
|
|
for i=1,#state.lines do
|
|
if state.line_cache[i].start_screen_line_index > screen_line then
|
|
break
|
|
end
|
|
line = i
|
|
end
|
|
state.screen_top1 = {line=line, pos=1}
|
|
state.cursor1 = {line=line, pos=1}
|
|
end |