mirror of
https://github.com/airstruck/luigi.git
synced 2026-01-09 15:58:22 +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
|
end
|
||||||
|
|
||||||
local function scrollToCaret (self)
|
local function scrollToCaret (self)
|
||||||
|
updateHighlight(self)
|
||||||
local x1, y1, w, h = self:getRectangle(true, true)
|
local x1, y1, w, h = self:getRectangle(true, true)
|
||||||
local x2, y2 = x1 + w, y1 + h
|
local x2, y2 = x1 + w, y1 + h
|
||||||
local oldX = self.endX or x1
|
local oldX = self.endX or x1
|
||||||
|
|
||||||
if oldX <= x1 then
|
if oldX <= x1 then
|
||||||
self.scrollX = self.scrollX - (x1 - oldX)
|
self.scrollX = self.scrollX - (x1 - oldX)
|
||||||
|
updateHighlight(self)
|
||||||
elseif oldX >= x2 then
|
elseif oldX >= x2 then
|
||||||
self.scrollX = self.scrollX + (oldX - x2 + 1)
|
self.scrollX = self.scrollX + (oldX - x2 + 1)
|
||||||
|
updateHighlight(self)
|
||||||
end
|
end
|
||||||
|
|
||||||
updateHighlight(self)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function selectRange (self, startIndex, endIndex)
|
local function selectRange (self, startIndex, endIndex)
|
||||||
|
|||||||
Reference in New Issue
Block a user