Editing Queries, Scripts and Comments

The usual Edit menu commands, such as Edit - Find, Edit - Find Previous, Edit - Find Next and Edit-Replace work as we expect in text component windows such as queries and scripts windows (both of which use a Command Window) and also comments  and locations text windows.

Automatic Updates

There is no need to command a "save" when editing a text component such as comments, locations, queries, or scripts.   Manifold automatically saves changes every 5 seconds. Switching to a different component window saves changes immediately.   Manifold does not save changes on every keystroke because that can be very inefficient when a component is stored on a remote database and the connection is slow. Saving every 5 seconds provides a big improvement in usability for such connections.   

Keyboard Shortcuts

Editing text allows us to use keyboard shortcuts, many of which are standard in Windows:

 

Click and drag

Clicking and dragging over text highlights that text.

Double-click

Double-click to smart highlight a word, white space, an identifier, or an ellipsis.

Ctrl-A

Highlight all.

Ctrl-C

Copy to the clipboard.

Ctrl-X

Cut to the clipboard.

Ctrl-V

Paste from the clipboard.

Ctrl-K

Comment the line.  (Queries and Scripts only)  Edit - Advanced - Comment Lines

Shift-Ctrl-K

Uncomment the line.  (Queries and Scripts only)  Edit - Advanced - Uncomment Lines

Ctrl-T

Increase line indent.  Edit - Advanced - Increase Line Indent

Shift-Ctrl-T

Decrease line indent.  Edit - Advanced - Decrease Line Indent

Ctrl-U

Make highlighted text lower case.  Edit - Advanced - Make Lower Case

Shift-Ctrl-U

Make highlighted text upper case.  Edit - Advanced - Make Upper Case

Arrow keys

Move the cursor in the direction of the arrow.

Page Up / Down

Move the cursor one window up or down.

Home

Move the cursor to the left-most character of the current line.

End

Move the cursor to the right-most character of the current line.

Ctrl-Home

Move the cursor  to the first line.

Ctrl-End

Move the cursor to the last line.

Ctrl-F

Edit - Find

Shift-F3

Edit - Find Previous

F3

Edit - Find Next

Ctrl-H

Edit - Replace

Ctrl-]

Move cursor to matching bracket. Available when cursor is next to a bracket.  <>, [], (), {} match across lines.   #, ' and " match within same line only.  

Shift-Ctrl-]

Move cursor to matching bracket and select all in between, inclusive.  Available when cursor is next to a bracket.  <>, [], (), {} match across lines.  #,  ' and " match within same line only.

 

Command Window - SQL Query Builder

 Drag and Drop

Add the name of a table or drawing and all fields to the Tables pane of the query builder.

(filter boxes)

Show only those items that contain text matching the text in the filter box, case not significant.

Double-click

Add this item to the query text, replacing any highlighted text.

Right-click - Insert Definition

When right-clicking a table name, insert SQL to create this table in the query.

Right-click - Insert Field List

When right-clicking a table name, insert a list of all fields in the table into the query.

Double-Click to Smart Highlight

Smart highlighting automatically highlights a useful collection of characters based on double-clicking white space, a word, an identifier, or an ellipsis.   The cursor in illustrations below show where we have double-clicked, and the highlighted illustration shows the result.

 

 

Double-clicking white space, any sequence of space characters, tabs, or similar non-printing characters, highlights the entire sequence.

 

 

Double-clicking a word between dot . characters highlights that word alone, since dot characters are not normally used as bracket pairs.

 

 

Likewise, double-clicking a word between slash / characters highlights that word alone, since slash characters are not normally used as bracket pairs.

 

 

Double-clicking a sequence of non-whitespace characters within characters used as bracket pairs, such as single or double quotes, highlights both the sequence of characters and also the enclosing bracket pair.  In the illustration above, both the sequence of characters and also the single quote characters on either side have been highlighted.

 

 

Double-clicking a sequence of non-whitespace characters between square [ ] brackets highlights both the characters and the brackets.  The same applies to any of the usual bracket pairs used in natural language, SQL, or programming, such as ( ), { }, or # #.

 

 

Double-clicking a sequence of characters that includes whitespace, like a space character, between brackets highlights only the non-whitespace character sequence.

 

 

Double-clicking a word set off by white space or characters other than the usual bracket pairs highlights only that word.

 

An ellipsis is a repeating sequence of characters such as ------- or //////.  Double-clicking an ellipsis highlights that ellipsis, such as the sequence of asterisk * characters in the illustrations above.

 

 

An identifier is a sequence of letters, numbers, or underscore _ characters.  Double-clicking an identifier highlights the identifier.  If it is enclosed in bracket characters, those too are highlighted.

Symmetric and Asymmetric Brackets

Symmetric brackets are those where the same character is used at the beginning and end of bracketed text, as with a double quote " character or single quote ' character, or the # character used to bracket dates in SQL.   Asymmetric brackets are those where different characters are used at the beginning and end of enclosed text, as in < >, [ ], (  ), and { }.  

 

A Ctrl-] keyboard command matches asymmetric brackets across multiple lines.   Ctrl-] matches symmetric brackets, #,  " and ', only within the same line.  If there is no matching bracket character, nothing happens.

Match Asymmetric Brackets

Asymmetric brackets are < >, [ ], (  ), and { }.  

With the cursor (indicated by a magenta arrow) on a curly { bracket character we press Ctrl-].

 

The cursor immediately jumps to the next, matching, curly } bracket, even if it is on a different line.

 

Pressing Ctrl-] again would jump the cursor back to the first, curly { bracket character.

Match Symmetric Brackets

Symmetric bracket characters are #, single quote ' and double quote " characters. 

 

 

With the cursor (indicated by a magenta arrow) on a double quote " bracket character we press Ctrl-].

 

 

The cursor immediately jumps to the next, matching, double quote " bracket character, but only if it is on the same line.   Pressing Ctrl-] again would jump the cursor back to the first, double quote " bracket character.

Match and Highlight All Between

Adding a Shift key matches and selects everything in between.

 

 

With the cursor (indicated by a magenta arrow) on a double quote " bracket character we press Shift-Ctrl-].

 

 

The cursor immediately jumps to the next, matching, double quote " bracket character, but only if it is on the same line.   Both double quote " bracket characters as well as all characters in between have been highlighted.

 

 

Bracket matching using Ctrl-] also works when the cursor is located just to the right of the initial bracket.

 

 

With the cursor (indicated by a magenta arrow) located just to the right of a curly { bracket character we press Shift-Ctrl-].

 

 

The cursor immediately jumps to the next, next, matching, curly } bracket character.  Both curly bracket characters as well as all characters in between have been highlighted.

 

Notes

One Window Rules them All - Text component windows (comments, locations, queries, and scripts) do not support the Edit - New Window command.   This avoids fights over save priorities between multiple windows for the same text.

 

See Also

Queries

 

Scripts

 

Command Window

 

Query Builder

 

Example: Create and Run a Query -  See how the different parts of a command window operate when creating and running SQL queries.   Includes use of the Log tab as well as the ?expression and !fullfetch commands.

 

Example: Run JavaScript in the Command Window - How to run a simple V8 JavaScript script in the Command window.

 

SQL Example: Process Images with 3x3 Filters -  Shows a step-by-step example of developing an SQL query that takes a query written by the Edit Query button and then modifies that query into a general purpose query that can apply any 3x3 filter.   This makes it easy to use matrix filters we find on the web for custom image processing.   We extend the query by using parameters and adding a function, and then show how it can be adapted to use a 5x5 filter.