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

feat: new custom code editor #147

Merged

Conversation

MarcoCarnevali
Copy link
Collaborator

@MarcoCarnevali MarcoCarnevali commented Mar 21, 2022

Description

This PR removed the CodeEditor library in favor of a custom solution which is still built around the Highlighterjs wrapper library. This custom solution let us customise the textview easily. One thing I've done is building a LineGutter that would count the file lines on the left.
This is a Work in progress PR and I would love if someone can pull this and test it a litte bit.

Releated Issue

#36

Checklist (for drafts):

  • I read and understood the contributing guide as well as the code of conduct
  • My changes generate no new warnings
  • My code builds and runs on my machine
  • Review requested

Screenshots (if appropriate):

@MarcoCarnevali MarcoCarnevali force-pushed the feature/new-code-editor branch from d754f21 to 52adc05 Compare March 21, 2022 11:07
@lukepistrol
Copy link
Member

lukepistrol commented Mar 21, 2022

Some views still reference CodeEditor library

@MarcoCarnevali MarcoCarnevali force-pushed the feature/new-code-editor branch 4 times, most recently from 817d682 to ffff15d Compare March 21, 2022 15:44
@lukepistrol
Copy link
Member

Looks good! But it feels a bit slower opening a file and when typing the line-numbers jump around a few pixels

Screen.Recording.2022-03-21.at.17.15.15.mov

@MarcoCarnevali MarcoCarnevali force-pushed the feature/new-code-editor branch from ffff15d to d62916f Compare March 21, 2022 18:49
@austincondiff
Copy link
Collaborator

austincondiff commented Mar 21, 2022

Line numbers do not have a gray background and are center-right aligned on the line instead of top-right aligned. They are also secondary text while the current line number is primary.
image

@MarcoCarnevali MarcoCarnevali force-pushed the feature/new-code-editor branch from d62916f to e2f6052 Compare March 22, 2022 09:57
@MarcoCarnevali
Copy link
Collaborator Author

@lukepistrol Thank you for your test! I've updated the code and now it should perform much better!
@austincondiff I'll try my best to match Xcode look, but not sure if I can nail it on the first run as it also depends on the theme

@MarcoCarnevali MarcoCarnevali force-pushed the feature/new-code-editor branch from e2f6052 to ff19b7e Compare March 22, 2022 10:04
@MarcoCarnevali MarcoCarnevali force-pushed the feature/new-code-editor branch from ff19b7e to b5f924b Compare March 22, 2022 16:54
@MarcoCarnevali MarcoCarnevali marked this pull request as ready for review March 22, 2022 16:54
@MarcoCarnevali MarcoCarnevali changed the title [WIP] feat: new custom code editor feat: new custom code editor Mar 22, 2022
@MarcoCarnevali MarcoCarnevali force-pushed the feature/new-code-editor branch from b5f924b to 5dd87f3 Compare March 22, 2022 16:55
@lukepistrol lukepistrol merged commit a3583c3 into CodeEditApp:main Mar 22, 2022
xinix909 pushed a commit to xinix909/CodeTransfer that referenced this pull request Sep 7, 2024
<!--- IMPORTANT: If this PR addresses multiple unrelated issues, it will
be closed until separated. -->

### Description

> This is a near clone of CodeEditApp#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. * CodeEditApp#123) -->
<!--- If this PR resolves the issue please specify (e.g. * closes CodeEditApp#123)
-->
<!--- If this PR addresses multiple issues, these issues must be related
to one other -->

* CodeEditApp#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
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.

3 participants