I’m trying to implement auto-indentation in my code blocks, and my first idea to do this is just get the text from the cursor and go back until it finds a newline character, and count the number of tabs inbetween. Then when the user presses enter it makes a new line and puts that many tabs.
What would be the easiest way to do this?