MacDownApp / MacDownApp/macdown
Delete with spaces for tabs deletes multiple spaces when it shouldn't
Nobody has claimed this yet.
- Dominant language
- Rich Text Format
- Stars
- 9.8k
- Forks
- 1.2k
- PR merge metrics
- No merged PRs in 30d
Description
When "Insert spaces instead of tabs" is enabled, pressing delete removes multiple spaces even if there are less than four spaces before a non-whitespace character. From a couple minutes digging around the code, I _think_ all that would have to be changed is [this line](https://github.com/MacDownApp/macdown/blob/e263bd7c308df6a739a3a2574b28bd8fe4c96bed/MacDown/Code/Extension/NSTextView%2BAutocomplete.m#L258).
In addition, I think it would make for a better experience to have it only treat spaces as tabs only at the beginning of a line. Instead of now where if there are four spaces anywhere in a line it would delete all four.
Another thing, the reason I'm using spaces for tabs is because you can't adjust the tab length in the editor. The editor uses tabs that are (roughly) 3 columns long while the preview pane used 4 column tabs, making vertical alignment in code blocks frustrating.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in MacDown/Code/Extension/NSTextView+Autocomplete.m around line 258 and reproduce deletion with “Insert spaces instead of tabs” enabled. Check the behavior before a non-whitespace character and away from the beginning of a line. Done means fewer than four spaces are not deleted as a tab, and spaces are treated as tabs only at line starts.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- macos, objective-c
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100