Skip to content

Commit

Permalink
Improve TextArea focus handling
Browse files Browse the repository at this point in the history
  • Loading branch information
wiktor-obrebski committed Nov 21, 2024
1 parent ff76073 commit 6384b21
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
3 changes: 1 addition & 2 deletions library/lua/gui/widgets/text_area.lua
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ function TextArea:init()
self.text_area,
self.scrollbar,
}
self:setFocus(true)
end

function TextArea:getText()
Expand Down Expand Up @@ -109,7 +108,7 @@ function TextArea:scrollToCursor(cursor_offset)
end

function TextArea:getPreferredFocusState()
return self.parent_view.focus
return self.parent_view and self.parent_view.focus or true
end

function TextArea:postUpdateLayout()
Expand Down
6 changes: 1 addition & 5 deletions library/lua/gui/widgets/text_area/text_area_content.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ TextAreaContent = defclass(TextAreaContent, Widget)
TextAreaContent.ATTRS{
text = '',
text_pen = COLOR_LIGHTCYAN,
ignore_keys = {'STRING_A096'},
ignore_keys = {},
pen_selection = COLOR_CYAN,
on_text_change = DEFAULT_NIL,
on_cursor_change = DEFAULT_NIL,
Expand Down Expand Up @@ -63,10 +63,6 @@ function TextAreaContent:setRenderStartLineY(render_start_line_y)
self.render_start_line_y = render_start_line_y
end

function TextAreaContent:getPreferredFocusState()
return true
end

function TextAreaContent:postComputeFrame()
self:recomputeLines()
end
Expand Down

0 comments on commit 6384b21

Please sign in to comment.