Text editor improvements

Hi all,

while scripting in blender i found that some things could be automated, and so i started scripting. the script can be downloaded here.

so far i have:

* smart line break
* smart delete
* smart backspace

smart line break handles auto (un)indent and aligns lists.

# Example:
def function ():    # pressing return with the cursor after the ':'
    a = 1     # will automagically put the cursor before where you can type (auto indent)
    return a  # pressing return with the cursor after 'a' will put the cursor
        # at the beginning of this line (auto unindent)

function(arg1 = 1,
         arg2 = [1,
         arg3 = False) #each new line is automagically aligned to the previous

smart delete deletes all whitespace after the cursor.

# Example
def function():
    String = "Text"   # Pressing Delete with the cursor at the end of this line
    "Text2"  # will turn the line to the following

def funtion():
    String = "Text""Text2"

smart backspace handles whitespaces in groups of length of tab_width.
if for example tab_width is 4, then pressing backspace will backspace to the last multiple
of 4 spaces. it will act as if 4 spaces are one tab.

one thing however that i havent been able to make work, is to have this as an addon.
this because of the changing of older keys, which dont seem to exist before the splash-screen is clicked away.
so you have to open the script in blender in the text editor and run it. i myself have it open in my default blendfile, so i only have to click run. if someone knows a way around this, anyway, please tell me.

any C&C, requests and bug reports are welcome

have fun, DreamPainter

hey, how about text completion, templates or macros? None? meh, I’ll stick with vim or emacs… :stuck_out_tongue:

Is there a way to make a custom syntax highlight scheme? Sorry that’s a little offtopic.

Your script looks nice and such goodies would motivate to do something else with the text editor like RIB, POV, whatever…


Useful improvements. Thanks DreamPainter. I hope you’ll improve the text editor further. :yes:

well don’t know if not too complicated whish this was included in standard edit functions

how about having each function or class into an independant window to edit!

always looking where functions or class are located in a big file!

or may be have a list of class or functions where you can go very fast to edit

keep up the good work

happy 2.5