fix: textbox methods line numbers startfrom 0

This commit is contained in:
MihailRis 2025-11-15 18:45:30 +03:00
parent 31ea198301
commit 637896fb0f

View File

@ -173,7 +173,7 @@ static int l_get_line_at(lua::State* L) {
auto node = get_document_node(L, 1);
auto position = lua::tointeger(L, 2);
if (auto box = dynamic_cast<TextBox*>(node.node.get())) {
return lua::pushinteger(L, box->getLineAt(position));
return lua::pushinteger(L, box->getLineAt(position) + 1);
}
return 0;
}
@ -191,7 +191,7 @@ static int l_get_line_y(lua::State* L) {
auto node = get_document_node(L, 1);
auto line = lua::tointeger(L, 2);
if (auto box = dynamic_cast<TextBox*>(node.node.get())) {
return lua::pushinteger(L, box->getLineYOffset(line));
return lua::pushinteger(L, box->getLineYOffset(line - 1));
}
return 0;
}