The :insert command was not working when typed in exline mode. This has
been fixed by creating a new gui_window_event, GW_EVENT_NORMAL_MODE.
With this commit, GW_EVENT_REMOVE_CARET *only* removes the caret.
GW_EVENT_NORMAL_MODE must be used to set the window to NORMAL mode.
---
I don't think upstream NetSurf will want this, since most browsers don't
have a normal mode.
desktop/browser_window.c | 1 +frontends/visurf/window.c | 11 +++++------include/netsurf/window.h | 5 +++++
3 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/desktop/browser_window.c b/desktop/browser_window.c
index 1ef7d80f3..c71efe2b3 100644
--- a/desktop/browser_window.c+++ b/desktop/browser_window.c
@@ -1724,6 +1724,7 @@ browser_window_callback(hlcache_handle *c, const hlcache_event *event, void *pw)
switch (event->data.caret.type) {
case CONTENT_CARET_REMOVE:
browser_window_remove_caret(bw, false);
+ guit->window->event(bw->window, GW_EVENT_NORMAL_MODE); break;
case CONTENT_CARET_HIDE:
browser_window_remove_caret(bw, true);
diff --git a/frontends/visurf/window.c b/frontends/visurf/window.c
index 7e6d4d7c3..175b604a9 100644
--- a/frontends/visurf/window.c+++ b/frontends/visurf/window.c
@@ -950,12 +950,11 @@ nsvi_window_event(struct gui_window *gw, enum gui_window_event event)
switch (event) {
case GW_EVENT_REMOVE_CARET:
gw->caret.enabled = false;
- if (win->tabs[win->tab] == gw) {- if (win->mode == INSERT) {- win->mode = NORMAL;- }- request_frame(win);- }+ request_frame(win);+ break;+ case GW_EVENT_NORMAL_MODE:+ win->mode = NORMAL;+ request_frame(win); break;
case GW_EVENT_START_THROBBER:
gw->throb = true;
diff --git a/include/netsurf/window.h b/include/netsurf/window.h
index 8ebbfee92..b1543b154 100644
--- a/include/netsurf/window.h+++ b/include/netsurf/window.h
@@ -127,6 +127,11 @@ enum gui_window_event {
* updated.
*/
GW_EVENT_PAGE_INFO_CHANGE,
++ /**+ * Set window to NORMAL mode+ */+ GW_EVENT_NORMAL_MODE,};
/**
--
2.34.1
I don't feel that the gui_window_event enum is ours to modify like this.
It oversteps our contract with the Netsurf core. Can you look into a
different approach?