~sircmpwn/visurf-devel

nsvi: fix insert command when entered in exline v3 APPLIED

Pranjal Kole: 1
 nsvi: fix insert command when entered in exline

 1 files changed, 4 insertions(+), 1 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~sircmpwn/visurf-devel/patches/27848/mbox | git am -3
Learn more about email & git

[PATCH v3] nsvi: fix insert command when entered in exline Export this patch

The :insert command was not working when typed in exline mode. This has
been fixed by using the bw->can_edit flag to determine whether the
window should go to normal mode.

The bw->can_edit flag is not available directly to visurf, so
browser_window_get_editor_flags has to be used to get its value.
---
The previous patch worked fine while testing for some reason, but the
logic was incorrect. ed_flags & BW_EDITOR_CAN_PASTE will give 1 if
BW_EDITOR_CAN_PASTE is set and 0 if it is not set, and
BW_EDITOR_CAN_PASTE will be set when bw->can_edit is true. We want false
when bw->can_edit is true and true when it is false. Therefore, this is
the correct logic.
 frontends/visurf/window.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/frontends/visurf/window.c b/frontends/visurf/window.c
index 7e6d4d7c3..d8d3020bd 100644
--- a/frontends/visurf/window.c
+++ b/frontends/visurf/window.c
@@ -947,11 +947,14 @@ static nserror
nsvi_window_event(struct gui_window *gw, enum gui_window_event event)
{
	struct nsvi_window *win = gw->window;
	browser_editor_flags ed_flags =
		browser_window_get_editor_flags(gw->bw);
	switch (event) {
	case GW_EVENT_REMOVE_CARET:
		gw->caret.enabled = false;
		if (win->tabs[win->tab] == gw) {
			if (win->mode == INSERT) {
			if (win->mode == INSERT &&
			    !(ed_flags & BW_EDITOR_CAN_PASTE)) {
				win->mode = NORMAL;
			}
			request_frame(win);
-- 
2.34.1
Pushed with some edits for style. Thanks!

To git@git.sr.ht:~sircmpwn/visurf
   6196e731e..940de57e2  master -> master