Lines tools

From TED Notepad
Revision as of 14:36, 17 April 2007 by Jsimlo (talk | contribs)
You see work in progress here; this section already reflects future TED Notepad version 5.3.0.4.
This section may contain incomplete, premature, or mistaken information, prone to change without notice.

Indent (Ctrl+Tab)

Indents each line of the selection with a Tab character.

Note: The selection always persists in this tool.

Unindent (Ctrl+Shift+Tab)

Removes the first character on each line of the selection, if the character is a white-space.

Quote Mail (Ctrl+Q)

Indents (quotes) each line of the selection with a >_ phrase exactly the same way as a standard mail client would do upon replying to a message.

Note: The selection always persists in this tool.

Quote/Indent... (Alt+Ctrl+Q)

Asks for a Quote phrase to work with and then indents (quotes) the selection with the specified phrase at the beginning of each line. Optionally, only non-empty lines can be quoted.

Example: (an e-mail received from a user)
----- Original Message ----- Great notepad! Tabs, you need tabs for multiple documents. Cosmetic, supeficial,........ of course. But that's what people are looking for these days.
Result, using Quote: >_ and Only non-empty lines checked:
----- Original Message ----- > Great notepad! > Tabs, you need tabs for multiple documents. Cosmetic, supeficial,........ > of course. But that's what people are looking for these days.

Tip: If you are writting a list (or a table) in an HTML document, you may write all the lines of such a list first without having to bother with all the HTML tags. Then select all the lines, hit this Indent/Quote Selection... tool (hotkey Alt+Ctrl+Q) and enter phrase like <LI> as the Quote phrase.

Unquote (Ctrl+Shift+Q)

Takes the very first character of the selection as a quoting character. Then removes the first character on each line of the selection, if the character is the quoting character.

Note: It is very similar to the Unindent Selection tool, but it is not space-oriented only.

Shift Left (Alt+Ctrl+Shift+Q)

Removes the first character from each line of the selection, no matter what it is.

Note: Tabs are treated as single characters.

Tabify (Alt+Ctrl+O)

Tabifies the indentation of the selection by replacing leading Spaces with Tabs on each line. While replacing, the Spaces are being grouped together according to the Tab Size setting. Each set of Spaces is then replaced by a Tab.

If Tabs and Spaces are mixed together on the beginning of a line, the total white-space outcome is calculated first and then Tabs and then Spaces are used to fill the occupied white space. Tabs always precede Spaces and Spaces are used only, when a Tab would extend the original white-space outcome.

Note: Using this tool sould not generate any visible changes, when using a fixed-width fonts. However, some proportional fonts do not use the average character width for Spaces, thus a Tab may seem to be longer than a set of Spaces.

Note: This tool does not modify other than leading Spaces.

Untabify (Ctrl+Shift+O)

Untabifies the indentation of the selection by replacing leading Tabs with Spaces on each line. While replacing, the Tabs are being replaced by multiple Spaces according to the Tab Size setting.

If Tabs and Spaces are mixed together on the beginning of a line, the total white-space outcome is calculated first and then Spaces are used to fill the occupied white space.

Note: Using this tool sould not generate any visible changes, when using a fixed-width fonts. However, some proportional fonts do not use the average character width for Spaces, thus a Tab may seem to be longer than a set of Spaces.

Note: This tool does not modify other characters than leading Tabs.

Close... (Alt+Ctrl+C)

Asks for a Close with phrase to work with and then closes each line of the selection with the specified phrase. Optionally, only non-empty lines can be closed.

Result, using Close with: <br>; see example above:
----- Original Message ----- Great notepad!<br> <br> Tabs, you need tabs for multiple documents. Cosmetic, supeficial,........<br> of course. But that's what people are looking for these days.<br>

Tip: As the example above shows, if you are writting an HTML document, you may write all the text of such a document first without having to bother with all the HTML tags. Then select the text, hit this Close Lines... tool (hotkey Alt+Ctrl+C) and enter whatever phrase is needed after each line (e.g. a <bt> tag).

Tip: According to the tips and examples above, you may simply combine the Indent/Quote Selection... tool with Close Lines... tool in order to write paragraphs in an HTML document without having to bother with <p> tags at first. Write all the paragraphs first, each one on a single line (use word wrapping (hotkey Ctrl+W) in order to see entire paragraphs wrapped into several lines). Then select all the paragraphs and use both Indent/Quote Selection... and Close Lines... tools in order to add the <p> and </p> tags.

Trim Spaces (Ctrl+Shift+C)

Removes all white-spaces from the end of each line of the selection.

Columns, Numbers... (Alt+Ctrl+Y)

Cuts portions from each line and then gnerates new lines according to the given Output mask. The mask may contain any text, and may also include these special variables:

  • %0 - returns the entire original line.
  • %1-%9 - return the columns cut according to rules specified in the corresponding tab.
  • %d - returns a decimal number from the Counter. You may specify the Start and the Step.
  • %x - returns a lower case hexadecimal number from the Counter.
  • %X - returns an upper case hexadecimal number from the Counter.
  • %b - returns a binary number from the Counter.
  • %o - returns an octal number from the Counter.
  • %n - returns a simple newline.

All these veriables might be furthermore qualified with an aligning specifier:

  • < - aligns the entire column to the left, using spaces to fill the shorter lines from right.
  • > - aligns the entire column to the right, using spaces to fill the shorter lines from left.
  • + - aligns the entire column to the right, using 0 to fill the shorter lines from left.
  • ^ - aligns the entire column to the center, using spaces to fill the shorter lines from both sides.

Optionally, you may choose to Modify non-empty lines only, if you need to keep the empty lines intact.


Example of an Output mask. This mask will cut the first column from each line and place it in the results after a decimal number, colon and a space. The numbers will be aligned to the right by zeroes, so that they all have the same number of digits:

%+d, %1

Unique (Alt+Ctrl+X)

Searches the selection for equal lines and removes all duplicates. The order of the uniqued lines remains unchanged and from each two equal lines, the second one is removed.

Note: Use Shift+Alt+Ctrl+X hotkey in order to ignore case when matching duplicates.

Example:
how much wood would a woodchuck chuck if a woodchuck could chuck wood
Result:
how much wood would a woodchuck chuck if could

Tip: If you need, for example, a complete word listing of a document, use the Extended Replace tool in order to replace all the spaces, commas, dots, etc. by new lines. Then use this Unique Lines tool, which will give you the complete listing of all words.

Find duplicates... (Ctrl+Shift+X)

Works the same way as the Unique Lines tool does, but allows more options affecting the behavior of the tool:

  • All lines - identical to the behavior of the Unique Lines tool.
  • Only unique lines - only lines that does not have duplicates are included in the result.
  • Only duplicated lines - only lines that have at least one duplicate are included in the result.
Result of Only duplicated lines; see example above:
wood a woodchuck chuck

The Count duplicates option adds to the result the actual numbers of equal lines. Each resulting line will contain a number of its duplicates, written in brackets before the line.

Result of Count duplicates; see example above:
(1) how much (2) wood (1) would (2) a woodchuck (2) chuck (1) if (1) could

Additionally, Ignore case option may be specified to ignore case when matching duplicates. Leave empty lines option may be specified to spare empty lines from being uniqued to prevent joining of separate paragraphs.

Remove Empty (Ctrl+Shift+V)

Removes all empty lines from the selection. Other lines remain untouched.