Skip to content

InputDialog: fix adding widget with 'use available height'#15010

Merged
hius07 merged 1 commit into
koreader:masterfrom
hius07:inputdialog-fix-add-widget
Feb 21, 2026
Merged

InputDialog: fix adding widget with 'use available height'#15010
hius07 merged 1 commit into
koreader:masterfrom
hius07:inputdialog-fix-add-widget

Conversation

@hius07

@hius07 hius07 commented Feb 19, 2026

Copy link
Copy Markdown
Member

Comment on lines +524 to +527
if self.use_available_height then
self.text_height = nil
self:init()
end

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This self:init() inside InputDialog:addWidget() feels like we may get caught in a loop, as :init() can call :addWidget().
Are there conditions that prevent that from happening ? (If any, a comment saying so and why would provide some comfort :))

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, init calls addWidget with re_init=true:

self:addWidget(widget, true)

addWidget calls init within
if not re_init then -- backup widget for re-init

@Frenzie Frenzie added this to the 2026.02 milestone Feb 19, 2026
@j-v

j-v commented Feb 19, 2026

Copy link
Copy Markdown
Contributor

yay thanks for the fix!

@j-v

j-v commented Feb 19, 2026

Copy link
Copy Markdown
Contributor

@hius07 the fix only works if i change the re_init arg in my repro code from sample_input:addWidget(button, true) to sample_input:addWidget(button, false)
Is that expected? I might not be totally clear on what is the appropriate use of the re_init arg.

@poire-z

poire-z commented Feb 19, 2026

Copy link
Copy Markdown
Contributor

You should indeed just use sample_input:addWidget(button).
The default for re_init is nil/false. Its intended use is internal, by InputDialog itself when things change too much (virtual keyboard toggled, screen rotation), it will re-init() itself, calling :addWidget(..., true).

@j-v

j-v commented Feb 19, 2026

Copy link
Copy Markdown
Contributor

You should indeed just use sample_input:addWidget(button). The default for re_init is nil/false. Its intended use is internal, by InputDialog itself when things change too much (virtual keyboard toggled, screen rotation), it will re-init() itself, calling :addWidget(..., true).

Cool thanks for the tip @poire-z
Would be nice to have the function commented with the intended arg usage, i could create a small PR?

@hius07 hius07 merged commit 18090df into koreader:master Feb 21, 2026
4 checks passed
@hius07 hius07 deleted the inputdialog-fix-add-widget branch February 21, 2026 17:56
0xstillb pushed a commit to 0xstillb/koreader-thai that referenced this pull request May 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Keyboard occludes InputDialog when addWidget() called

4 participants