Use removal highlight range instead of removal range (#791)

Co-authored-by: Andreas Arvidsson <andreas.arvidsson@redpill-linpro.com>
This commit is contained in:
Andreas Arvidsson 2022-06-27 13:52:00 +02:00 committed by GitHub
parent 10c355f556
commit fde786db0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 56 additions and 3 deletions

View File

@ -50,7 +50,7 @@ class BringMoveSwap implements Action {
getSourceRangeCallback = getContentRange;
} else if (this.type === "move") {
sourceStyle = this.graph.editStyles.pendingDelete;
getSourceRangeCallback = getRemovalRange;
getSourceRangeCallback = getRemovalHighlightRange;
}
// NB this.type === "swap"
else {
@ -282,6 +282,6 @@ export class Swap extends BringMoveSwap {
}
}
function getRemovalRange(target: Target) {
return target.getRemovalRange();
function getRemovalHighlightRange(target: Target) {
return target.getRemovalHighlightRange();
}

View File

@ -0,0 +1,53 @@
languageId: plaintext
command:
spokenForm: move line air
version: 2
targets:
- type: primitive
mark: {type: decoratedSymbol, symbolColor: default, character: a}
modifiers:
- type: containingScope
scopeType: {type: line}
- {type: primitive, isImplicit: true}
usePrePhraseSnapshot: true
action: {name: moveToTarget}
initialState:
documentContents: |
a a a
b b b
c c c
selections:
- anchor: {line: 3, character: 0}
active: {line: 3, character: 0}
marks:
default.a:
start: {line: 0, character: 0}
end: {line: 0, character: 1}
finalState:
documentContents: |-
b b b
c c c
a a a
selections:
- anchor: {line: 2, character: 5}
active: {line: 2, character: 5}
thatMark:
- anchor: {line: 2, character: 0}
active: {line: 2, character: 5}
sourceMark:
- anchor: {line: 0, character: 0}
active: {line: 0, character: 0}
decorations:
- name: pendingDeleteBackground
type: line
start: {line: 0, character: 0}
end: {line: 0, character: 5}
- name: pendingModification0Background
type: token
start: {line: 3, character: 0}
end: {line: 3, character: 0}
- name: pendingModification0Background
type: token
start: {line: 2, character: 0}
end: {line: 2, character: 5}
fullTargets: [{type: primitive, mark: {type: decoratedSymbol, symbolColor: default, character: a}, modifiers: [{type: containingScope, scopeType: {type: line}}]}, {type: primitive, mark: {type: cursor}, modifiers: [{type: toRawSelection}]}]