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

Fix: auto spacing detection doesnt work reliabily #1828

Merged
merged 2 commits into from
Sep 7, 2024
Merged

Fix: auto spacing detection doesnt work reliabily #1828

merged 2 commits into from
Sep 7, 2024

Conversation

abose
Copy link
Member

@abose abose commented Sep 7, 2024

Summary:
We've updated the behavior of the Tab Size setting in auto mode to address a misunderstanding in its implementation. Previously, we incorrectly equated the Tab Size with the number of tab characters used for indentation in a file. This has been corrected to reflect a more standard approach, ensuring a consistent and intuitive editing experience across various files.

Detailed Explanation:
The Tab Size setting determines the display width of a single tab character on the screen, not the number of tab characters used for indentation. In our previous approach, if a file was auto-detected to use two tab characters for indentation, we mistakenly set the Tab Size to 2. This interpretation was incorrect as Tab Size should define the width in spaces that a tab character occupies, which is conventionally 4 spaces.

New Behavior:
In auto mode, we now standardize the Tab Size to a fixed value of 4 spaces. This change means:

  • Regardless of the number of tabs used for indentation, the tab character will uniformly occupy 4 spaces on the screen.
  • If a file uses multiple tabs for a single indentation level (e.g., 2 tabs per indent), we calculate the effective indentation as number of tabs x 4 spaces. This ensures that the visual representation of indents remains consistent and clear.

Examples for Clarity:

  • Before Change:
    • File uses 2 tabs for indentation, auto-detected Tab Size: 2
    • Indentation appears inconsistent across files with different tab settings.
  • After Change:
    • File uses 2 tabs for indentation, fixed Tab Size in auto mode: 4
    • Effective indentation width: 2 tabs x 4 spaces = 8 spaces per indent level
    • Consistent display width for tabs across all files, enhancing readability.

User Customization:

  • Users can still override the auto-detected Tab Size for individual files via the status bar if specific adjustments are needed. However, global overrides for Tab Size are not available to maintain uniformity in auto mode.

This update aims to standardize how tab widths are handled in the editor, simplifying the user experience and preventing inconsistencies in text alignment and appearance.

@phoenixide
Copy link
Member

Thank You for making this pull request.

Copy link

sonarcloud bot commented Sep 7, 2024

@abose abose merged commit a089d09 into main Sep 7, 2024
17 checks passed
@abose abose deleted the x branch September 7, 2024 15:03
Sign up for free to 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.

2 participants