I have a buffer with a C file. I also have a command called clang_format that I have to invoke. That command takes the selected region as input and reformats it. What I want to achieve is reformatting the complete buffer avoiding to loose the current position of the cursor. My initial attempt is:
- Code: Select all
def run(self, edit):
# Here I should save the current position of the cursor
# Here I should restore the position
Can anyone help me to fill in the blanks?
Thanks in advance.