Edit.line read/write property


Get or set the Edit current line position. The line position starts from 1 and grows until the last line of Edit content.
Setting this property will move the caret position at the start of the line.

If this property is set with a line number higher than the last line, the caret stays at the current position.

Example

local ui = require "ui" -- create a simple window local win = ui.Window("Edit.line sample", "fixed", 520, 270) local edit = ui.Edit(win, "", 10, 10, 500, 230) -- set edit.properties edit.font = "Times New Roman" edit.fontsize = 12 edit.wordwrap = true edit.text = [[Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.]] win:status("Line position : "..edit.line) win:show() -- update user interface repeat local line = edit.line ui.update() -- update current line on status bar if needed if line ~= edit.line then win:status("Line position : "..edit.line) end until not win.visible