kazzkiq / CodeFlask

A micro code-editor for awesome web pages.
https://kazzkiq.github.io/CodeFlask/
MIT License
1.07k stars 120 forks source link

Auto-indent on line break #62

Closed lol768 closed 5 years ago

lol768 commented 6 years ago

Unsure if there's another issue open for this, but it'd be nice if CodeFlask automatically added the same number of indenting characters (tabs/spaces) based on the previous line when hitting Enter

Steps to reproduce:

function foo() {
    // cursor is here: █ 

Result:

Expected result:

kazzkiq commented 6 years ago

I'm implementing it on the new version of CodeFlask. This is actually one of the last things missing before I publish the new version.

You can check the current status (aka. me failing miserably to make it work) here: https://github.com/kazzkiq/CodeFlask.js/blob/1.0/src/codeflask.js#L212

lol768 commented 6 years ago

Awesome to hear! What are the challenges associated with it?

simonwidjaja commented 5 years ago

Any news on this?

kazzkiq commented 5 years ago

Yes. It didn't worked as expected and is in the "TODO" list.

You can check the relevant code here: https://github.com/kazzkiq/CodeFlask/blob/master/src/codeflask.js#L235-L264

ShahinSorkh commented 5 years ago

@kazzkiq Now you can close this issue.

lol768 commented 5 years ago

Is this supposed to work on https://kazzkiq.github.io/CodeFlask/?

kazzkiq commented 5 years ago

@lol768 Yes.