Skip to content

fix: make bracketed paste work like osc 52 paste#251

Open
timeopochin wants to merge 2 commits intorockorager:mainfrom
timeopochin:main
Open

fix: make bracketed paste work like osc 52 paste#251
timeopochin wants to merge 2 commits intorockorager:mainfrom
timeopochin:main

Conversation

@timeopochin
Copy link
Contributor

Fixes #85

Some notes:

  • As mentioned in the issue, the paste_allocator is unwrapped without any checks. After some testing, when it is null and cannot be unwrapped the zig compiler complains. So I took the liberty to add checks on the OSC 52 paste as well.
  • The way the paste event works currently needs the caller to free the text. In vxfw widgets, the events can be paste, but none of them handle that possibility leading to memory leaks. I will open another issue about this.
  • I'm not sure what was going on with the loop, it worked well and I imagine this is because escape sequences are almost always read in one go. But as soon as I started sending sequences in chunks, I got some weird and unexpected behaviour. This should be fixed with my changes, but it should definitely be checked in case I overlooked something.
  • The current implementation of the loop uses a fixed size buffer, leading to problems when an escape sequence is bigger than the buffer (pretty sure it only happens when pasting). For now I'm returning an error.EscapeSequenceTooLong but it might be better to implement a dynamic buffer in the case it ever exceeds the fixed size.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bracketed paste: use same event as OSC 52 paste

1 participant