mirror of
https://github.com/airstruck/luigi.git
synced 2025-11-18 12:25:06 +00:00
fix scroll-to-caret in text widget, fixes #38
This commit is contained in:
@@ -25,17 +25,18 @@ local function updateHighlight (self)
|
||||
end
|
||||
|
||||
local function scrollToCaret (self)
|
||||
updateHighlight(self)
|
||||
local x1, y1, w, h = self:getRectangle(true, true)
|
||||
local x2, y2 = x1 + w, y1 + h
|
||||
local oldX = self.endX or x1
|
||||
|
||||
if oldX <= x1 then
|
||||
self.scrollX = self.scrollX - (x1 - oldX)
|
||||
updateHighlight(self)
|
||||
elseif oldX >= x2 then
|
||||
self.scrollX = self.scrollX + (oldX - x2 + 1)
|
||||
updateHighlight(self)
|
||||
end
|
||||
|
||||
updateHighlight(self)
|
||||
end
|
||||
|
||||
local function selectRange (self, startIndex, endIndex)
|
||||
|
||||
Reference in New Issue
Block a user