Skip to content

Conversation

goyalyashpal
Copy link

Problem: Currently a constant amount of spaces is inserted.
This makes it unsuitable for use as alignment
Solution: Insert only enough amount of spaces so that
cursor reaches next tab stop.

    Example:
    textEditor.options.tabSize = 5,
    selection.active.character = 23, (23 chars in line)
    indentEndCharacter = 2 (2 tabs in start)

    here,
        number of cols <- (23 - 2) + (2 * 5) = 31
    so,
        tillNextStop <- 5 - ((23 - 2) % 5) = 4
    => 4 spaces should be inserted

Pull Request

  • Feature/Addition implementation
  • Adjustment/Revision/Improvement implementation
  • Bug/Error fix
    • Typo / Grammar Mistake Fix
  • Internal Refactor or Cleanup (e.g.: formatting fixes)
  • Other: _____

Closes Issue(s): _____

Summary

Describe your changes in detail.

@goyalyashpal
Copy link
Author

ping @mfederczuk 😃

@mfederczuk
Copy link
Owner

@goyalyashpal I'll look at it soon, no need to double ping me 😅

@goyalyashpal
Copy link
Author

goyalyashpal commented Feb 2, 2024

hi! yeah thanks for reply. i just pinged as there was not much activity on the repo.

the ping was not as any sign of urgency. take ur time, i meant no haste.

sorry if it felt that way.

Problem: Currently a constant amount of spaces is inserted.
        This makes it unsuitable for use as alignment.
Solution: Insert just enough spaces for cursor to reach
        next tab stop.

    For example, let:
        line <- '\t\t123456789012<cur>'
        textEditor.options.tabSize <- 5
    here,
        selection.active.character = 14 (14 chars in line)
        indentEndCharacter         =  2 ( 2  tabs in start)
        number of cols <- (14 - 2) + (2 * 5) = 22
    so,
        tillNextStop   <- 5 - ((14 - 2) % 5) =  3
    => 3 spaces should be inserted
@goyalyashpal
Copy link
Author

hi @mfederczuk !

gentle reminder in case you forgot about this 😃

@mfederczuk
Copy link
Owner

@goyalyashpal I sure did forget about this.
Let me first get the codebase back to a presentable state (updating dependencies and such) and then I'll look at the PR.

@mfederczuk
Copy link
Owner

  1. Please rebase your branch onto the new state of the master branch
  2. The tab-stop behavior should also be if editor.insertSpaces is set to true, so please also implement it in that case
  3. Please also make sure that the code has no lint errors, especially now on the new master state since the lint rules have changed a bit (execute npm run lint to check)

@goyalyashpal goyalyashpal marked this pull request as draft September 7, 2025 10:58
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