Skip to content
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

Backmerge: #5725 - Cursor position is incorrect when editing sequence in Macro mode #5813

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@ test.describe('Sequence edit mode', () => {
.first()
.click({ button: 'right' });
await page.getByTestId('edit_sequence').click();
await page.keyboard.press('ArrowRight');
await enterSequence(page, 'u');
await page.keyboard.press('Escape');
await takeEditorScreenshot(page);
Expand All @@ -208,7 +207,6 @@ test.describe('Sequence edit mode', () => {
.first()
.click({ button: 'right' });
await page.getByTestId('edit_sequence').click();
await page.keyboard.press('ArrowRight');
await enterSequence(page, 'u');
await page.keyboard.press('Escape');
await takeEditorScreenshot(page);
Expand All @@ -227,6 +225,7 @@ test.describe('Sequence edit mode', () => {
await openFileAndAddToCanvasMacro('KET/atuc.ket', page);
await takeEditorScreenshot(page);
await clickOnSequenceSymbol(page, 'T', { button: 'right' });
await page.keyboard.press('ArrowLeft');
await page.getByTestId('edit_sequence').click();
await enterSequence(page, 'u');
await takeEditorScreenshot(page);
Expand All @@ -247,7 +246,6 @@ test.describe('Sequence edit mode', () => {
.first()
.click({ button: 'right' });
await page.getByTestId('edit_sequence').click();
await page.keyboard.press('ArrowRight');
await enterSequence(page, 'u');
await page.keyboard.press('Escape');
await selectSnakeLayoutModeTool(page);
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ test.describe('Sequence mode selection for edit mode', () => {
await scrollDown(page, SCROLL_DOWN_VALUE);
await getSequenceSymbolLocator(page, 'G').click({ button: 'right' });
await page.getByTestId('edit_sequence').click();
await page.keyboard.press('ArrowLeft');
});

test('Select letters with LClick+drag', async ({ page }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,7 @@ test.describe('Sequence Mode', () => {
.first()
.click({ button: 'right' });
await page.getByTestId('edit_sequence').click();
await page.keyboard.press('ArrowLeft');
await page.keyboard.press('Delete');
await page.keyboard.press('Backspace');
await selectFlexLayoutModeTool(page);
Expand All @@ -558,6 +559,7 @@ test.describe('Sequence Mode', () => {
.first()
.click({ button: 'right' });
await page.getByTestId('edit_sequence').click();
await page.keyboard.press('ArrowLeft');
await page.keyboard.press('Backspace');
await selectFlexLayoutModeTool(page);
await takeEditorScreenshot(page);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export class SequenceMode extends BaseMode {
this.isEditMode = true;
this.initialize(false, needToRemoveSelection);
if (sequenceItemRenderer) {
SequenceRenderer.setCaretPositionByMonomer(
SequenceRenderer.setCaretPositionNextToMonomer(
sequenceItemRenderer.node.monomer,
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,22 @@ export class SequenceRenderer {
this.setCaretPosition(newCaretPosition);
}

public static setCaretPositionNextToMonomer(monomer: BaseMonomer) {
let newCaretPosition = -1;

SequenceRenderer.forEachNode(({ node, nodeIndexOverall }) => {
if (node.monomer === monomer) {
newCaretPosition = nodeIndexOverall;
}
});

if (newCaretPosition === -1) {
return;
}

this.setCaretPosition(newCaretPosition + 1);
}

public static setCaretPositionByNode(nodeToCompare: SubChainNode) {
let newCaretPosition = -1;

Expand Down
Loading