external data (and in bad cases our own) can contain invalid byte
sequences in UTF8 strings. A prominent example are file names.
There was a 1-off bug in calculating the allowed length for multibyte
chars, and the iterator was a bit too greedy when stumbling upon
invalid sequences, returning a single "invalid" char for a sequence
up to the point where it became invalid in calculation. Now, we present
one invalid char for the first byte of that sequence and then check
for a valid char starting with the next byte.
This is the remaining gruntwork of #1276. I believe that only leaves networkmgr.lua and filemanagersearch.lua, which will require a little more thought.
our network manager script isn't the beauty of the code base.
However, this fixes a case where it would crash the reader when an
external command fails.
fixes#1279.
in order to have debugging facilities in framebuffer:init(), we hand
over the debug function as soon as we can.
Also, set a viewport for Kobo Mini. Hopefully, it fits most people -
I can only test on my unit.
This allows for Viewport debugging. It is configured via an environment
variable, EMULATE_READER_VIEWPORT. It works with Lua table syntax, e.g.:
EMULATE_READER_VIEWPORT="{x=10,w=550,y=5,h=790}"
the height of filechooser is provided when creating filechooser
widget since there may be no title as in filemanger which needs
a special title widget to contain filemanger menu.
Since the new Screen:getSize modthod returns a regular table
instead of a Geom which is set to the dimen field of readerview,
there is no copy method in the dimen field. And we don't need to
copy dimen any more since the result won't be modified. Even the
screen page area somehow needs to be modified, the caller of this
function should make a copy of that variable by itself.
Events have been passed to the frontend/device (or /input) code before.
Some of them have been handled in the FFI/input code, however. That
seems to be highly critical with regard to timing, though, so we just
let it enqueue the event for our code to process later. That way, a
mutex that locks the input event queue can be freed faster.
Lots of the device-related distinction wandered into
base/ffi/framebuffer_<driver>. This eases the refresh logic in
UI manager, which basically only decides what kind of refresh
to trigger. The device specific configuration in the framebuffer
driver decides how to realize that whish.
screen.lua is gone, in its place is now the framebuffer driver.
The device abstraction decides what framebuffer driver to load.
While looking into #1219 I accidentally ended up refactoring some stuff.
Tested in emulator and on H2O, but be wary because I might have overlooked something.
Don't increase counter for regional updates
Also some workarounds for Kobos
Try to avoid update_regions_func poisoning
Reset it at the end of repaint() even if nothing was found dirty
Ensure regional updates are always PARTIAL, in
case we get a region attached to an automatically triggered refresh, not
marked force_partial [which, hey, shouldn't happen, but apparently does
sometimes ^^]
This adds more documentation about the viewport offset calculations
for refreshing rotated viewports.
The old behaviour also was (still) buggy, even after the latest round
of fixes. Now, the offsets when rotated are hopefully calculated correct.
This will convert any file name to lowercase before doing the comparison.
Note that this will only work for ASCII character range, a full Unicode
aware solution will be much more complicated. And in the end, file names
are byte arrays, not character strings ;-)
fixes#1183.
The strcoll() workaround we had in place for Kobo devices was (or has
become) ineffective. We had set self.strcoll to nil on Kobo devices -
but this was the instance variable. Setting it to nil effectively makes
the instance variable vanish, so when trying to access it later, it
was not there and got looked up via the metatable - which had the original
reference. Setting it to nil had no effect whatsoever.
We simplify that approach and set the replacement function where before we
had set this to nil.
This is a partial fix for issue #1183 (and explains a comment in issue #686
which says that the old fix did not work).
However, to really fix#1183 - if we want to do so - we would need a collate
function that normalizes uppercase/lowercase before compare.
The calculation did not correctly calculate the offset in rotated
modes when the rotation was 90 or 270 degrees. Under these circumstances,
getWidth() and getHeight() did return rotated values for the framebuffer,
while Device.viewport did return not rotated values.
Since commit 12a76fee33, we had a potential
bug on the event mechanism:
It introduced (besides the checkTasks method itself) a second run of the
checkTasks() method. In the second run, however, scheduled events were
not taken into consideration in how long to wait for input events
afterwards.
So when the after the first run of checkTasks() there were new scheduled
tasks added to the task queue, they were not properly scheduled and
and depended on an already existing scheduled event or an input event
to trigger.
This might have led to unexpected order of execution (though the order
is not guaranteed by the task scheduling anyway!) or to events triggering
not at all until the next input event.
And koreader release version is normalized to a 10 digits containing
a four digits year field followed by a two digits month field followed
by a four digits revision field like "2014041079".
Don't do regional footer refreshes when we're in flipping mode.
There's probably a more elegant/correct way to handle this, but this
does the job ;).
Fix#1140
the cache would behave badly when the same item was insert()ed twice:
it would add the size twice to memory consumption, but would never substract
it twice when purging the (actually single) object from cache. So the cache
would seem to fill up while in fact it wasn't.
re #1119
AUTO appears to be doing the right thing...
(even if that baffles me, given the state of the Kernel sources,
unless they flip some switches at compile time
[NTX_WFM_MODE_OPTIMIZED_REAGL / NO_AUTO_REAGL_MODE] ...)
Anyway, that's what nickel does, so follow its lead ;).
and remove the wifi toggler on the footer of each menu page,
so that network status is only checked (currently with the stdout of ip cmd)
when navigating to the "Network settings" submenu instead of checking
on each menu popup.
Don't hijack forced partial updates (i.e., from UI elements) on always
FULL REAGL devices. It doesn't implode if we don't, and it makes for a
snappier UI.