Skip to content

Commit

Permalink
Polishing TextArea subwidgets
Browse files Browse the repository at this point in the history
  • Loading branch information
wiktor-obrebski committed Nov 21, 2024
1 parent 6384b21 commit 6047b40
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions library/lua/gui/widgets/text_area.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ TextArea.ATTRS{
init_text = '',
init_cursor = DEFAULT_NIL,
text_pen = COLOR_LIGHTCYAN,
ignore_keys = {'STRING_A096'},
ignore_keys = {},
select_pen = COLOR_CYAN,
on_text_change = DEFAULT_NIL,
on_cursor_change = DEFAULT_NIL,
Expand Down Expand Up @@ -100,10 +100,10 @@ end

function TextArea:scrollToCursor(cursor_offset)
if self.scrollbar.visible then
local _, cursor_liny_y = self.text_area.wrapped_text:indexToCoords(
local _, cursor_line_y = self.text_area.wrapped_text:indexToCoords(
cursor_offset
)
self:updateScrollbar(cursor_liny_y)
self:updateScrollbar(cursor_line_y)
end
end

Expand Down Expand Up @@ -143,10 +143,10 @@ end
function TextArea:updateScrollbar(scrollbar_current_y)
local lines_count = #self.text_area.wrapped_text.lines

local render_start_line_y = (math.min(
local render_start_line_y = math.min(
#self.text_area.wrapped_text.lines - self.text_area.frame_body.height + 1,
math.max(1, scrollbar_current_y)
))
)

self.scrollbar:update(
render_start_line_y,
Expand Down
2 changes: 1 addition & 1 deletion library/lua/gui/widgets/text_area/text_area_content.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ TextAreaContent.ATTRS{
enable_cursor_blink = true,
debug = false,
one_line_mode = false,
history_size = 10,
history_size = 25,
}

function TextAreaContent:init()
Expand Down
2 changes: 1 addition & 1 deletion library/lua/gui/widgets/text_area/wrapped_text.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ WrappedText = defclass(WrappedText)

WrappedText.ATTRS{
text = '',
wrap_width = DEFAULT_NIL,
wrap_width = math.huge,
}

function WrappedText:init()
Expand Down

0 comments on commit 6047b40

Please sign in to comment.