Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: add option to control behavior when rejecting new file diffs #114

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

Conversation

Copy link
Member

@ThomasK33 ThomasK33 commented Aug 8, 2025

Add option to control behavior when rejecting new file diffs

This PR adds a new configuration option on_new_file_reject that controls what happens when a user rejects a diff for a new file:

  • keep_empty (default): Leaves the empty buffer in place
  • close_window: Closes the placeholder split window

Previously, when rejecting a new file diff, the plugin would always try to delete the original buffer. This could cause issues when the buffer was reused from an existing empty buffer, leading to potential crashes when attempting to reopen a diff.

The PR includes:

  • New configuration option in config.lua with validation
  • Type definition in types.lua
  • Logic in diff.lua to track whether the original buffer was created by the plugin
  • Only delete the original buffer on reject if it was created by the plugin
  • Unit test to verify the fix works correctly

This change improves stability when working with new files and gives users more control over the UI behavior.

@ThomasK33 ThomasK33 marked this pull request as ready for review August 8, 2025 10:46
@ThomasK33 ThomasK33 linked an issue Aug 8, 2025 that may be closed by this pull request
@ThomasK33 ThomasK33 force-pushed the thomask33/feat_add_on_new_file_reject_option_to_control_empty_buffer_behavior branch from 44647fb to b350b53 Compare August 8, 2025 14:18
@ThomasK33 ThomasK33 force-pushed the thomask33/feat_redesign_diff_view_with_horizontal_layout_and_new_tab_options branch 2 times, most recently from 7ab50da to f8c7db8 Compare August 8, 2025 19:34
@ThomasK33 ThomasK33 force-pushed the thomask33/feat_add_on_new_file_reject_option_to_control_empty_buffer_behavior branch from b350b53 to 0bcb677 Compare August 8, 2025 19:34
@ThomasK33 ThomasK33 force-pushed the thomask33/feat_redesign_diff_view_with_horizontal_layout_and_new_tab_options branch from f8c7db8 to 763ee39 Compare August 10, 2025 16:22
@ThomasK33 ThomasK33 force-pushed the thomask33/feat_add_on_new_file_reject_option_to_control_empty_buffer_behavior branch from 0bcb677 to 00cc3d9 Compare August 10, 2025 16:22
@ThomasK33 ThomasK33 force-pushed the thomask33/feat_add_on_new_file_reject_option_to_control_empty_buffer_behavior branch from 00cc3d9 to fbe5b80 Compare September 3, 2025 15:16
@ThomasK33 ThomasK33 force-pushed the thomask33/feat_redesign_diff_view_with_horizontal_layout_and_new_tab_options branch from 763ee39 to 8879ae0 Compare September 3, 2025 15:16
Copy link
Member Author

ThomasK33 commented Sep 10, 2025
edited
Loading

Merge activity

  • Sep 10, 3:36 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Sep 10, 3:38 PM UTC: Graphite rebased this pull request as part of a merge.
  • Sep 10, 3:38 PM UTC: @ThomasK33 merged this pull request with Graphite.

@ThomasK33 ThomasK33 changed the base branch from thomask33/feat_redesign_diff_view_with_horizontal_layout_and_new_tab_options to graphite-base/114 September 10, 2025 15:36
@ThomasK33 ThomasK33 changed the base branch from graphite-base/114 to main September 10, 2025 15:36
Change-Id: Idc973b23ff2a00ce2e9142e8c2b941b114ef7059
Signed-off-by: Thomas Kosiewski <tk@coder.com>
@ThomasK33 ThomasK33 force-pushed the thomask33/feat_add_on_new_file_reject_option_to_control_empty_buffer_behavior branch from fbe5b80 to 990fe27 Compare September 10, 2025 15:37
@ThomasK33 ThomasK33 merged commit bcde80a into main Sep 10, 2025
1 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

[BUG] crashes with new files
1 participant

AltStyle によって変換されたページ (->オリジナル) /