Not getting expected indentation with python scripts

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, MudGuard

Post Reply
User avatar
Dick7
Posts: 24
Joined: Mon Feb 02, 2004 6:55 am

Not getting expected indentation with python scripts

Post by Dick7 »

In a .py doc, when I type the line

while True:

or

def xxx():

or

if:

etc.

I expect the next line to be indented 4 spaces. But it's not indented at all. How can I set this?

Thanks
Dick
ben_josephs
Posts: 2464
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

TextPad's automatic indentation only works with C-like languages. In the help, under How to | Customize Settings | Document Properties you will see:
Automatically indent blocks

Indent a new line following a line ending with {, and reduce the indentation of a } on a line on its own. Maintain Indentation must also be set.
But you can achieve some of what you want by recording two macros and giving them convenient keyboard shortcuts:

To enter a newline and increase the indentation::
<Enter> <Space> <Space> <Space> <Space>

To enter a newline and reduce the indentation::
<Enter> <Backspace> <Backspace> <Backspace> <Backspace>
User avatar
Dick7
Posts: 24
Joined: Mon Feb 02, 2004 6:55 am

Post by Dick7 »

ben_josephs wrote:TextPad's automatic indentation only works with C-like languages. In the help, under How to | Customize Settings | Document Properties you will see:
Automatically indent blocks

Indent a new line following a line ending with {, and reduce the indentation of a } on a line on its own. Maintain Indentation must also be set.
But you can achieve some of what you want by recording two macros and giving them convenient keyboard shortcuts:

To enter a newline and increase the indentation::
<Enter> <Space> <Space> <Space> <Space>

To enter a newline and reduce the indentation::
<Enter> <Backspace> <Backspace> <Backspace> <Backspace>
Thanks for the info.

I can't seem to find how to assign keyboard shortcuts to macros..
Dick
ben_josephs
Posts: 2464
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

Configure | Preferences | Keyboard | Categories: Macros | Commands: <YourMacro>
User avatar
Dick7
Posts: 24
Joined: Mon Feb 02, 2004 6:55 am

Post by Dick7 »

ben_josephs wrote:Configure | Preferences | Keyboard | Categories: Macros | Commands: <YourMacro>
Thank you!
Dick
Post Reply