CodeEditorComponent, quick request


#1

It's not so tricky to do column editing, but rather than have to hack the CodeEditor component can I ask that you add a method to retrieve selectionStart as you have for caretPos. The only other change needed is to make CodeEditorComponent::updateCaretPosition() virtual so it can be overridden. With that it makes it possible to do some nice non-linear editing. 

[EDIT] sorry, i forgot to say that I also had to create a simple utility method in CodeEditorComponent to set the caret pos.  


#2

Probably easiest if you just send me your changed file so I can diff it..


#3

Here you go. These are based on the code in the latest tip. I couldn't attached any source code so I had rename with .txt ext.


#4

Another quick request, would it be possible for you to make CodeEditorComponenet::pasteFromClipboard() virtual? If implementing a column-edit mode it's important to be able to insert the contents of the clipboard to multiple lines at once. Thanks.


#5

Sounds intriguing! Sure, I can do that.


#6

It's actually surprising easy to do this given the flexibility of the CodeDocument and CodeDocument::Position class, and having updateCaretPosition virtual too. I could leave it at that, but now I would like to implement mulit-line backspace and delete, so I've had to make CodeEditorComponent::deleteBackwards() and CodeEditorComponent::deleteForwards() virtual too. I hope they are the last methods I need to make virtual. The only thing that I've not figured out is multi-line multi-char select and delete(draw a box type of select), but if users want that they can whistle for it! 


#7

This is wrapped up now. In the end I needed to make the following methods virtual:

CodeEditorComponent::deleteForwards()
CodeEditorComponent::deleteBackwards()
CodeEditorComponent::moveCaretRight()
CodeEditorComponent::moveCaretLeft()
CodeEditorComponent::pasteFromClipboard()
 

Here's a los-res gif of it in action:
http://www.imagebam.com/image/859f05317001883

I'm going to leave copy and cut operations out of it!