1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-11-02 08:57:19 -04:00

[view] try key events only when INSERT_MODE is ON

This commit is contained in:
Witold Filipczyk 2022-11-10 17:14:56 +01:00
parent ada4ebd842
commit 127b2f403b

View File

@ -1290,25 +1290,27 @@ try_form_action(struct session *ses, struct document_view *doc_view,
return FRAME_EVENT_IGNORED; return FRAME_EVENT_IGNORED;
#ifdef CONFIG_ECMASCRIPT #ifdef CONFIG_ECMASCRIPT
std::map<int, xmlpp::Element *> *mapa = (std::map<int, xmlpp::Element *> *)doc_view->document->element_map; if (ses->insert_mode == INSERT_MODE_ON) {
std::map<int, xmlpp::Element *> *mapa = (std::map<int, xmlpp::Element *> *)doc_view->document->element_map;
if (mapa) { if (mapa) {
auto element = (*mapa).find(link->element_offset); auto element = (*mapa).find(link->element_offset);
if (element != (*mapa).end()) { if (element != (*mapa).end()) {
const char *event_name = script_event_hook_name[SEVHOOK_ONKEYDOWN]; const char *event_name = script_event_hook_name[SEVHOOK_ONKEYDOWN];
check_element_event(element->second, event_name, ev); check_element_event(element->second, event_name, ev);
event_name = script_event_hook_name[SEVHOOK_ONKEYUP]; event_name = script_event_hook_name[SEVHOOK_ONKEYUP];
check_element_event(element->second, event_name, ev); check_element_event(element->second, event_name, ev);
}
} }
}
if (!current_link_evhook(doc_view, SEVHOOK_ONKEYDOWN)) { if (!current_link_evhook(doc_view, SEVHOOK_ONKEYDOWN)) {
status = FRAME_EVENT_IGNORED; status = FRAME_EVENT_IGNORED;
} }
if (status != FRAME_EVENT_IGNORED && !current_link_evhook(doc_view, SEVHOOK_ONKEYUP)) { if (status != FRAME_EVENT_IGNORED && !current_link_evhook(doc_view, SEVHOOK_ONKEYUP)) {
status = FRAME_EVENT_IGNORED; status = FRAME_EVENT_IGNORED;
}
} }
#endif #endif
if (status != FRAME_EVENT_IGNORED) { if (status != FRAME_EVENT_IGNORED) {