-
-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix copy to the linux system clipboard #120
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you for the contribution @Distantoff, and for the research into the cause!
i left one small piece of feedback, but other than that everything else looks good, and will merge it after doing some testing
(you can ignore this bot's feedback for now, it's just to flag anything else i might want to look at) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
This pull request addresses the Linux system clipboard functionality issue in the rainfrog project. The changes ensure that the arboard clipboard instance persists throughout the application's lifecycle.
- Implemented
CopyData
action insrc/app.rs
for centralized clipboard handling - Modified
src/components/editor.rs
to use action-based clipboard operations - Refactored
src/vim.rs
to send clipboard actions instead of direct clipboard access
Security implications: The changes don't introduce new security risks, as they primarily modify internal clipboard handling.
Performance: The modifications should have minimal impact on performance, with a slight increase in memory usage due to the persistent clipboard instance.
3 file(s) reviewed, 8 comment(s)
Edit PR Review Bot Settings | Greptile
@@ -115,6 +117,7 @@ impl<'a> Editor<'a> { | |||
|
|||
impl<'a, DB: Database + DatabaseQueries> Component<DB> for Editor<'a> { | |||
fn register_action_handler(&mut self, tx: UnboundedSender<Action>) -> Result<()> { | |||
self.vim_state.register_action_handler(self.command_tx.clone())?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: self.command_tx is None here, so this call will always fail
pub fn with_pending(self, pending: Input) -> Self { | ||
Self { mode: self.mode, pending } | ||
Self { mode: self.mode, pending, command_tx: None } | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: command_tx is set to None here, potentially losing the original transmitter
hm after taking another look at vim_state and the command_tx registration, i think it might be better to always initialize vim_state with a pointer to a function in editor.rs that does the message sending instead since it already has the command_tx initialized. i can make the edits directly after doing some testing if you dont mind |
Yes of course! Perhaps this is the best solution |
i couldn't get it to work with giving the vim_state a function pointer or closure to a function in editor, so i'll stick with your approach of having the command_tx registered in vim_state :) did some profiling and cloning the command_tx every transition doesnt have any performance impact |
Yes, cloning command_tx as far as I know just copies the reference, so the number of sender can be created a lot |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
closes #83 (hopefully)
Included in release v0.2.8 |
This MR contains the following updates: | Package | Update | Change | |---|---|---| | [achristmascarl/rainfrog](https://github.com/achristmascarl/rainfrog) | patch | `v0.2.7` -> `v0.2.8` | MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot). **Proposed changes to behavior should be submitted there as MRs.** --- ### Release Notes <details> <summary>achristmascarl/rainfrog (achristmascarl/rainfrog)</summary> ### [`v0.2.8`](https://github.com/achristmascarl/rainfrog/releases/tag/v0.2.8) [Compare Source](achristmascarl/rainfrog@v0.2.7...v0.2.8) <!-- Release notes generated using configuration in .github/release.yml at v0.2.8 --> #### What's Changed - fix copy to the linux system clipboard by [@​Distantoff](https://github.com/Distantoff) in achristmascarl/rainfrog#120 #### New Contributors - [@​Distantoff](https://github.com/Distantoff) made their first contribution in achristmascarl/rainfrog#120 **Full Changelog**: achristmascarl/rainfrog@v0.2.7...v0.2.8 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this MR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box --- This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40NDAuNyIsInVwZGF0ZWRJblZlciI6IjM3LjQ0MC43IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiXX0=-->
Hello! Thank you for your project, I liked it, but immediately I came across that the clipboard of the system was not working. I found the reason why this happens - the instance of arboard clipboard must run throughout the lifetime of the entire program..
Instead of copying text, signals are sent in the vim module, which are processed in the app, as well as components.