CodeEditApp / CodeEditSourceEditor

A code editor view written in Swift powered by tree-sitter.
https://codeeditapp.github.io/CodeEditSourceEditor/documentation/codeeditsourceeditor
MIT License
510 stars 78 forks source link

✨ Command+Backspace Keyboard Shortcut to delete whole line #118

Closed MrDevel0per closed 1 year ago

MrDevel0per commented 1 year ago

Is your feature request related to a problem? Please describe.

No.

Describe the solution you'd like

In Xcode, one of the default keyboard shortcuts is , which deletes to the start of the line. This is used across several text editors and should be implimented in CodeEdit. This allows the user to delete an entire line of code to the start instead of having to either select the line or keep holding the backspace key.

Describe alternatives you've considered

I think this is the simplest solution and has the standard shortcut, although the shortcut could be changed to accommodate CodeEdit's other features. I think that the only other options would be either continuing to hold the delete key or some sort of "delete" icon next to the line in the CodeEditTextView.

Additional context

Here is a video in Xcode of what I am suggesting:

https://user-images.githubusercontent.com/104732280/212492621-d3f9e23f-9cec-4868-a984-9fcf12461da4.mov

In this video, I use the shortcut to delete the entire line, which makes editing code much easier.

austincondiff commented 1 year ago

One important thing to take note of, is it deletes all text on the line leading up to the cursors position and retains all text after it. As shown in the above video, if the cursor is placed at the end of the line, it will get rid of the entire lines contents but keep the line itself resulting in an empty line.

luah5 commented 1 year ago

@austincondiff I think this can be closed as it already works in STTextView:

https://user-images.githubusercontent.com/128280019/230992033-6338f619-34f0-402d-ab26-2b3a686f7f9b.mov