New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Text input related fixes & enhancements #4124

Merged
merged 6 commits into from Aug 1, 2018

Conversation

Projects
None yet
3 participants
@poire-z
Contributor

poire-z commented Jul 30, 2018

InputText: checks whether provided content can be given back unaltered, which may not be the case after it is splitted to UTF8 chars if the text is binary content. Prevent editing text if that is the case.
See #4070 (comment)
Added InputText and InputDialog :isEditable() and :isEdited()

Virtual keyboard: Hold on Backspace: delete from cursor to start of line instead of clearing all text content. Shouldn't feel like too much a change on the most common single line InputTexts (it now deletes from cursor, but as these starts with cursor at end, it will work as clear all if used at start), and it is more convenient and useful (quicker lines deletion) on the newly possible multi lines edits. Closes #4129.

Also ensure a minimal size of the scrollbar thumb so it is rendered when huge text with many lines is displayed.
image

Also accounts for the scrollbar width when measuring text to prevent it from being displayed when not needed. For example:
When we didn't use a ScrollTextWidget:
tbw_noscroll

After the change to use a ScrollTextWidget:
tbw_bad

Still using ScrollTextWidget, but with this fix:
tbw_fixed

InputText: added isEditable() and isEdited()
Checks whether provided content can be given back
unaltered, which may not be the case after it is splitted
to UTF8 chars if the text is binary content.
Prevent editing text if that is the case.

Also accounts for the scrollbar width when measuring text
to prevent it from being displayed when not needed.

Also ensure a minimal size of the scrollbar thumb so it is
rendered when huge text with many lines is displayed.

@poire-z poire-z referenced this pull request Jul 30, 2018

Closed

Basic text editor plugin #4070

@@ -13,6 +13,7 @@ local VerticalScrollBar = Widget:new{
bordercolor = Blitbuffer.COLOR_BLACK,
radius = 0,
rectcolor = Blitbuffer.COLOR_BLACK,
min_thumb_size = Size.line.thick,

This comment has been minimized.

@Frenzie

Frenzie Jul 30, 2018

Member

Thumb? Wouldn't min_scrollbar_width or something make more sense or am I misunderstanding it completely?

This comment has been minimized.

@NiLuJe

NiLuJe Jul 30, 2018

Member

It's the actual scrollbar 'notch' for the current position, not the scrollbar itself. Which I somehow also forgot the usual name of :D.

This comment has been minimized.

@NiLuJe

NiLuJe Jul 30, 2018

Member

Well, apparently, the thumb, so, mystery solved :D.

This comment has been minimized.

@poire-z

poire-z Jul 30, 2018

Contributor

Well, I dunno how to name that little black area inside the full white inner scrollbar, that represents the current page size and position relative to the whole document.
When the document is big, and you're only displaying a little fraction of the document height (like in the screenshot above), the little black thing was sized 0 and not visible. So I decided to ensure a minimal size (actually height rather than width, so I named it "size" :| ).
I googled it and found "thumb" (may be in context where one could actually move it with the mouse or a finger...).
Any other name? notch then. or stick with thumb?
(Size.line.thick, cause it was the right size I needed :), the other Size.line were too small. Yeah, that's not a line, but it becomes a line when too small :) should I add something to Size.item ?)

This comment has been minimized.

@Frenzie

Frenzie Jul 30, 2018

Member

I thought that was called something like the grip or the knob but Gtk and Microsoft seem to call it the thumb.

https://en.wikipedia.org/wiki/Scrollbar

The “thumb” has different names in different environments: on the Mac OS X 10.4 it is called a "scroller";[3] on the Java platform it is called "thumb" or "knob"; Microsoft's .NET documentation refers to it as "scroll box" or "scroll thumb"; in other environments it is called "elevator", "quint", "puck", "wiper" or "grip".

Anyway, carry on then. Maybe add a comment saying what it is? Maybe it's just a weird gap in my knowledge. ;-)

@poire-z

This comment has been minimized.

Contributor

poire-z commented Jul 31, 2018

(Let this PR sits for a while, till I am sure these new methods are really usable by the text editor plugin)

poire-z added some commits Jul 31, 2018

@poire-z poire-z changed the title from InputText: add isEditable() and isEdited() to Text input related fixes & enhancements Aug 1, 2018

@poire-z

This comment has been minimized.

Contributor

poire-z commented Aug 1, 2018

Merging soon if no one is bothered by the Hold on Backspace change, so I can add more stuff to these files in a Text Editor plugin PR and avoid conflicts.

@Frenzie

This comment has been minimized.

Member

Frenzie commented Aug 1, 2018

bothered

I'm negative bothered by it since I think it's an improvement. ;-)

@poire-z poire-z merged commit 620542b into koreader:master Aug 1, 2018

1 check passed

ci/circleci Your tests passed on CircleCI!
Details

@poire-z poire-z deleted the poire-z:text_input_misc branch Aug 1, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment