Skip to content

Commit

Permalink
Fix tab to spaces replacement logic (#375)
Browse files Browse the repository at this point in the history
The existing implementation of converting a tab into spaces inadvertently includes an off-by-one error, producing one less space than desired.

Fixes #358
  • Loading branch information
MichaelByrneAU authored Aug 10, 2023
1 parent f4d6143 commit ba1938e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

### Fixed

- Fix tab-to-spaces conversion in the code editor which was resulting in one less space being produced on tab than desired.

## [0.18.0] - 2023-05-25

### Changed
Expand Down
2 changes: 1 addition & 1 deletion src/playground-code-editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ export class PlaygroundCodeEditor extends LitElement {
extraKeys: {
Tab: () => {
cm.replaceSelection(
Array(cm.getOption('indentUnit') ?? 2).join(' ')
Array((cm.getOption('indentUnit') ?? 2) + 1).join(' ')
);
},
// Ctrl + Space requests code completions.
Expand Down

0 comments on commit ba1938e

Please sign in to comment.