-
Notifications
You must be signed in to change notification settings - Fork 131
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
#605: Ctrl-V should not paste text twice #606
Conversation
Reviewer's Guide by SourceryThis pull request addresses the issue where Ctrl-V would paste text twice. The main changes include the introduction of a new utility function File-Level Changes
Tips
|
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.
Hey @lidaobing - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟡 General issues: 2 issues found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.
@@ -376,4 +376,13 @@ GtkImage* igtk_image_new_with_size(const char* filename, | |||
return GTK_IMAGE(gtk_image_new_from_pixbuf(pixbuf)); | |||
} | |||
|
|||
string igtk_text_buffer_get_text(GtkTextBuffer* buffer) { |
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.
suggestion: Consider using std::string instead of string.
To maintain consistency and avoid potential issues with ambiguous types, it's generally better to use std::string explicitly.
string igtk_text_buffer_get_text(GtkTextBuffer* buffer) { | |
std::string igtk_text_buffer_get_text(GtkTextBuffer* buffer) { |
string igtk_text_buffer_get_text(GtkTextBuffer* buffer) { | ||
GtkTextIter start, end; | ||
gtk_text_buffer_get_bounds(buffer, &start, &end); | ||
char* res1 = gtk_text_buffer_get_text(buffer, &start, &end, FALSE); |
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.
issue (bug_risk): Check for null pointer before using res1.
gtk_text_buffer_get_text can return NULL. It's safer to check if res1 is not NULL before using it to construct the string.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #606 +/- ##
=======================================
Coverage 51.36% 51.37%
=======================================
Files 64 64
Lines 8344 8345 +1
=======================================
+ Hits 4286 4287 +1
Misses 4058 4058 ☔ View full report in Codecov by Sentry. |
Summary by Sourcery
This pull request addresses a bug where using Ctrl-V to paste text would result in the text being pasted twice. The text pasting logic was refactored to use the 'paste-clipboard' signal, and a new test was added to ensure correct functionality.