MacDownApp / MacDownApp/macdown

Delete with spaces for tabs deletes multiple spaces when it shouldn't

Open
#601 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.