Skip to content

Commit

Permalink
Fix undo delete non-continuous selection
Browse files Browse the repository at this point in the history
  • Loading branch information
MonsterDruide1 committed Dec 30, 2022
1 parent 9db4961 commit 4e2e472
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/main/java/io/github/jadefalke2/actions/LineAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public void revert() {
switch (type){
case CLONE: //fallthrough to INSERT
case INSERT: deleteRows(true); break;
case DELETE: insertRows(previousLines, rows[0]); break;
case DELETE: insertRows(previousLines, rows); break;
case REPLACE: revertReplaceRows(); break;
}
}
Expand Down Expand Up @@ -115,10 +115,12 @@ private void insertEmptyRows(int amount) {
insertRows(tmpLines, rows[rows.length-1]+1);
}

private void insertRows (InputLine[] inputLines, int index){
private void insertRows (InputLine[] inputLines, int index) {
insertRows(inputLines, IntStream.range(index, index+inputLines.length).toArray());
}
private void insertRows (InputLine[] inputLines, int[] indices){
for (int i = 0; i < inputLines.length; i++){
int actualIndex = index + i;
script.insertRow(actualIndex, inputLines[i]);
script.insertRow(indices[i], inputLines[i]);
}
}

Expand Down

0 comments on commit 4e2e472

Please sign in to comment.