Skip to content

VocabBuilder.koplugin: supports removing word in-place after addition#14127

Merged
Frenzie merged 2 commits into
koreader:masterfrom
weijiuqiao:vocab_builder_dev
Aug 16, 2025
Merged

VocabBuilder.koplugin: supports removing word in-place after addition#14127
Frenzie merged 2 commits into
koreader:masterfrom
weijiuqiao:vocab_builder_dev

Conversation

@weijiuqiao

@weijiuqiao weijiuqiao commented Aug 2, 2025

Copy link
Copy Markdown
Contributor

This closes #14123;


This change is Reviewable

Comment thread plugins/vocabbuilder.koplugin/main.lua Outdated
if button then
button:disable()
if not button then return end
if button.text == _("Add to vocabulary builder") then

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

That seems a tad unexpected as a condition compared to some other mode or property?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I thought it was the obvious way without adding another property. Should I add an ad-hoc property to the button like is_remove instead?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

A property or local variable makes the most sense to me, yes. I wouldn't expect a text = "something" assignment to be used like this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done.

@Frenzie Frenzie added this to the 2025.08 milestone Aug 2, 2025
@Frenzie Frenzie added the Plugin label Aug 2, 2025

@Frenzie Frenzie left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks.

return "ui", button.dimen
end)
else
UIManager:show(ConfirmBox:new{

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

is a confirmBox really necessary here? only asking if it wouldn't be better to directly undo without fuss

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Just in case that a word is not accidentally removed, especially when the word was added before with reviewing data. Since this button is rarely used, a little inconvenience should not be too much of a problem.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good point.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I was just trying this, and if a word was already in the vocab builder, if you try to add it again (by accident or not), it will prompt you to decide if you'd like to overwrite the existing data, so maybe we don't need the confimrbox after all?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

One might accidentally press the button twice during a lookup and scroll.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

that seems quite unlikely, or at least far less likely than simply adding one by accident, just mentioning it though, to see if anyone else has an opinion.

@Frenzie Frenzie merged commit bfd2bbb into koreader:master Aug 16, 2025
4 checks passed
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Vocabbuilder plugin: Long-press only to add words

3 participants