Skip to content

Commit

Permalink
fix(prompts): before and after are swapped in preview
Browse files Browse the repository at this point in the history
Closes: #119
  • Loading branch information
Blarc committed Jan 27, 2024
1 parent be0550d commit c5e3e25
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## [Unreleased]

### Fixed
- Diff "before" and "after" is swapped in "Edit Prompt" settings window.

## [1.5.0] - 2023-12-26

### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class AICommitAction : AnAction(), DumbAware {
val commitMessage = VcsDataKeys.COMMIT_MESSAGE_CONTROL.getData(e.dataContext)

runBackgroundableTask(message("action.background"), project) {
val diff = computeDiff(includedChanges, project)
val diff = computeDiff(includedChanges, false, project)
if (diff.isBlank()) {
sendNotification(Notification.emptyDiff())
return@runBackgroundableTask
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ object AICommitsUtils {

fun computeDiff(
includedChanges: List<Change>,
reversePatch: Boolean,
project: Project
): String {

Expand Down Expand Up @@ -89,7 +90,7 @@ object AICommitsUtils {
val filePatches = IdeaTextPatchBuilder.buildPatch(
project,
changes,
repository.root.toNioPath(), false, true
repository.root.toNioPath(), reversePatch, true
)

val stringWriter = StringWriter()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ class PromptTable {
.toList()

branch = commonBranch(changes, project)
diff = computeDiff(changes, project)
diff = computeDiff(changes, true, project)
setPreview(prompt.content)
}

Expand Down

0 comments on commit c5e3e25

Please sign in to comment.