Double pasting reintroduced #168

Closed
opened 1 year ago by cherti · 5 comments
cherti commented 1 year ago

with mouse=a set in nvim, when pasting via middle mouse button, the content of the according paste buffer is again pasted twice.

This issue was previously resolved via #103 and #102, but is now reintroduced via 5f64c5c335 unfortunately.

with `mouse=a` set in nvim, when pasting via middle mouse button, the content of the according paste buffer is again pasted twice. This issue was previously resolved via https://codeberg.org/dnkl/foot/pulls/103 and https://codeberg.org/dnkl/foot/pulls/102, but is now reintroduced via 5f64c5c33590a41afd3f621870c6abd89b859073 unfortunately.
dnkl added the
bug
label 1 year ago
dnkl self-assigned this 1 year ago
dnkl commented 1 year ago
Owner

Sorry about that. Thank you for bisecting! I obviously made a thinko while re-factoring that piece of code.

I wasn't able to reproduce, but I'm fairly sure I know what the problem is. Could you try this patch?

diff --git a/input.c b/input.c
index f399397..7635785 100644
--- a/input.c
+++ b/input.c
@@ -1625,13 +1625,15 @@ wl_pointer_button(void *data, struct wl_pointer *wl_pointer,
                     }
                 }
 
-                if (!term_mouse_grabbed(term, seat) &&
-                    cursor_is_on_grid)
-                {
-                    term_mouse_down(
-                        term, button, seat->mouse.row, seat->mouse.col,
-                        seat->kbd.shift, seat->kbd.alt, seat->kbd.ctrl);
-                }
+            }
+
+            if (!seat->mouse.consumed &&
+                !term_mouse_grabbed(term, seat) &&
+                cursor_is_on_grid)
+            {
+                term_mouse_down(
+                    term, button, seat->mouse.row, seat->mouse.col,
+                    seat->kbd.shift, seat->kbd.alt, seat->kbd.ctrl);
             }
             break;
         }
Sorry about that. Thank you for bisecting! I obviously made a thinko while re-factoring that piece of code. I wasn't able to reproduce, but I'm fairly sure I know what the problem is. Could you try this patch? ```diff diff --git a/input.c b/input.c index f399397..7635785 100644 --- a/input.c +++ b/input.c @@ -1625,13 +1625,15 @@ wl_pointer_button(void *data, struct wl_pointer *wl_pointer, } } - if (!term_mouse_grabbed(term, seat) && - cursor_is_on_grid) - { - term_mouse_down( - term, button, seat->mouse.row, seat->mouse.col, - seat->kbd.shift, seat->kbd.alt, seat->kbd.ctrl); - } + } + + if (!seat->mouse.consumed && + !term_mouse_grabbed(term, seat) && + cursor_is_on_grid) + { + term_mouse_down( + term, button, seat->mouse.row, seat->mouse.col, + seat->kbd.shift, seat->kbd.alt, seat->kbd.ctrl); } break; } ```
Poster

Yep, that seems to resolve it, thanks for fixing so quickly! :)

(I removed what is denoted in the patch with + and added what's denoted with -, just to be sure we are speaking about the same patch.)

Yep, that seems to resolve it, thanks for fixing so quickly! :) (I removed what is denoted in the patch with `+` and added what's denoted with `-`, just to be sure we are speaking about the same patch.)
dnkl commented 1 year ago
Owner

(I removed what is denoted in the patch with + and added what’s denoted with -, just to be sure we are speaking about the same patch.)

That... sounds wrong. - is what should be removed. + is the new "better" code :)

But I'm guessing you actually applied it correctly. You can always run git diff and you should see exactly the same diff.

Normally, though, you'd save the entire diff (not sure what it looked like in the email notification, but should be obvious where it starts and ends in the web UI) to a file on disk, the cd into a foot git clone and run patch -Np1 -i <path-to-diff-file>.

Once you're done, you can run git reset --hard origin/master to clean the the git clone and return it to a pristine state.

Once you're certain you've tested the correct patch, I'll push a fix and most likely do a patch release with this fix alone.

> (I removed what is denoted in the patch with + and added what’s denoted with -, just to be sure we are speaking about the same patch.) That... sounds wrong. `-` is what should be removed. `+` is the new "better" code :) But I'm guessing you actually applied it correctly. You can always run `git diff` and you should see exactly the same diff. Normally, though, you'd save the entire diff (not sure what it looked like in the email notification, but should be obvious where it starts and ends in the web UI) to a file on disk, the cd into a foot git clone and run `patch -Np1 -i <path-to-diff-file>`. Once you're done, you can run `git reset --hard origin/master` to clean the the git clone and return it to a pristine state. Once you're certain you've tested the correct patch, I'll push a fix and most likely do a patch release with this fix alone.
Poster

Wait a moment, let me double check…

Wait a moment, let me double check…
Poster

I doublechecked, yes, I get exactly this diff on master, and yes it resolves the issue. I probably have accidentially butchered the diff last time so that it wouldn't properly apply, but this time it applied properly and again resolves the issue when applied onto clean master. :)

I doublechecked, yes, I get exactly this diff on master, and yes it resolves the issue. I probably have accidentially butchered the diff last time so that it wouldn't properly apply, but this time it applied properly and again resolves the issue when applied onto clean `master`. :)
dnkl closed this issue 1 year ago
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

This issue currently doesn't have any dependencies.

Loading…
There is no content yet.