CodeEditApp / CodeEditSourceEditor

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

Implement Tab Width #172

Closed thecoolwinter closed 1 year ago

thecoolwinter commented 1 year ago

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

Checklist

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

austincondiff commented 1 year ago

Really awesome dude, nice work! I am surprised at how little was required to get this to work.