bugfix: pin down schema1->y behavior
I want the topmost y coordinate for a given screen line. I think.
This commit is contained in:
parent
82865c4fea
commit
3fbd57887c
|
@ -1,5 +1,6 @@
|
|||
y_of_schema1 = function(editor, loc)
|
||||
local result = 0
|
||||
loc = {line=loc.line, pos=Text.pos_at_start_of_screen_line(editor, loc)}
|
||||
if loc.line == 1 and loc.pos == 1 then
|
||||
return result
|
||||
end
|
||||
|
@ -15,4 +16,4 @@ y_of_schema1 = function(editor, loc)
|
|||
result = result + editor.line_height
|
||||
end
|
||||
return result
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
test_y_of_schema1 = function()
|
||||
local state = edit.initialize_test_state()
|
||||
state.lines = load_array{'1', '2', '3'}
|
||||
Text.redraw_all(state)
|
||||
check_eq(y_of_schema1(state, {line=1, pos=1}), 0, 'start of first line')
|
||||
check_eq(y_of_schema1(state, {line=1, pos=2}), 0, 'middle of first line')
|
||||
check_eq(y_of_schema1(state, {line=2, pos=2}), state.line_height, 'middle of second line')
|
||||
end
|
Loading…
Reference in New Issue