Re: Python editors

  • From: Jamal Mazrui <empower@xxxxxxxxx>
  • To: programmingblind@xxxxxxxxxxxxx
  • Date: Thu, 22 Jul 2010 20:37:38 -0400

Below are some documentation excerpts that may help address some of the recent questions about EdSharp support for managing indentation in a language such as Python. Note, for example, that EdSharp can infer the indentation of the current document and that a JAWS sound scheme for indentation is included. These are taken from the F1 and Shift+F1 documentation files (the main documentation and the change history).


I do not expect folks to remember every feature, so hope these reminders are helpful. Let me know if you have further questions about any of this. I am sure that these features can be improved, and welcome suggestions and code contributions toward this end.

Jamal

Press Tab to indent the current line of text, or Shift+Tab to outdent it. If multiple lines of text are selected, these commands are applied to all of them. Press Alt+I to hear the number of indentation levels of the current line. The Trim Blanks command, Control+Shift+Enter, removes all indentation and trailing spaces at once, as well as removing more than two consecutive blank lines (when multiple lines are selected).

Press Alt+Shift+I to toggle a mode in which you are alerted to changes in indentation level, such as when using the up and down arrow keys. EdSharp will say how many levels in or out the indentation has changed. This mode also reverses the rols of the Enter and Shift+Enter keys.

When Indent Mode is off, you can start a new line of text with the same indentation as the current one by pressing Shift+Enter. By default, an indentation unit is two spaces. This may be changed with the Configuration Options command, Alt+Shift+C (or use Alt+Shift+M to manually edit settings in the EdSharp.ini file). To go to the first character of the current line after any indentation, press Alt+Home. To go to the last non-white space character, press Alt+End.

Press Control+I to go to the next code block, or Control+Shift+I to go to the previous one. EdSharp considers a line of text with less indentation to be part of a different code block. For example, if the cursor is inside a loop block, then Control+I will go to the line at the closing of the loop where a lower level of indentation resumes. In Ruby, this would be the line with the word "end" or a right brace (}) character. In Python, it would be the first line of code following the loop, since the change in indentation, itself, indicates the end of the loop.



Another approach to hearing indentation levels is a JAWS sound scheme contributed by Jim Homme. You can install it by pressing JAWSKey+F2 and choosing Settings Packager. In that program, press Control+O and enter Sounds4Stuff.zip. Then press Alt+I to import the settings.

You can now press Control+B to go to the next code block, or Control+Shift+B to go to the previous one. A block is defined as lines with the same or greater indentation/nesting. Control+I and Control+Shift+I have a similar purpose, but they move to the next or previous change in indentation, so they stop at nested blocks. EdSharp skips blank or commented lines with these commands.

Thus, Control+I will stop at a nested block, whereas Control+B will not, since it continues past lines with greater indentation. For example, if the cursor is inside a loop block, then Control+I will go to the line at the closing of the loop where a lower level of indentation resumes. In Ruby, this would be the line with the word "end". In Python, it would be the first line of code following the loop, since the change in indentation, itself, indicates the end of the loop.

The related query commands, Alt+B and Alt+I, help you understand code groupings without moving the cursor. They are examples of a new EdSharp feature where a key can have an alternate action if pressed twice in a row without moving the cursor. Alt+B says the rest of the current block, beginning at the current line. When toggled with a second press, it says the whole block, including lines prior to the current one, if any. Alt+I says the indentation level of the current line. When toggled, it reads the text of the preceding line with less indentation, which is typically the statement that introduced the current block, e.g., an if, for, or while statement. These commands are best learned by experimenting with familiar code.

Use the Infer Indent command, Alt+RightBracket, to hear what indent unit the current document seems to be using. EdSharp looks at the first line that starts with a space or tab character. If this key is pressed again without moving the cursor, that sequence of space or tab characters is configured as EdSharp's IndentUnit setting. This makes it easy to use the same indentation style as a file you have opened.


__________
View the list's information and change your settings at //www.freelists.org/list/programmingblind

Other related posts: