summaryrefslogtreecommitdiff
path: root/init.lua
diff options
context:
space:
mode:
authorWuzzy <almikes@aol.com>2016-11-07 21:30:03 +0100
committerWuzzy <almikes@aol.com>2016-11-07 21:30:03 +0100
commitb0bec3da6a03d65e34635795c314830c3c6b10a2 (patch)
tree67e01f509395a391c22a260c9a8f06fec59c1ef5 /init.lua
parentd5736bda723e2995e6f70a7511337e6afc4a3f93 (diff)
Add optional text widget boundaries
Diffstat (limited to 'init.lua')
-rw-r--r--init.lua12
1 files changed, 12 insertions, 0 deletions
diff --git a/init.lua b/init.lua
index df9641f..b1b6a03 100644
--- a/init.lua
+++ b/init.lua
@@ -424,6 +424,18 @@ doc.widgets = {}
local text_id = 1
-- Scrollable freeform text
doc.widgets.text = function(data, x, y, width, height)
+ if x == nil then
+ x = doc.FORMSPEC.ENTRY_START_X
+ end
+ if y == nil then
+ y = doc.FORMSPEC.ENTRY_START_Y
+ end
+ if width == nil then
+ width = doc.FORMSPEC.ENTRY_WIDTH
+ end
+ if height == nil then
+ height = doc.FORMSPEC.ENTRY_HEIGHT
+ end
local baselength = 80
local widget_basewidth = doc.FORMSPEC.WIDTH
local linelength = math.max(20, math.floor(baselength * (width / widget_basewidth)))