-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
shell,core: add support for IMEs and on-screen keyboards
- Loading branch information
1 parent
c155fdf
commit c423b85
Showing
5 changed files
with
99 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
--mod-version:3 | ||
|
||
local core = require "core" | ||
|
||
local DocView = require "core.docview" | ||
local connector = require "libraries.connector" | ||
|
||
local last_x, last_y, last_w, last_h | ||
local function set_text_input_rect(x, y, w, h) | ||
if x ~= last_x or y ~= last_y or w ~= last_w or h ~= last_h then | ||
last_x, last_y, last_w, last_h = x, y, w, h | ||
connector.set_text_input_rect(x, y, w, h) | ||
end | ||
end | ||
|
||
local function recalculate_input_rect(view) | ||
-- set caret position | ||
local line1, col1, line2, col2 = view.doc:get_selection(true) | ||
local x, y = view:get_line_screen_position(line1) | ||
local h = view:get_line_height() | ||
local col = math.min(col1, col2) | ||
|
||
local x1, x2 = 0, 0 | ||
|
||
-- focus the whole text | ||
x1 = view:get_col_x_offset(line1, col1) | ||
x2 = view:get_col_x_offset(line2, col2) | ||
|
||
set_text_input_rect(x + x1, y, x2 - x1, h) | ||
end | ||
|
||
local docview_update = DocView.update | ||
function DocView:update(...) | ||
docview_update(self, ...) | ||
if core.active_view == self then | ||
connector.focus_text_input() | ||
recalculate_input_rect(self) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -83,7 +83,7 @@ canvas { | |
visibility: visible; | ||
} | ||
|
||
#clipping { | ||
.hidden { | ||
width: 0; | ||
height: 0; | ||
border: 0; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters