Session Manager Editing: Difference between revisions

From NARS2000
Jump to navigationJump to search
No edit summary
Line 37: Line 37:
The '''text cursor''' takes one of two forms:  '''Insert''' or '''Replace'''.  The Insert cursor appears as a vertical bar between two chars; the Replace cursor appears as an underline beneath the character to be replaced.  The '''current position''' is the character to the right of the Insert text cursor or underneath the Replace text cursor.
The '''text cursor''' takes one of two forms:  '''Insert''' or '''Replace'''.  The Insert cursor appears as a vertical bar between two chars; the Replace cursor appears as an underline beneath the character to be replaced.  The '''current position''' is the character to the right of the Insert text cursor or underneath the Replace text cursor.


* Del
{|class="wikitable"
Deletes the character at the current position.
!Keystroke||Meaning
* Shift-Del
|-
Deletes the character to the left of the Insert or Replace text cursor.
!Del
* Ctrl-Del
|Deletes the character at the current position.
Deletes the characters from the current position to the end of the line.
|-
* Ins
!Shift-Del
Toggles the Insert vs. Replace state of the text cursor.
|Deletes the character to the left of the Insert or Replace text cursor.
* Shift-Ins
|-
Pastes text from the clipboard into the text to the left of the text cursor.
!Ctrl-Del
* Ctrl-Ins
|Deletes the characters from the current position to the end of the line.
(No meaning)
|-
* Home
!Ins
Moves the text cursor to the start of the current line.
|Toggles the Insert vs. Replace state of the text cursor.
* Shift-Home
|-
Selects the text from the start of the current line to the character to the left of the Insert or Replace text cursor and moves the text cursor to the start of the line.
!Shift-Ins
* Ctrl-Home
|Pastes text from the clipboard into the text to the left of the text cursor.
Move the cursor to the start of the screen buffer, possibly scrolling the screen so that point is visible.
|-
* End
!Ctrl-Ins
Moves the text cursor to the end of the current line.
|(No meaning)
* Shift-End
|-
Selects the text to the end of the current line from the character to the right of the Insert text cursor or underneath the Replace text cursor and moves the text cursor to the end of the line.
!Home
* Ctrl-End
|Moves the text cursor to the start of the current line.
Moves the text cursor to the end of the screen buffer, possibly scrolling the screen so that point is visible.
|-
* Up
!Shift-Home
Moves the text cursor up one line, possibly moving it to the end of the line if the line is short.
|Selects the text from the start of the current line to the character to the left of the Insert or Replace text cursor and moves the text cursor to the start of the line.
* Shift-Up
|-
Selects all of the text from the current position to the column up one line and moves the text cursor to that point.
!Ctrl-Home
* Ctrl-Up
|Move the cursor to the start of the screen buffer, possibly scrolling the screen so that point is visible.
Same as Up.
|-
* Down
!End
Moves the text cursor down one line, possibly moving it to the end of the line if the line is short.
|Moves the text cursor to the end of the current line.
* Shift-Down
|-
Selects all of the text from the current position to the column down one line and moves the text cursor to that point.
!Shift-End
* Ctrl-Down
|Selects the text to the end of the current line from the character to the right of the Insert text cursor or underneath the Replace text cursor and moves the text cursor to the end of the line.
Same as Down.
|-
* Left
!Ctrl-End
Moves the text cursor left one position.  If the text cursor is at the start of the current line, the text cursor moves to the end of the previous line.
|Moves the text cursor to the end of the screen buffer, possibly scrolling the screen so that point is visible.
* Shift-Left
|-
Selects the character to the left of the text cursor and moves the text cursor one position to that point extending any selection already set.
!Up
* Ctrl-Left
|Moves the text cursor up one line, possibly moving it to the end of the line if the line is short.
Moves the text cursor to the start of the word to the left.  If the text cursor was within a word, the text cursor moves to the start of that word.
|-
* Right
!Shift-Up
Moves the text cursor one character to the right.  If the text cursor is at the end of the current line, the text cursor moves to the start of the next line.
|Selects all of the text from the current position to the column up one line and moves the text cursor to that point.
* Shift-Right
|-
Selects the character to the right of the text cursor and moves the text cursor one position to that point extending any selection already set.
!Ctrl-Up
* Ctrl-Right
|Same as Up.
Moves the text cursor to the start of the word to the right.
|-
* PgDn
!Down
Scrolls the screen by one page down.
|Moves the text cursor down one line, possibly moving it to the end of the line if the line is short.
* Shift-PgDn
|-
Selects all of the text from the current position to the same column at the end of the current page.
!Shift-Down
* Ctrl-PgDn
|Selects all of the text from the current position to the column down one line and moves the text cursor to that point.
Moves the text cursor from the current position to the same column at the end of the current page.
|-
* PgUp
!Ctrl-Down
Scrolls the screen by one page up.
|Same as Down.
* Shift-PgUp
|-
Selects all of the text from the current position to the same column at the start of the current page.
!Left
* Ctrl-PgUp
|Moves the text cursor left one position.  If the text cursor is at the start of the current line, the text cursor moves to the end of the previous line.
Moves the text cursor from the current position to the same column at the start of the current page.
|-
!Shift-Left
|Selects the character to the left of the text cursor and moves the text cursor one position to that point extending any selection already set.
|-
!Ctrl-Left
|Moves the text cursor to the start of the word to the left.  If the text cursor was within a word, the text cursor moves to the start of that word.
|-
!Right
|Moves the text cursor one character to the right.  If the text cursor is at the end of the current line, the text cursor moves to the start of the next line.
|-
!Shift-Right
|Selects the character to the right of the text cursor and moves the text cursor one position to that point extending any selection already set.
|-
!Ctrl-Right
|Moves the text cursor to the start of the word to the right.
|-
!PgDn
|Scrolls the screen by one page down.
|-
!Shift-PgDn
|Selects all of the text from the current position to the same column at the end of the current page.
|-
!Ctrl-PgDn
|Moves the text cursor from the current position to the same column at the end of the current page.
|-
!PgUp
|Scrolls the screen by one page up.
|-
!Shift-PgUp
|Selects all of the text from the current position to the same column at the start of the current page.
|-
!Ctrl-PgUp
|Moves the text cursor from the current position to the same column at the start of the current page.
|}

Revision as of 11:39, 12 July 2017

The session manager in NARS2000 provides a wide variety of techniques to perform common tasks.

  • The Session manager window consists of a mixture of input and output.
  • Input typically starts after a six space indent, output typically appears starting at the left edge.
  • Both input and output are subject to editing and re-execution.
  • The cursor may move about the screen changing text as desired.
    • If you press Enter on a line, the original text of that line is restored, the changed line is copied to a new line at the bottom of the screen buffer and executed.
    • If you press Ctrl-Enter on a line, the original text of that line is restored, the changed line is copied to a new line at the bottom of the screen buffer but is not executed — instead it may be further edited before pressing Enter and executed.
    • If you press Shift-Enter on a line, a new physical line is inserted on the screen immediately below the original line and starts with a Line Continuation marker (by default, '' — U+27A5). If Shift-Enter is pressed while the text cursor is in the middle of a line, the line is split in two at that point. To undo this action use the Backspace key at the start of the new line or the Delete key at the end of the preceding line. This action changes the number of physical lines, but not the number of logical lines.
    • The default Line Continuation marker may be changed by selecting the menu item "Edit | Customize..." then selecting "User Preferences" and then "Line Continuation".
    • The default Line Continuation foreground and background color may be changed by selecting the menu item "Edit | Customize..." then selecting "Syntax Coloring" and then "Line Continuation" either Foreground or Background.
    • Multiple adjacent continued lines form a block which is treated as a single logical line.
    • If you press Enter on any line in a block, the block is copied to the bottom of the screen buffer and executed. If the block is already at the end of the buffer, the block is not copied; instead it is just executed.
    • If you press Ctrl-Enter on any line in a block, the block is copied to the bottom of the screen buffer but it is not executed — instead it may be further edited before pressing Enter and then executed. If the block is already at the end of the buffer, the block is not copied and not executed — in this case, Ctrl-Enter has no effect.

For example,

       f←{
⍺ ⍝ Left arg
+ ⍝ Function
⍵ ⍝ Right arg
}
       3 f 5
8
       h←{s←(+/⍵)÷2
⋄ √×/s-0,⍵ ⍝ Heron's formula for triangle area
}

The above example (starting with h←) also illustrates how to create a multi-statement anonymous function or operator (AFO) with comments, where separate physical lines form a single logical line. Note that this is different from a multi-line AFO where separate physical lines form separate logical lines — we don't support that in Session Manager Editing, but we do in Function Editing. In particular, a statement with continued lines is still a single logical line (minus the comments which are handled specially). If a subsequent continued line does not start with a statement separator, then it is a continuation of the previous statement (as in the example above starting with f←), not a new statement.

The only syntax elements that can't be continued to the next line are names and comments — splitting a name in two creates two separate names; splitting a comment in two does not create one continued comment nor does it create two separate comments. Instead use a comment symbol to start each comment on separate physical lines. To create a new statement, use the statement separator ().

Shortcut Keystrokes for Editing

The text cursor takes one of two forms: Insert or Replace. The Insert cursor appears as a vertical bar between two chars; the Replace cursor appears as an underline beneath the character to be replaced. The current position is the character to the right of the Insert text cursor or underneath the Replace text cursor.

Keystroke Meaning
Del Deletes the character at the current position.
Shift-Del Deletes the character to the left of the Insert or Replace text cursor.
Ctrl-Del Deletes the characters from the current position to the end of the line.
Ins Toggles the Insert vs. Replace state of the text cursor.
Shift-Ins Pastes text from the clipboard into the text to the left of the text cursor.
Ctrl-Ins (No meaning)
Home Moves the text cursor to the start of the current line.
Shift-Home Selects the text from the start of the current line to the character to the left of the Insert or Replace text cursor and moves the text cursor to the start of the line.
Ctrl-Home Move the cursor to the start of the screen buffer, possibly scrolling the screen so that point is visible.
End Moves the text cursor to the end of the current line.
Shift-End Selects the text to the end of the current line from the character to the right of the Insert text cursor or underneath the Replace text cursor and moves the text cursor to the end of the line.
Ctrl-End Moves the text cursor to the end of the screen buffer, possibly scrolling the screen so that point is visible.
Up Moves the text cursor up one line, possibly moving it to the end of the line if the line is short.
Shift-Up Selects all of the text from the current position to the column up one line and moves the text cursor to that point.
Ctrl-Up Same as Up.
Down Moves the text cursor down one line, possibly moving it to the end of the line if the line is short.
Shift-Down Selects all of the text from the current position to the column down one line and moves the text cursor to that point.
Ctrl-Down Same as Down.
Left Moves the text cursor left one position. If the text cursor is at the start of the current line, the text cursor moves to the end of the previous line.
Shift-Left Selects the character to the left of the text cursor and moves the text cursor one position to that point extending any selection already set.
Ctrl-Left Moves the text cursor to the start of the word to the left. If the text cursor was within a word, the text cursor moves to the start of that word.
Right Moves the text cursor one character to the right. If the text cursor is at the end of the current line, the text cursor moves to the start of the next line.
Shift-Right Selects the character to the right of the text cursor and moves the text cursor one position to that point extending any selection already set.
Ctrl-Right Moves the text cursor to the start of the word to the right.
PgDn Scrolls the screen by one page down.
Shift-PgDn Selects all of the text from the current position to the same column at the end of the current page.
Ctrl-PgDn Moves the text cursor from the current position to the same column at the end of the current page.
PgUp Scrolls the screen by one page up.
Shift-PgUp Selects all of the text from the current position to the same column at the start of the current page.
Ctrl-PgUp Moves the text cursor from the current position to the same column at the start of the current page.