Skip to content

fix format tab size and add detectIndentation for return file tab size - #99

Merged
heckmon merged 1 commit into
heckmon:mainfrom
iskepr:main
Aug 20, 2026
Merged

fix format tab size and add detectIndentation for return file tab size#99
heckmon merged 1 commit into
heckmon:mainfrom
iskepr:main

Conversation

@iskepr

Copy link
Copy Markdown
Contributor

Description

  • Fix tab re-indentation logic: Resolved cursor jumps, double-execution issues, and arithmetic overflow when modifying tab sizes.
  • Add detectIndentation(): Implemented auto-detection of the document's actual indentation size based on line diffs.

Usage

1. Initialize on File Open

Call detectIndentation() after loading the file content into the controller:

codeController.tabSize = codeController.detectIndentation();
_settings.addListener(_handleSettingsChanged);

2. Handle Settings Changes

Listen to setting updates and safely re-indent the document:

void_handleSettingsChanged() {
final nextTabSize = _settings.get<int>(AppSetting.tabSize); // new TabSize From Settingsif (codeController.tabSize == nextTabSize) return;
WidgetsBinding.instance.addPostFrameCallback(
(_) => codeController.reindentDocument(newTabSize: nextTabSize),
);
}

@heckmon

Copy link
Copy Markdown
Owner

I'll review it soon. currently I'm a little bit busy

@iskepr

Copy link
Copy Markdown
ContributorAuthor

Take your time

@heckmon
heckmon merged commit e7bf1e5 into heckmon:mainAug 20, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@iskepr@heckmon@beiyrss866-svg