Skip to content

Commit ba1938e

Browse files
Fix tab to spaces replacement logic (#375)
The existing implementation of converting a tab into spaces inadvertently includes an off-by-one error, producing one less space than desired. Fixes #358
1 parent f4d6143 commit ba1938e

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1919

2020
## [Unreleased]
2121

22+
### Fixed
23+
24+
- Fix tab-to-spaces conversion in the code editor which was resulting in one less space being produced on tab than desired.
25+
2226
## [0.18.0] - 2023-05-25
2327

2428
### Changed

src/playground-code-editor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ export class PlaygroundCodeEditor extends LitElement {
478478
extraKeys: {
479479
Tab: () => {
480480
cm.replaceSelection(
481-
Array(cm.getOption('indentUnit') ?? 2).join(' ')
481+
Array((cm.getOption('indentUnit') ?? 2) + 1).join(' ')
482482
);
483483
},
484484
// Ctrl + Space requests code completions.

0 commit comments

Comments
 (0)