Skip to content
This repository has been archived by the owner on Nov 14, 2024. It is now read-only.

Commit

Permalink
M68kDbccBlocksSelectionHandler: label -> DBcc blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
YannCebron committed Apr 19, 2022
1 parent ecb4e25 commit 87fbb08
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 3 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
- fix assertion via "Directives" reference documentation provider invoked on macro call [#44](https://github.com/YannCebron/m68kplugin/issues/44)

### Changed
- Improve _Edit | Extend/Shrink Selection_ for blocks inside conditional assembly/macro directives
- Improve _Edit | Extend/Shrink Selection_ for blocks inside
- conditional assembly/macro directives
- `DBcc` loops

## [0.1.4]
### Added
Expand Down
2 changes: 0 additions & 2 deletions docs/plan.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@
## Editing

- `EnterHandlerDelegate` smart indent? or `LineIndentProvider`
- expand/shrink selection:
- **WIP** "blocks" - stop at branch instructions
- `M68kCommaFlipper`: swap src\|dest if valid
- formatter
- documentation:
Expand Down
2 changes: 2 additions & 0 deletions plugin-resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@
implementation="com.yanncebron.m68kplugin.editor.M68kConditionalAssemblyBlocksSelectionHandler"/>
<extendWordSelectionHandler
implementation="com.yanncebron.m68kplugin.editor.M68kMacroBlocksSelectionHandler"/>
<extendWordSelectionHandler
implementation="com.yanncebron.m68kplugin.editor.M68kDbccBlocksSelectionHandler"/>
<lang.implementationTextSelectioner
language="M68k"
implementationClass="com.yanncebron.m68kplugin.editor.M68kImplementationTextSelectioner"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright 2022 The Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.yanncebron.m68kplugin.editor;

import com.yanncebron.m68kplugin.lang.psi.M68kDbccInstructionBase;
import com.yanncebron.m68kplugin.lang.psi.M68kLabelBase;

/**
* Extend selection to previous label (or keep current one) (inclusive) up to subsequent {@code dbCC} instruction (inclusive).
*/
class M68kDbccBlocksSelectionHandler extends M68kSelectionHandlerBase {

M68kDbccBlocksSelectionHandler() {
super(M68kLabelBase.class, true, M68kDbccInstructionBase.class, true);
}

}
5 changes: 5 additions & 0 deletions testData/editor/wordSelection/dbccInsideBlock.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
label
move.l d0,d<caret>1
dbf d0,label
rts
anotherLabel
5 changes: 5 additions & 0 deletions testData/editor/wordSelection/dbccInsideBlock_after.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<selection>label
move.l d0,d<caret>1
dbf d0,label</selection>
rts
anotherLabel
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ public void testMacroInsideBlock() {
doExpandTest(4);
}

public void testDbccInsideBlock() {
doExpandTest(4);
}

private void doExpandTest(int times) {
myFixture.configureByFile(getTestName(true) + ".s");
for (int i = 0; i < times; i++) {
Expand Down

0 comments on commit 87fbb08

Please sign in to comment.