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

🐞 Respect Users Tab Width setting #80

Closed
austincondiff opened this issue Oct 6, 2022 · 4 comments · Fixed by #172
Closed

🐞 Respect Users Tab Width setting #80

austincondiff opened this issue Oct 6, 2022 · 4 comments · Fixed by #172
Assignees
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@austincondiff
Copy link
Collaborator

We need to respect the users Tab Width setting from the CodeEdit main app.

@lukepistrol lukepistrol added the bug Something isn't working label Nov 22, 2022
@lukepistrol
Copy link
Member

Could be implemented using https://github.com/ChimeHQ/TextFormation

@austincondiff austincondiff added the good first issue Good for newcomers label Dec 19, 2022
@austincondiff austincondiff moved this from 🆕 New to 🏃‍♂️ In Progress in CodeEdit Project Feb 17, 2023
@austincondiff
Copy link
Collaborator Author

@thecoolwinter @lukepistrol Is this fixed?

@thecoolwinter
Copy link
Collaborator

No there's a draft PR for this open. Needs clarification on what settings to support.

@thecoolwinter thecoolwinter moved this from 🏃‍♂️ In Progress to 👀 In Review in CodeEdit Project Mar 26, 2023
@thecoolwinter thecoolwinter moved this from 👀 In Review to 🏃‍♂️ In Progress in CodeEdit Project Mar 26, 2023
@thecoolwinter
Copy link
Collaborator

thecoolwinter commented Mar 26, 2023

There are two settings that need to be supported and #171 only fixes one:

  • Tab width: The visual space a tab character takes on the screen, usually measured in "number of spaces"
  • Indent behavior: What to insert on a tab key press. This can be either spaces (with a count) or tabs, which is what Indent Options and Clarify Tab Width #171 adds.

austincondiff pushed a commit that referenced this issue Mar 28, 2023
<!--- IMPORTANT: If this PR addresses multiple unrelated issues, it will
be closed until separated. -->

### Description

> This is a near clone of #147, but git got messed up on that branch.
This PR improves that branch anyways.

This enables configuration of the behavior when the tab key is pressed.
Previously all tabs were converted to spaces and inserted `tabWidth`
spaces in place of the tab character. This PR clarifies that the
`tabWidth` parameter should be used for the *visual* width of tabs, and
adds an `indentOption` parameter that specifies how to handle inserting
tab characters.

Adds an `IndentOption` enum with two cases for this behavior:
- `spaces(count: Int)`
- `tab`

If `spaces(count: Int)` is specified, the editor will insert the given
number of spaces when the tab key is pressed, otherwise the tab
character will be kept.

### Related Issues

<!--- REQUIRED: Tag all related issues (e.g. * #123) -->
<!--- If this PR resolves the issue please specify (e.g. * closes #123)
-->
<!--- If this PR addresses multiple issues, these issues must be related
to one other -->

* #80 - Does not close, needs an additional PR for the tab width
setting.

### Checklist

<!--- Add things that are not yet implemented above -->

- [x] I read and understood the [contributing
guide](https://github.com/CodeEditApp/CodeEdit/blob/main/CONTRIBUTING.md)
as well as the [code of
conduct](https://github.com/CodeEditApp/CodeEdit/blob/main/CODE_OF_CONDUCT.md)
- [x] The issues this PR addresses are related to each other
- [x] My changes generate no new warnings
- [x] My code builds and runs on my machine
- [x] My changes are all related to the related issue above
- [x] I documented my code

### Screenshots


https://user-images.githubusercontent.com/35942988/228014785-85a20e2e-0465-4767-9d53-b97b4df2e11e.mov
@thecoolwinter thecoolwinter mentioned this issue Apr 4, 2023
6 tasks
austincondiff pushed a commit that referenced this issue Apr 4, 2023
<!--- IMPORTANT: If this PR addresses multiple unrelated issues, it will
be closed until separated. -->

### Description

This PR adds the tab stops implementation. It was previously thought to
not function as expected but after comparing to other editors this is
the correct implementation. Adding tab stops makes it so tabs stop at
intervals along the document, so a tab will not act like a space but
rather a break in the line until the next tab stop. Like so:
```
Raw:   |\t1\t2\t3
Visual:|----1---2---3

Raw:   |\tabc\t2\t3
Visual:|----abc-2---3
```

### Related Issues

<!--- REQUIRED: Tag all related issues (e.g. * #123) -->
<!--- If this PR resolves the issue please specify (e.g. * closes #123)
-->
<!--- If this PR addresses multiple issues, these issues must be related
to one other -->

* Closes #80  

### Checklist

<!--- Add things that are not yet implemented above -->

- [x] I read and understood the [contributing
guide](https://github.com/CodeEditApp/CodeEdit/blob/main/CONTRIBUTING.md)
as well as the [code of
conduct](https://github.com/CodeEditApp/CodeEdit/blob/main/CODE_OF_CONDUCT.md)
- [x] The issues this PR addresses are related to each other
- [x] My changes generate no new warnings
- [x] My code builds and runs on my machine
- [x] My changes are all related to the related issue above
- [x] I documented my code

### Screenshots

Screen recording shows the width being updated in real time using a
placeholder preference, as well as editing a line with tabs showing the
tab stops go backwards only when needed.


https://user-images.githubusercontent.com/35942988/229870857-2cb2e40b-4c61-43ce-96c7-f79a8514cfbd.mov



<!--- REQUIRED: if issue is UI related -->

<!--- IMPORTANT: Fill out all required fields. Otherwise we might close
this PR temporarily -->
@github-project-automation github-project-automation bot moved this from 🏃‍♂️ In Progress to 🏁 Complete in CodeEdit Project Apr 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
Status: 🏁 Complete
Development

Successfully merging a pull request may close this issue.

3 participants