Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Column Selection in text area

Does anybody know how to enable column selection in a textarea. I have absolutely no idea how after hours of searching google. Very new to javascript, html and css.

I would like to make it so you could just highlight the c's below and not the a's or b's and perform functions such as copy and paste, exactly the same way that column selection works in notepad++ but replacing the text selection done normally, rather than having to hold down alt. I am using monospaced typing.

bab
bcb
bcb
bcb
bab

Any help at all even just pointing me in the right direction would be greatly appreciated, thankyou

like image 649
Ryan White Avatar asked Nov 12 '22 22:11

Ryan White


1 Answers

Ace editor accomplishes this using multiple cursors. (Click here to see the demo and hold Alt while selecting.) It's not trivial to implement, but it is close to trivial to add the Ace editor to your site.

You can see the pull-request that added this feature with interesting bits here, here, here, and here. Overall looks to be about 1000 lines of code for that feature.

like image 122
cbednarski Avatar answered Nov 15 '22 00:11

cbednarski