83 |
83 |
84 -- Clicking a form field automatically enters insert mode |
84 -- Clicking a form field automatically enters insert mode |
85 form_insert_mode = function (view, w) |
85 form_insert_mode = function (view, w) |
86 view:add_signal("form-active", function () |
86 view:add_signal("form-active", function () |
87 (w.search_state or {}).marker = nil |
87 (w.search_state or {}).marker = nil |
88 w:set_mode("insert") |
88 w:set_mode("normal") |
89 end) |
89 end) |
90 view:add_signal("root-active", function () |
90 view:add_signal("root-active", function () |
91 (w.search_state or {}).marker = nil |
91 (w.search_state or {}).marker = nil |
92 w:set_mode() |
92 w:set_mode() |
93 end) |
93 end) |
94 end, |
94 end, |
95 |
95 |
96 -- Stop key events hitting the webview if the user isn't in insert mode |
96 -- Stop key events hitting the webview if the user isn't in insert mode |
97 mode_key_filter = function (view, w) |
97 mode_key_filter = function (view, w) |
98 view:add_signal("key-press", function () |
98 view:add_signal("key-press", function () |
99 if not w:is_mode("insert") then return true end |
99 if not w:is_mode("normal") then return true end |
100 end) |
100 end) |
101 end, |
101 end, |
102 |
102 |
103 -- Try to match a button event to a users button binding else let the |
103 -- Try to match a button event to a users button binding else let the |
104 -- press hit the webview. |
104 -- press hit the webview. |