Skip to content
This repository has been archived by the owner on Mar 13, 2021. It is now read-only.

Commit

Permalink
fix for org
Browse files Browse the repository at this point in the history
  • Loading branch information
philipparndt committed Nov 22, 2020
1 parent be17617 commit f70b3ed
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/ttOrg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class OrgParser implements tt.Parser {
}

isSeparatorRow(text: string): boolean {
return text.length > 1 && text[1] === horizontalSeparator;
return text.length > 1 && text[1] === horizontalSeparator && text.match(/^[+|-\s]+$/) ? true : false;;
}
}

Expand Down
19 changes: 18 additions & 1 deletion test/commands.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,24 @@ suite('Commands', () => {
| -1 | -1 |`;

await inTextEditor({language: 'markdown', content: testCase}, async (editor, document) => {
await cfg.override({mode: 'markdown'});
await cfg.override({mode: cfg.Mode.Markdown});
move(editor, 0, 1);
await vscode.commands.executeCommand('text-tables.gotoNextCell');

assert.equal(document.getText(), expected);
});
});

test('Regression: Format under cursor causes loss of data (org).', async () => {
const testCase =
`|A|B|
|-1|-1|`;
const expected =
`| A | B |
| -1 | -1 |`;

await inTextEditor({language: 'markdown', content: testCase}, async (editor, document) => {
await cfg.override({mode: cfg.Mode.Org});
move(editor, 0, 1);
await vscode.commands.executeCommand('text-tables.gotoNextCell');

Expand Down

0 comments on commit f70b3ed

Please sign in to comment.