rewrite highlight again :( finished the cursor part

pull/2/merge
Qingping Hou 12 years ago
parent 9aa9bc802f
commit 7c81f60a58

103
djvu.c

@ -229,37 +229,22 @@ static int getUsedBBox(lua_State *L) {
/*
* Return a table like following:
* {
* { -- a line entry
* words = {
* {word="This", x0=377, y0=4857, x1=2427, y1=5089},
* {word="is", x0=377, y0=4857, x1=2427, y1=5089},
* {word="Word", x0=377, y0=4857, x1=2427, y1=5089},
* {word="List", x0=377, y0=4857, x1=2427, y1=5089},
* },
* -- a line entry
* 1 = {
* 1 = {word="This", x0=377, y0=4857, x1=2427, y1=5089},
* 2 = {word="is", x0=377, y0=4857, x1=2427, y1=5089},
* 3 = {word="Word", x0=377, y0=4857, x1=2427, y1=5089},
* 4 = {word="List", x0=377, y0=4857, x1=2427, y1=5089},
* x0 = 377, y0 = 4857, x1 = 2427, y1 = 5089,
* },
*
* { -- an other line entry
* words = {
* {word="This", x0=377, y0=4857, x1=2427, y1=5089},
* {word="is", x0=377, y0=4857, x1=2427, y1=5089},
* },
* -- an other line entry
* 2 = {
* 1 = {word="This", x0=377, y0=4857, x1=2427, y1=5089},
* 2 = {word="is", x0=377, y0=4857, x1=2427, y1=5089},
* x0 = 377, y0 = 4857, x1 = 2427, y1 = 5089,
* },
* }
*
* 5 words in two lines
* {
* 1 = {word="This", x0=377, y0=4857, x1=2427, y1=5089},
* 2 = {word="This", x0=377, y0=4857, x1=2427, y1=5089},
* 3 = {word="This", x0=377, y0=4857, x1=2427, y1=5089},
* 4 = {word="This", x0=377, y0=4857, x1=2427, y1=5089},
* 5 = {word="This", x0=377, y0=4857, x1=2427, y1=5089},
* lines = {
* 1 = {last = 2, x0 = 377, y0 = 4857, x1 = 2427, y1 = 5089},
* 2 = {last = 5, x0 = 377, y0 = 4857, x1 = 2427, y1 = 5089},
* }
* }
*/
static int getPageText(lua_State *L) {
DjvuDocument *doc = (DjvuDocument*) luaL_checkudata(L, 1, "djvudocument");
@ -280,16 +265,10 @@ static int getPageText(lua_State *L) {
sexp = miniexp_cdr(sexp);
/* get number of lines in a page */
nr_line = miniexp_length(sexp);
/* the outer table */
/* table that contains all the lines */
lua_newtable(L);
/* create lines subtable */
lua_pushstring(L, "lines");
lua_newtable(L);
lua_settable(L, -3);
counter_l = 1;
counter_w = 1;
for(i = 1; i <= nr_line; i++) {
/* retrive one line entry */
se_line = miniexp_nth(i, sexp);
@ -298,7 +277,30 @@ static int getPageText(lua_State *L) {
continue;
}
/* subtable that contains words in a line */
lua_pushnumber(L, counter_l);
lua_newtable(L);
counter_l++;
/* set line position */
lua_pushstring(L, "x0");
lua_pushnumber(L, miniexp_to_int(miniexp_nth(1, se_line)));
lua_settable(L, -3);
lua_pushstring(L, "y0");
lua_pushnumber(L, miniexp_to_int(miniexp_nth(2, se_line)));
lua_settable(L, -3);
lua_pushstring(L, "x1");
lua_pushnumber(L, miniexp_to_int(miniexp_nth(3, se_line)));
lua_settable(L, -3);
lua_pushstring(L, "y1");
lua_pushnumber(L, miniexp_to_int(miniexp_nth(4, se_line)));
lua_settable(L, -3);
/* now loop through each word in the line */
counter_w = 1;
for(j = 1; j <= nr_word; j++) {
/* retrive one word entry */
se_word = miniexp_nth(j, se_line);
@ -334,44 +336,11 @@ static int getPageText(lua_State *L) {
lua_pushstring(L, word);
lua_settable(L, -3);
/* set word entry to outer table */
/* set word entry to line subtable */
lua_settable(L, -3);
} /* end of for (j) */
/* get lines table from outer table */
lua_pushstring(L, "lines");
lua_getfield(L, -2, "lines");
/* subtable that contains info for a line */
lua_pushnumber(L, counter_l);
lua_newtable(L);
counter_l++;
/* set line position */
lua_pushstring(L, "x0");
lua_pushnumber(L, miniexp_to_int(miniexp_nth(1, se_line)));
lua_settable(L, -3);
lua_pushstring(L, "y0");
lua_pushnumber(L, miniexp_to_int(miniexp_nth(2, se_line)));
lua_settable(L, -3);
lua_pushstring(L, "x1");
lua_pushnumber(L, miniexp_to_int(miniexp_nth(3, se_line)));
lua_settable(L, -3);
lua_pushstring(L, "y1");
lua_pushnumber(L, miniexp_to_int(miniexp_nth(4, se_line)));
lua_settable(L, -3);
lua_pushstring(L, "last");
lua_pushnumber(L, counter_w-1);
lua_settable(L, -3);
/* set line entry to lines subtable */
lua_settable(L, -3);
/* set lines subtable back to outer table */
/* set line entry to page text table */
lua_settable(L, -3);
} /* end of for (i) */

@ -23,117 +23,192 @@ function DJVUReader:_isWordInScreenRange(w)
end
function DJVUReader:toggleTextHighLight(word_list)
self:_toggleTextHighLightByEnds(word_list, 1, #word_list)
self:_toggleTextHighLight(word_list, 1, 1,
#word_list, #(word_list[#word_list]))
end
function DJVUReader:_toggleTextHighLightByEnds(t, end1, end2)
if end1 > end2 then
end1, end2 = end2, end1
function DJVUReader:_toggleTextHighLight(t, l0, w0, l1, w1)
print("haha", l0, w0, l1, w1)
-- make sure (l0, w0) is smaller than (l1, w1)
if l0 > l1 then
l0, l1 = l1, l0
w0, w1 = w1, w0
elseif l0 == l1 and w0 > w1 then
w0, w1 = w1, w0
end
for i=end1, end2, 1 do
if self:_isWordInScreenRange(t[i]) then
self:_toggleWordHighLight(t[i])
if l0 == l1 then
-- in the same line
for i=w0, w1, 1 do
if self:_isWordInScreenRange(t[l0][i]) then
self:_toggleWordHighLight(t, l0, i)
end
end
end
else
-- highlight word in first line as special case
for i=w0, #(t[l0]), 1 do
if self:_isWordInScreenRange(t[l0][i]) then
self:_toggleWordHighLight(t, l0, i)
end
end
for i=l0+1, l1-1, 1 do
for j=1, #t[i], 1 do
if self:_isWordInScreenRange(t[i][j]) then
self:_toggleWordHighLight(t, i, j)
end
end
end
-- highlight word in last line as special case
for i=1, w1, 1 do
if self:_isWordInScreenRange(t[l1][i]) then
self:_toggleWordHighLight(t, l1, i)
end
end
end -- EOF if l0==l1
end
function DJVUReader:_toggleWordHighLight(w)
local width = (w.x1-w.x0)*self.globalzoom
local height = (w.y1-w.y0)*self.globalzoom
function DJVUReader:_toggleWordHighLight(t, l, w)
local width = (t[l][w].x1 - t[l][w].x0) * self.globalzoom
local height = (t[l].y1 - t[l].y0) * self.globalzoom
fb.bb:invertRect(
w.x0*self.globalzoom-width*0.05,
self.offset_y+self.cur_full_height-(w.y1*self.globalzoom)-height*0.05,
width*1.1,
height*1.1)
t[l][w].x0*self.globalzoom-width*0.05,
self.offset_y+self.cur_full_height-(t[l].y1*self.globalzoom)-height*0.05,
width*1.1, height*1.1)
end
--function DJVUReader:_toggleWordHighLight(w)
--local width = (w.x1-w.x0)*self.globalzoom
--local height = (w.y1-w.y0)*self.globalzoom
--fb.bb:invertRect(
--w.x0*self.globalzoom-width*0.05,
--self.offset_y+self.cur_full_height-(w.y1*self.globalzoom)-height*0.05,
--width*1.1,
--height*1.1)
--end
-- remember to clear cursor before calling this
function DJVUReader:drawCursorAfterWord(w)
self.cursor:setHeight((w.y1 - w.y0) * self.globalzoom)
self.cursor:moveTo(w.x1 * self.globalzoom,
self.offset_y + self.cur_full_height - (w.y1 * self.globalzoom))
function DJVUReader:drawCursorAfterWord(t, l, w)
self.cursor:setHeight((t[l].y1 - t[l].y0) * self.globalzoom)
self.cursor:moveTo(t[l][w].x1 * self.globalzoom,
self.offset_y + self.cur_full_height
- (t[l].y1 * self.globalzoom))
self.cursor:draw()
end
function DJVUReader:drawCursorBeforeWord(t, l, w)
self.cursor:setHeight((t[l].y1 - t[l].y0)
* self.globalzoom)
self.cursor:moveTo(
t[l][w].x0*self.globalzoom - self.cursor.w,
self.offset_y + self.cur_full_height
- t[l].y1 * self.globalzoom)
self.cursor:draw()
end
function DJVUReader:startHighLightMode()
local t = self.doc:getPageText(self.pageno)
local function _getLineByWord(t, cur_w)
for k,l in ipairs(t.lines) do
if l.last >= cur_w then
return k
local function _findFirstWordInView(t)
-- @TODO maybe we can just check line by line here 22.03 2012 (houqp)
for i=1, #t, 1 do
for j=1, #t[i], 1 do
if self:_isWordInScreenRange(t[i][j]) then
return i, j
end
end
end
return nil
end
local function _findFirstWordInView(t)
for k,v in ipairs(t) do
if self:_isWordInScreenRange(v) then
return k
local function _prevWord(t, cur_l, cur_w)
if cur_l == 1 then
if cur_w == 1 then
-- already the first word
return 1, 1
else
-- in first line, but not first word
return cur_l, cur_w -1
end
end
return nil
end
local function _wordInNextLine(t, cur_w)
local cur_l = _getLineByWord(t, cur_w)
if cur_l == #t.lines then
-- already in last line, return the last word
return t.lines[cur_l].last
if cur_w <= 1 then
-- first word in current line, goto previous line
return cur_l - 1, #t[cur_l-1]
else
local next_l_start = t.lines[cur_l].last + 1
local cur_l_start = 1
if cur_l ~= 1 then
cur_l_start = t.lines[cur_l-1].last + 1
end
return cur_l, cur_w - 1
end
end
cur_w = next_l_start + (cur_w - cur_l_start)
if cur_w > t.lines[cur_l+1].last then
cur_w = t.lines[cur_l+1].last
local function _nextWord(t, cur_l, cur_w)
if cur_l == #t then
if cur_w == #(t[cur_l]) then
-- already the last word
return cur_l, cur_w
else
-- in last line, but not last word
return cur_l, cur_w + 1
end
return cur_w
end
if cur_w < #t[cur_l] then
return cur_l, cur_w + 1
else
-- last word in current line, move to next line
return cur_l + 1, 1
end
end
local function _wordInPrevLine(t, cur_w)
local cur_l = _getLineByWord(t, cur_w)
if cur_l == 1 then
-- already in first line, return 0
return 0
local function _wordInNextLine(t, cur_l, cur_w)
if cur_l == #t then
-- already in last line, return the last word
return cur_l, #(t[cur_l])
else
local prev_l_start = 1
if cur_l > 2 then
-- previous line is not the first line
prev_l_start = t.lines[cur_l-2].last + 1
end
local cur_l_start = t.lines[cur_l-1].last + 1
return cur_l + 1, math.min(cur_w, #t[cur_l+1])
end
end
cur_w = prev_l_start + (cur_w - cur_l_start)
if cur_w > t.lines[cur_l-1].last then
cur_w = t.lines[cur_l-1].last
end
return cur_w
local function _wordInPrevLine(t, cur_l, cur_w)
if cur_l == 1 then
-- already in first line, return the first word
return 1, 1
else
return cur_l - 1, math.min(cur_w, #t[cur_l-1])
end
end
local function _isMovingForward(l, w)
return l.cur > l.start or (l.cur == l.start and w.cur >= w.start)
end
local function _isMovingBackward(l, w)
return not _isMovingForward(l, w)
end
local start_w = _findFirstWordInView(t)
if not start_w then
local l = {}
local w = {}
l.start, w.start = _findFirstWordInView(t)
--local l.start, w.start = _findFirstWordInView(t)
if not l.start then
print("# no text in current view!")
return
end
local cur_w = start_w
local new_w = 1
l.cur, w.cur = l.start, w.start
l.new, w.new = l.cur, w.cur
local is_hightlight_mode = false
local is_meet_start = false
local is_meet_end = false
local running = true
self.cursor = Cursor:new {
x_pos = t[cur_w].x1*self.globalzoom,
x_pos = t[l.cur][w.cur].x1*self.globalzoom,
y_pos = self.offset_y + (self.cur_full_height
- (t[cur_w].y1 * self.globalzoom)),
h = (t[cur_w].y1 - t[cur_w].y0) * self.globalzoom,
- (t[l.cur][w.cur].y1 * self.globalzoom)),
h = (t[l.cur][w.cur].y1 - t[l.cur][w.cur].y0) * self.globalzoom,
line_width_factor = 4,
}
self.cursor:draw()
@ -144,169 +219,288 @@ function DJVUReader:startHighLightMode()
ev.code = adjustKeyEvents(ev)
if ev.type == EV_KEY and ev.value == EVENT_VALUE_KEY_PRESS then
if ev.code == KEY_FW_LEFT then
if cur_w >= 1 then
local is_next_view = false
if w.cur == 1 then
w.cur = 0
w.new = 0
else
if w.cur == 0 then
-- already at the left end of current line,
-- goto previous line (_prevWord does not understand
-- zero w.cur)
w.cur = 1
end
l.new, w.new = _prevWord(t, l.cur, w.cur)
end
if w.new ~= 0 and
not self:_isWordInScreenRange(t[l.new][w.new]) then
-- word is in previous view
local pageno = self:prevView()
self:goto(pageno)
is_next_view = true
else
-- no need to goto next view, clear previous cursor manually
self.cursor:clear()
end
-- update cursor
if w.cur == 0 then
-- meet line left end, must be handled as special case
self:drawCursorBeforeWord(t, l.cur, 1)
else
self:drawCursorAfterWord(t, l.new, w.new)
end
elseif ev.code == KEY_FW_RIGHT then
local is_next_view = false
if w.cur == 0 then
w.cur = 1
w.new = 1
else
l.new, w.new = _nextWord(t, l.cur, w.cur)
if w.new == 1 then
-- Must be come from the right end of previous line, so
-- goto the left end of current line.
w.cur = 0
w.new = 0
end
end
if w.new ~= 0 and
not self:_isWordInScreenRange(t[l.new][w.new]) then
local pageno = self:nextView()
self:goto(pageno)
is_next_view = true
else
self.cursor:clear()
end
if w.cur == 0 then
-- meet line left end, must be handled as special case
self:drawCursorBeforeWord(t, l.new, 1)
else
self:drawCursorAfterWord(t, l.new, w.new)
end
elseif ev.code == KEY_FW_UP then
local is_next_view = false
if w.cur == 0 then
-- goto left end of last line
l.new = math.max(l.cur - 1, 1)
elseif l.cur == 1 and w.cur == 1 then
-- already first word, to the left end of first line
w.new = 0
else
l.new, w.new = _wordInPrevLine(t, l.cur, w.cur)
end
if w.new ~= 0 and
not self:_isWordInScreenRange(t[l.new][w.new])
or w.new == 0 and not self:_isWordInScreenRange(t[l.new][1]) then
-- goto next view of current page
local pageno = self:prevView()
self:goto(pageno)
is_next_view = true
else
self.cursor:clear()
end
if w.new == 0 then
self:drawCursorBeforeWord(t, l.new, 1)
else
self:drawCursorAfterWord(t, l.new, w.new)
end
elseif ev.code == KEY_FW_DOWN then
local is_next_view = false
if w.cur == 0 then
-- on the left end of current line,
-- goto left end of next line
l.new = math.min(l.cur + 1, #t)
else
l.new, w.new = _wordInNextLine(t, l.cur, w.cur)
end
if w.cur ~= 0 and
not self:_isWordInScreenRange(t[l.new][w.new])
or w.cur == 0 and not self:_isWordInScreenRange(t[l.new][1]) then
-- goto next view of current page
local pageno = self:nextView()
self:goto(pageno)
is_next_view = true
else
self.cursor:clear()
end
if w.cur == 0 then
self:drawCursorBeforeWord(t, l.new, 1)
else
self:drawCursorAfterWord(t, l.new, w.new)
end
elseif ev.code == KEY_FW_PRESS then
if w.cur == 0 then
w.cur = 1
end
l.start, w.start = l.cur, w.cur
running = false
elseif ev.code == KEY_BACK then
running = false
return
end -- EOF if key event
l.cur, w.cur = l.new, w.new
fb:refresh(0)
end
end -- EOF while
print("!!!!cccccccc", l.start, w.start)
running = true
-- in highlight mode
while running do
local ev = input.waitForEvent()
ev.code = adjustKeyEvents(ev)
if ev.type == EV_KEY and ev.value == EVENT_VALUE_KEY_PRESS then
if ev.code == KEY_FW_LEFT then
is_meet_end = false
if not is_meet_start then
local is_next_view = false
new_w = cur_w - 1
l.new, w.new = _prevWord(t, l.cur, w.cur)
if new_w ~= 0 and
not self:_isWordInScreenRange(t[new_w]) then
if l.new == l.cur and w.new == w.cur then
is_meet_start = true
end
if l.new ~= 0 and w.new ~= 0 and
not self:_isWordInScreenRange(t[l.new][w.new]) then
-- word is in previous view
local pageno = self:prevView()
self:goto(pageno)
is_next_view = true
else
self.cursor:clear()
end
-- update cursor
if new_w == 0 then
-- meet top end, must be handled as special case
self.cursor:setHeight((t[1].y1 - t[1].y0)
* self.globalzoom)
self.cursor:moveTo(
t[1].x0*self.globalzoom - self.cursor.w,
self.offset_y + self.cur_full_height
- t[1].y1 * self.globalzoom)
self.cursor:draw()
else
self:drawCursorAfterWord(t[new_w])
end
if is_hightlight_mode then
-- update highlight
if new_w ~= 0 and is_next_view then
self:_toggleTextHighLightByEnds(t, start_w, new_w)
if w.new ~= 0 and is_next_view then
self:_toggleTextHighLight(t, l.start, w.start,
l.new, w.new)
else
self:_toggleWordHighLight(t[new_w+1])
self:_toggleWordHighLight(t, l.cur, w.cur)
end
end
end
elseif ev.code == KEY_FW_RIGHT then
-- only highlight word in current page
if cur_w < #t then
is_meet_start = false
if not is_meet_end then
local is_next_view = false
new_w = cur_w + 1
l.new, w.new = _nextWord(t, l.cur, w.cur)
if l.new == l.cur and w.new == w.cur then
is_meet_end = true
end
if not self:_isWordInScreenRange(t[new_w]) then
if not self:_isWordInScreenRange(t[l.new][w.new]) then
local pageno = self:nextView()
self:goto(pageno)
is_next_view = true
else
self.cursor:clear()
end
-- update cursor
self:drawCursorAfterWord(t[new_w])
if is_hightlight_mode then
-- update highlight
if is_next_view then
self:_toggleTextHighLightByEnds(t, start_w, new_w)
else
self:_toggleWordHighLight(t[new_w])
end
-- update highlight
if is_next_view then
self:_toggleTextHighLight(t, l.start, w.start,
l.new, w.new)
else
self:_toggleWordHighLight(t, l.new, w.new)
end
end
end -- EOF if is not is_meet_end
elseif ev.code == KEY_FW_UP then
is_meet_end = false
if not is_meet_start then
local is_next_view = false
new_w = _wordInPrevLine(t, cur_w)
l.new, w.new = _wordInPrevLine(t, l.cur, w.cur)
if new_w ~= 0 and
not self:_isWordInScreenRange(t[new_w]) then
if l.new ~= 0 and w.new ~= 0 and
not self:_isWordInScreenRange(t[l.new][w.new]) then
-- goto next view of current page
local pageno = self:prevView()
self:goto(pageno)
is_next_view = true
else
-- no need to jump to next view, clear previous cursor
self.cursor:clear()
end
if new_w == 0 then
-- meet top left end, must be handled as special case
self.cursor:setHeight((t[1].y1 - t[1].y0)
* self.globalzoom)
self.cursor:moveTo(
t[1].x0*self.globalzoom - self.cursor.w,
self.offset_y + self.cur_full_height
- t[1].y1 * self.globalzoom)
self.cursor:draw()
-- update highlight
if l.new ~=0 and w.new ~= 0 and is_next_view then
-- word is in previous view
self:_toggleTextHighLight(t, l.start, w.start,
l.new, w.new)
else
self:drawCursorAfterWord(t[new_w])
end
if is_hightlight_mode then
-- update highlight
if new_w ~= 0 and is_next_view then
-- word is in previous view
self:_toggleTextHighLightByEnds(t, start_w, new_w)
local tmp_l, tmp_w
if _isMovingForward(l, w) then
tmp_l, tmp_w = _nextWord(t, l.new, w.new)
self:_toggleTextHighLight(t, tmp_l, tmp_w,
l.cur, w.cur)
else
for i=new_w+1, cur_w, 1 do
self:_toggleWordHighLight(t[i])
end
end
end
l.new, w.new = _nextWord(t, l.new, w.new)
self:_toggleTextHighLight(t, l.new, w.new,
l.cur, w.cur)
l.new, w.new = _prevWord(t, l.new, w.new)
end -- EOF if is moving forward
end -- EOF if is previous view
end -- EOF if is not is_meet_start
elseif ev.code == KEY_FW_DOWN then
local is_next_view = false
new_w = _wordInNextLine(t, cur_w)
l.new, w.new = _wordInNextLine(t, l.cur, w.cur)
if not self:_isWordInScreenRange(t[new_w]) then
if not self:_isWordInScreenRange(t[l.new][w.new]) then
-- goto next view of current page
local pageno = self:nextView()
self:goto(pageno)
is_next_view = true
else
-- no need to jump to next view, clear previous cursor
self.cursor:clear()
end
-- update cursor
self:drawCursorAfterWord(t[new_w])
if is_hightlight_mode then
-- update highlight
if is_next_view then
-- redraw from start because of page refresh
self:_toggleTextHighLightByEnds(t, start_w, new_w)
-- update highlight
if is_next_view then
-- redraw from start because of page refresh
self:_toggleTextHighLight(t, l.start, w.start,
l.new, w.new)
else
-- word in next is in current view, just highlight it
if _isMovingForward(l, w) then
l.cur, w.cur = _nextWord(t, l.cur, w.cur)
self:_toggleTextHighLight(t, l.cur, w.cur,
l.new, w.new)
else
-- word in next is in current view, just highlight it
for i=cur_w+1, new_w, 1 do
self:_toggleWordHighLight(t[i])
end
end
end
l.cur, w.cur = _nextWord(t, l.cur, w.cur)
self:_toggleTextHighLight(t, l.cur, w.cur,
l.new, w.new)
end -- EOF if moving forward
end -- EOF if next view
elseif ev.code == KEY_FW_PRESS then
if not is_hightlight_mode then
is_hightlight_mode = true
start_w = cur_w
else -- pressed in highlight mode, record selected text
local first, last = 0
if start_w < cur_w then
first = start_w + 1
last = cur_w
else
first = cur_w + 1
last = start_w
end
--self:_toggleTextHighLightByEnds(t, first, last)
local hl_item = {}
for i=first,last,1 do
table.insert(hl_item, t[i])
end
if not self.highlight[self.pageno] then
self.highlight[self.pageno] = {}
end
table.insert(self.highlight[self.pageno], hl_item)
local first, last = 0
if w.start < w.cur then
first = w.start + 1
last = w.cur
else
first = w.cur + 1
last = w.start
end
--self:_toggleTextHighLightByEnds(t, first, last)
is_hightlight_mode = false
running = false
self.cursor:clear()
local hl_item = {}
for i=first,last,1 do
table.insert(hl_item, t[i])
end
if not self.highlight[self.pageno] then
self.highlight[self.pageno] = {}
end
end -- EOF if keyevent
cur_w = new_w
table.insert(self.highlight[self.pageno], hl_item)
is_hightlight_mode = false
running = false
self.cursor:clear()
elseif ev.code == KEY_BACK then
running = false
end -- EOF if key event
l.cur, w.cur = l.new, w.new
fb:refresh(0)
end -- EOF while
end
end
end -- EOF while
end

@ -43,7 +43,7 @@ function InputBox:addChar(char)
-- draw new text
local cur_index = (self.cursor.x_pos + 3 - self.input_start_x)
/ self.fwidth
self.input_string = self.input_string:sub(0,cur_index)..char..
self.input_string = self.input_string:sub(1,cur_index)..char..
self.input_string:sub(cur_index+1)
self:refreshText()
self.input_cur_x = self.input_cur_x + self.fwidth

@ -1005,6 +1005,7 @@ function UniReader:addAllCommands()
"start highlight mode",
function(unireader)
unireader:startHighLightMode()
unireader:goto(unireader.pageno)
end)
self.commands:add(KEY_HOME,MOD_SHIFT_OR_ALT,"Home",
"exit application",

Loading…
Cancel
Save