Skip to content
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 #1

Open
wants to merge 2 commits into
base: base-sha/8653a31b23ca4b390fbada04782596bae42c38cf
Choose a base branch
from

Conversation

sourcery-ai-experiments-bot
Copy link
Collaborator

@sourcery-ai-experiments-bot sourcery-ai-experiments-bot commented Jun 24, 2024

Summary by Sourcery

This pull request addresses the issue where Ctrl-V would paste text twice by removing redundant text insertion logic. It also introduces a new helper function for retrieving text from GtkTextBuffer and adds unit tests to ensure the correct behavior of the text pasting functionality.

  • Bug Fixes:
    • Fixed issue where Ctrl-V would paste text twice by removing redundant text insertion logic.
  • Enhancements:
    • Refactored text buffer handling by introducing a new helper function to retrieve text from GtkTextBuffer.
  • Tests:
    • Added unit tests to verify correct behavior of text pasting functionality.

@sourcery-ai-experiments-bot
Copy link
Collaborator Author

This is a benchmark review for experiment review_of_reviews_20240624.
Run ID: review_of_reviews_20240624/benchmark_2024-06-24T00-18-48_v1-19-0-71-g205760417.

This pull request was cloned from https://github.com/iptux-src/iptux/pull/606. (Note: the URL is not a link to avoid triggering a notification on the original pull request.)

Experiment configuration
review_config:
  # User configuration for the review
  # - benchmark - use the user config from the benchmark reviews
  # - <value> - use the value directly
  user_review_config:
    enable_ai_review: true
    enable_rule_comments: false

    enable_complexity_comments: benchmark
    enable_security_comments: benchmark
    enable_tests_comments: benchmark
    enable_comment_suggestions: benchmark
    enable_functionality_review: benchmark

    enable_pull_request_summary: benchmark
    enable_review_guide: benchmark

    enable_approvals: true

  ai_review_config:
    # The model responses to use for the experiment
    # - benchmark - use the model responses from the benchmark reviews
    # - llm - call the language model to generate responses
    model_responses:
      comments_model: benchmark
      comment_validation_model: benchmark
      comment_suggestion_model: benchmark
      complexity_model: benchmark
      docstrings_model: benchmark
      functionality_model: benchmark
      security_model: benchmark
      tests_model: benchmark

# The pull request dataset to run the experiment on
pull_request_dataset:
- https://github.com/mraniki/MyLLM/pull/560
- https://github.com/Bilbottom/billiam-database/pull/92
- https://github.com/Bilbottom/loan-calcs/pull/1
- https://github.com/Bilbottom/sql-learning-materials/pull/28
- https://github.com/flet-dev/flet/pull/3522
- https://github.com/flet-dev/flet/pull/3523
- https://github.com/glenn-jocher/glenn-jocher/pull/15
- https://github.com/hbmartin/podcast-transcript-tools/pull/14
- https://github.com/joethesaint/Vue_0x01-Crash_Course/pull/9
- https://github.com/joethesaint/Vue_0x01-Crash_Course/pull/10
- https://github.com/pgarwol/medichain/pull/31
- https://github.com/pgarwol/medichain/pull/32
- https://github.com/pgarwol/medichain/pull/33
- https://github.com/pgarwol/medichain/pull/34
- https://github.com/MicroPanda123/bucket-webring/pull/1
- https://github.com/supabase-community/auth-py/pull/531
- https://github.com/supabase-community/auth-py/pull/532
- https://github.com/dreamerminsk/tasked/pull/59
- https://github.com/leaver2000/nzthermo/pull/23
- https://github.com/dreamerminsk/tasked/pull/58
- https://github.com/vicb/flyxc/pull/256
- https://github.com/CongLeSolutionX/conglesolutionx.github.io/pull/6
- https://github.com/CongLeSolutionX/conglesolutionx.github.io/pull/7
- https://github.com/CongLeSolutionX/conglesolutionx.github.io/pull/8
- https://github.com/CongLeSolutionX/conglesolutionx.github.io/pull/9
- https://github.com/CongLeSolutionX/conglesolutionx.github.io/pull/10
- https://github.com/CongLeSolutionX/conglesolutionx.github.io/pull/11
- https://github.com/Advik-B/LittleThings/pull/3
- https://github.com/theochem/iodata/pull/349
- https://github.com/theochem/iodata/pull/351
- https://github.com/theochem/iodata/pull/350
- https://github.com/iptux-src/iptux/pull/606
- https://github.com/iptux-src/iptux/pull/607
- https://github.com/EvickaStudio/PuzzelMVC/pull/1
- https://github.com/EvickaStudio/PuzzelMVC/pull/2
- https://github.com/EvickaStudio/PuzzelMVC/pull/3
- https://github.com/TeKrop/overfast-api/pull/145
- https://github.com/EvickaStudio/portfolio-website/pull/2
- https://github.com/EvickaStudio/portfolio-website/pull/3
- https://github.com/SilentDemonSD/WZML-X/pull/264
- https://github.com/R4vante/Physixed/pull/20
- https://github.com/R4vante/Physixed/pull/24
- https://github.com/bengosney/cerberus/pull/936
- https://github.com/yazdipour/OmnivoreQL/pull/27
- https://github.com/yazdipour/OmnivoreQL/pull/28
- https://github.com/gdsfactory/gdsfactory/pull/2904
- https://github.com/gdsfactory/kfactory/pull/407
- https://github.com/gdsfactory/cspdk/pull/47
- https://github.com/gdsfactory/gdsfactory/pull/2908
- https://github.com/gdsfactory/cspdk/pull/48
review_comment_labels:
- label: correct
  question: Is this comment correct?
- label: helpful
  question: Is this comment helpful?
- label: comment-type
  question: Is the comment type correct?
- label: comment-area
  question: Is the comment area correct?
- label: llm-test
  question: |
    What type of LLM test could this comment become?
    - 👍 - this comment is really good/important and we should always make it
    - 👎 - this comment is really bad and we should never make it
    - no reaction - don't turn this comment into an LLM test

# Benchmark reviews generated by running
#   python -m scripts.experiment benchmark <experiment_name>
benchmark_reviews: []

@SourceryAI
Copy link

SourceryAI commented Jun 24, 2024

Reviewer's Guide 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.

File-Level Changes

Files Changes
src/iptux/UiHelper.cpp
src/iptux/UiHelper.h
Added and declared a new helper function igtk_text_buffer_get_text to retrieve text from a GtkTextBuffer.
src/iptux/DialogBase.cpp
src/iptux/DialogPeer.cpp
Refactored text pasting logic to use the 'paste-clipboard' signal for better consistency and removed redundant code.
src/iptux/DialogPeerTest.cpp Added tests to verify that text is correctly pasted from the clipboard into the text buffer.

Tips
  • Trigger a new Sourcery review by commenting @sourcery-ai review on the pull request.
  • You can change your review settings at any time by accessing your dashboard:
    • Enable or disable the Sourcery-generated pull request summary or reviewer's guide;
    • Change the review language;
  • You can always contact us if you have any questions or feedback.

Copy link

@SourceryAI SourceryAI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @sourcery-ai-experiments-bot - 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

LangSmith trace

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) {

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 different string types, it's generally better to use std::string explicitly.

Suggested change
string igtk_text_buffer_get_text(GtkTextBuffer* buffer) {
std::string igtk_text_buffer_get_text(GtkTextBuffer* buffer) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this comment correct?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this comment helpful?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the comment type correct?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the comment area correct?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What type of LLM test could this comment become?

  • 👍 - this comment is really good/important and we should always make it
  • 👎 - this comment is really bad and we should never make it
  • no reaction - don't turn this comment into an LLM test

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);

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.

If gtk_text_buffer_get_text returns a null pointer, it could lead to undefined behavior when constructing the std::string.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this comment correct?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this comment helpful?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the comment type correct?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the comment area correct?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What type of LLM test could this comment become?

  • 👍 - this comment is really good/important and we should always make it
  • 👎 - this comment is really bad and we should never make it
  • no reaction - don't turn this comment into an LLM test

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.

3 participants