Difference between revisions of "Dmuse: Key commands"

From CCARH Wiki
Jump to navigation Jump to search
m
m
Line 74: Line 74:
 
When you type KeyPad (+), you will be asked for the name of the file to load.  If you type a dollar sign, you will be asked for the name again, and the file will be displayed as a Hex dump (handy for looking as such things as MIDI files).
 
When you type KeyPad (+), you will be asked for the name of the file to load.  If you type a dollar sign, you will be asked for the name again, and the file will be displayed as a Hex dump (handy for looking as such things as MIDI files).
  
When you type KeyPad <shft> (+), you will be asked for the name
+
When you type KeyPad <shft> (+), you will be asked for the name of the file to which the window is to be stored.  If you type a dollar sign ($), the window will be stored back to the file from which it was last loaded (as noted in the top frame). When a window is stored to a file, the contents of the window and the file are the same, and the "difference flag" in the top frame goes off.
 
 
of the file to which the window is to be stored.  If you type a dollar sign ($), the window will be stored back to the file from which it was last loaded (as noted in the top frame). When a window is stored to a file, the contents of the window and the file are the same, and the "difference flag" in the top frame goes off.
 
  
 
You can load one window from another by typing KeyPad (+) and then giving "*<number>" as the name of the file to load, <number> being the number of the source window.  A window loaded in this way has no "source" per se.
 
You can load one window from another by typing KeyPad (+) and then giving "*<number>" as the name of the file to load, <number> being the number of the source window.  A window loaded in this way has no "source" per se.
Line 106: Line 104:
 
<return> = put the cursor at the beginning of the next line.  This requires some discussion.  On many text processors, the text is stored as a stream of characters, and the <return> character signals the end of a paragraph.  Dmuse treats each line on the screen as a separate record.  When a window is stored to a file, a <return><line-feed character combination is attached automatically to the end of each line.  When a file is loaded to a window, these "record delimiter" characters are simply removed and each record appears on a new line.
 
<return> = put the cursor at the beginning of the next line.  This requires some discussion.  On many text processors, the text is stored as a stream of characters, and the <return> character signals the end of a paragraph.  Dmuse treats each line on the screen as a separate record.  When a window is stored to a file, a <return><line-feed character combination is attached automatically to the end of each line.  When a file is loaded to a window, these "record delimiter" characters are simply removed and each record appears on a new line.
  
Now a word about "record delimiters" for you Linux users.  The use
+
Now a word about "record delimiters" for you Linux users.  The use of the character combination <return><line-feed> as a record delimiter originated with IBM computers, and was adopted early on by Microsoft. Linux grew out of the old AT&T Unix system, which used only the <line-feed> character as a record delimiter.  Linux recognizes both systems, but some Linux applications (some versions of makefiles for example), still expect to see only the <line-feed> character, and will treat the <return> character as part of the text of a line.  Being able to
 
+
handle both systems is therefore a priority.  Dmuse provides a way to do this.  If you load a file that uses only the <line-feed> character as a record delimiter, a flag will appear in the right-hand portion of the top frame.  If you later store this file, it will be stored using only the <line-file> character as a delimiter.  You can toggle the delimiter flag using the keystoke KeyPad <ctrl><shft> (*). When the flag is off, the record delimiter will revert to <return><line-feed>.  Thus you can load a file in one format, and store it in another.
of the character combination <return><line-feed> as a record delimiter
 
 
 
originated with IBM computers, and was adopted early on by Microsoft.
 
 
 
Linux grew out of the old AT&T Unix system, which used only the <line-fee
 
 
 
character as a record delimiter.  Linux recognizes both systems, but
 
 
 
some Linux applications (some versions of makefiles for example),
 
 
 
still expect to see only the <line-feed> character, and will treat
 
 
 
the <return> character as part of the text of a line.  Being able to
 
 
 
handle both systems is therefore a priority.  Dmuse provides a
 
 
 
way to do this.  If you load a file that uses only the <line-feed>
 
 
 
character as a record delimiter, a flag will appear in the right-hand
 
 
 
portion of the top frame.  If you later store this file, it will be
 
 
 
stored using only the <line-file> character as a delimiter.  You
 
 
 
can toggle the delimiter flag using the keystoke KeyPad <ctrl><shft> (*).
 
 
 
When the flag is off, the record delimiter will revert to
 
 
 
<return><line-feed>.  Thus you can load a file in one format, and
 
 
 
store it in another.
 
  
 
<shft> return = puts an actual carriage-return character at the end of the line and puts the cursor on the next line.
 
<shft> return = puts an actual carriage-return character at the end of the line and puts the cursor on the next line.

Revision as of 23:13, 1 October 2010

1. Introduction to the Keyboard command list in Dmuse

1.1 When Dmuse is first started, it presents to the user a blank screen. What you see is a view of one out of thirty possible windows, all of which work the same way. You will see a blinking cursor in the upper left-hand corner of the screen. You can use the cursor arrows to move the cursor anywhere in the screen. The metaphor here is a blackboard, like the ones they have in school. You can write anywhere on the blackboard with a piece of chalk, and you can write (type) anywhere on a Dmuse window. In this respect, Dmuse does not work like a standard text processor.

1.2 The Dmuse interface makes extensive use of the keyboard and its various combinations with <shft>, <ctrl>, and <alt>. Since the layouts and the response for the PC-Linux and Macintosh keyboards is slightly different (e.g., the Mac has no Insert key), there will be differences in the PC-Linu and the Mac versions of the command list. The Dmuse documentation is designed to take this into account; so that if you are running the Mac version of Dmuse, all of the internal documentation will correspond to that version. For purposes of this document, the following descriptions will be for the PC-Linux version of Dmuse. Every keystroke combination in the PC-Linux version has a corresponding keystroke combination for the Mac.

1.3 Commands for moving the cursor and viewing the window.

The first thing to note is the difference between a "window" and the "screen". Using the metaphor above, a "window" is the full blackboard; the "screen" is a view of a portion of that window. Windows in Dmuse can be quite large; up to 960 columns, and up to one million lines of text. The screen size is whatever fits into the X-window you have set up for Dmuse (changeable by your computer's window manager). Here are some commands for moving the cursor and viewing windows.

  • Move the cursor with the four arrow keys.
  • Scroll the contents of a window up, down, left and right using <ctrl> with the four arrow keys. <right-shft> with the arrow keys also works.
  • PageUp and PageDown will shift the view of the window up or down. Note, shifting the view of a window up is the same as scrolling the contents of the screen down.
  • Home puts the cursor at the top of the window; End puts the cursor below the last line of text in the window.
  • Use the numbers on the KeyPad to change between windows. 0 to 9 give access to windows 0 to 9; <ctrl>0 to <ctrl>9 give access to windows 10 to 19; and <alt>0 to <alt>9 give access to windows 20 to 29. Use KeyPad (decimal-point) to toggle between the current and previous windows. <shft><esc> (for LapTops) will also do this.

1.4 The mouse

Dmuse developed initially as a keyboard only interface, with the mouse being added much later. So the mouse does not do many of the things most users expect. This section describes what the mouse does do; the next section describes some of keystrokes that provide the functionality you would expect from a mouse (but do not get with Dmuse).

  • Across the bottom frame of Dmuse you will see the numbers 0 to 29. Click on one of these to change to that window. There is also a question mark on that frame. Click on that and you will get a summary description of what is in each of the windows (since it is sometimes hard to remember what you have put where).
  • Click on the word "Window" in the top frame to toggle between windows (same as KeyPad decimal-point). Click anywhere else in the top frame to call up the resident file manager.
  • Along the right frame is something that looks like a scroll bar. It is not a real scroll bar, but you can click in different places along the "track" to shift the view to different places in the window. The real purpose of the pseudo scroll bar is to show you approximately where you are in a window. It is not uncommon for a window to contain thousands of lines, and in this case you would like to know if you are somewhere near the top or near the bottom of a window. At the right-hand side of the top frame are two numbers representing the current position of the cursor in the window: line number and column number.
  • If you activate the resident file manager (F4), the mouse can be used to select various commands for this sub-program.
  • Finally, if you click anywhere in the main screen, the cursor will go there.

1.5 Keystrokes that highlight, and what you can do with highlighted material.

With many programs the mouse is used to highlight text. This requires the "hold and drag" motion of the mouse, something Dmuse does not currently do. Instead, Dmuse has the following keystrokes to highlight areas of the window.

In Dmuse, there are two kinds of highlight: box highlight and line highlight. Box highlight is achieved by holding down the <left-shft> key and using the arrows. Once a box area is highlighted, there are several things you can do with it.

  1. Move the contents of the box around the window. Use <ctrl><shft> arrow keys to do this. After the contents have been moved, any other keystroke will deposit the contents of the box in its new location, overwriting what was there before.
  2. Load the contents of the box into the "box buffer." Use <ctrl>Insert to do this. There is only one box buffer. Whatever was there before will be replaced. You can copy the contents of the box buffer to the screen (at cursor location) using the <shft>Insert command. The box buffer is universal to all Dmuse windows, so you can use the box buffer to copy material from one window to another. Copying from the box buffer does not change the contents of the buffer.
  3. Delete the area of the window covered by the highlight. Use the Delete key for this. Anything to the right of deleted material moves left.
  4. Draw a single or double line around the edge of the box. The minus and underscore keys will do this. You can use this facility to build up complicated line patterns and templates. Used with the box highlight, the tilde key will remove any line characters around the edge of the highlighted area.
  5. If you are highlighting a column of numbers, push "t" to get a total at the bottom. If you are highlighting two columns of numbers side by side, push "a" to get a third column which is the sum or push "s" to get a third column which is the difference between the two columns. If your columns contain commas, you will get commas in your answer; and if one of your numbers has a dollar sign, you will get a dollar sign in your answer. (works with pounds and yen, too).

The second type of highlight is the line highlight. To get the line highlight, hold down the <left-shft> key and use the PageDown or arrow-down keys. <left-shft> PageUp and arrow-up in this situation can be used to reduce the number of lines highlighted but not to start a line highlight. With lines highlighted, you have the following options.

  1. Use the Delete key to delete lines to the line buffer.
  2. Use the Insert key to copy lines to the line buffer. Lines will not be deleted in this case.

The line buffer does not work like the box buffer. It is a last-in, first-out trash heap. And its size is limited only by the size of your disk! The command <shft><alt>Insert will retrieve the last "block" of lines put the line buffer, whatever number of lines that was, and insert them into your current window just above the cursor. The command <ctrl><shft>Insert will do the same thing, but will copy instead of retrieve the lines from the line buffer. You can use <ctrl><shft>Insert multiple times to copy the same group over and over again.

If <shft><alt>Insert is used more than once, it will continue to retrieve lines from the line buffer (trash heap), but only one line at a time. The line buffer works across all windows, so you can use this feature to move material between windows.

You can delete lines to the trash heap without using the line highlight. <alt>Delete deletes a line to the trash heap. <shft><alt>Delete copies a line to the trash heap but does not delete it. Instead, the cursor moves down one line. Thus, holding down <shft><alt> and pushing Delete several times will copy several lines (one at at time) to the trash heap. Holding down <shft><alt> and pushing Delete and Insert in alternation will copy the same line over and over again.

Note: We normally use the line highlight to delete or copy lines. Not only does this allow groups of lines to be deleted/copied, but also for safety reasons it is helpful to SEE what you are deleting BEFORE you delete it. Note also that all lines deleted in this way can always be recovered at least once. The trash heap never goes away, but the top layer can be removed. There are two other commands that delete lines (covered below), which do not put deleted material on the trash heap. Material delete by those commands goes away completely (from the window, anyway).

1.6 Loading and storing files.

We need to do this, and Dmuse provides the following commands:

KeyPad (+) = load a file to the current window, at the line the cursor is currently on.

KeyPad <shft> (+) = store the content of the current window (the entire contents) to a file.

It is very important to make a distinction between the contents of a window and the contents of a file that might have the source for that window. First of all, any changes to the contents of the window are NOT reflected in the file unless and until the window is stored back to the file. Second, if a file is loaded into a window anywhere below the top line, the window and the file will be different right away. Dmuse provides a flag in the top frame, which signals when the contents of a window is different from the file which was its source (if there was one). If a file is loaded into a window (at any location), the top frame contains the name of the source file. If a window was not loaded from a file, no source is specified.

When you type KeyPad (+), you will be asked for the name of the file to load. If you type a dollar sign, you will be asked for the name again, and the file will be displayed as a Hex dump (handy for looking as such things as MIDI files).

When you type KeyPad <shft> (+), you will be asked for the name of the file to which the window is to be stored. If you type a dollar sign ($), the window will be stored back to the file from which it was last loaded (as noted in the top frame). When a window is stored to a file, the contents of the window and the file are the same, and the "difference flag" in the top frame goes off.

You can load one window from another by typing KeyPad (+) and then giving "*<number>" as the name of the file to load, <number> being the number of the source window. A window loaded in this way has no "source" per se.

There are two mouse shortcuts to loading and storing windows. Under the "File" title, "Load" has the same effect as KeyPad (+). "Save" has the same effect as the combination KeyPad <shft> (+) with the dollar sign. In other words, it can only save the window back to its source, not to another file.

1.7 Clearing a window.

KeyPad <shft> (-) will clear a window to the right and below the cursor. KeyPad (-) clears only the current line to the rigtht of cursor. Material cleared in this way cannot be retrieved. Clearing a window has NO AFFECT on files. The source file, if there be one, is unaffected.

The mouse shortcut "Clear" under the "File" title is actually a compound command. It moves the cursor Home (to the top of the window), and then clears the window.

1.8 Searching a window

You can search for a string in a window by type KeyPad (/). You will be prompted for the search string. If you type down-arrow, you will be presented with a choice of the last 10 search strings you have entered. This allows you to redo former searchs without having to retype the strings. The F11 function key repeats the same search to the right and below the cursor. The F12 function key does the same to the left and above the cursor.

1.9 What else?

Insert = toggles between insert and overstrike mode. A plus sign (+) appears in the top frame when you are in insert mode.

Delete = delete character; move the rest of the line to the left.

Backspace = put a "space" where the cursor is and back up one column

<alt> left-arrow = move the cursor one word to the left. This will also jump back a line if there are no words further to the left.

<alt> right-arrow = move the cursor one word to the right. This will also jump forward a line if there are no words further to the right.

<return> = put the cursor at the beginning of the next line. This requires some discussion. On many text processors, the text is stored as a stream of characters, and the <return> character signals the end of a paragraph. Dmuse treats each line on the screen as a separate record. When a window is stored to a file, a <return><line-feed character combination is attached automatically to the end of each line. When a file is loaded to a window, these "record delimiter" characters are simply removed and each record appears on a new line.

Now a word about "record delimiters" for you Linux users. The use of the character combination <return><line-feed> as a record delimiter originated with IBM computers, and was adopted early on by Microsoft. Linux grew out of the old AT&T Unix system, which used only the <line-feed> character as a record delimiter. Linux recognizes both systems, but some Linux applications (some versions of makefiles for example), still expect to see only the <line-feed> character, and will treat the <return> character as part of the text of a line. Being able to handle both systems is therefore a priority. Dmuse provides a way to do this. If you load a file that uses only the <line-feed> character as a record delimiter, a flag will appear in the right-hand portion of the top frame. If you later store this file, it will be stored using only the <line-file> character as a delimiter. You can toggle the delimiter flag using the keystoke KeyPad <ctrl><shft> (*). When the flag is off, the record delimiter will revert to <return><line-feed>. Thus you can load a file in one format, and store it in another.

<shft> return = puts an actual carriage-return character at the end of the line and puts the cursor on the next line.

<alt> return = puts the cursor on the next line and below the first (non-blank) character in the previous line

Tab = moves the cursor to the next tab or to the next line.

<left-shft> Tab = moves the cursor backward to the previous tab or to the previous line.

<ctrl> Tab = sets (or removes) a tab position at the cursor location.

<shft><ctrl> Tab = removes all tabs

Toggle the F10 function button to see where tabs are set.

Tabs also require some discussion. In some Linux applications (again, makefiles are an example), the Tab character is an important delimiter. It must be present for the file to be read properly. When Dmuse loads a file, it treats the Tab character like a text character. Yes, the Tab has its own character in Dmuse, which can be typed <shft><alt>0. This means two things: (1) the Tab is not expanded, and (2) such files can

be edited correctly by Dmuse. If you want the Tab expanded, you need to use the command KeyPad <ctrl> (+) to load the file. But use caution here. In expanding the Tab character, you may lose it. Or you may lose space characters before a Tab. In the end, for files like this, we recommend using another editor entirely.

1.10 Wordwrap

Most text processors use wordwrap automatically. In fact, you cannot disable wordwrap. You cannot put the cursor beyond the end of a line, because the line, itself, is not a separate entity. Wordwrap has meaning only when there are right and left margins. For most text processors, these margins are the right and left limits of the window you are typing in. Change the horizontal size and you change the margins .

Dmuse has wordwrap as an advanced feature. But, as you can imagine, this can only work within limits. The first limits are the margins, themselves. Wordwrap works only when the cursor is between the legal margins. When the cursor is outside the margins, you can still type text, but whatever you type might disappear if the margins are changed, so be careful.

Toggle the F10 function button to see where the margins are set. <left-shft><alt> right and left arrow will move the left margin. <right-shft><alt> right and left arrow will move the right margin. The default action is for margins to move only for the paragraph the cursor is in. You can change this default using the <ctrl> F10 function key.

Dmuse is provided with wordwrap disabled. You can activate it using the F9 function button. When wordwrap is enabled, the KeyPad (*) key toggles it on and off. When wordwrap is "on," you will see the wordwrap flag [W] on the right-hand side of the top frame. We rarely work with wordwrap on, but we do use it to reformat (change the horizontal size of) paragraphs.

When wordwrap is on, the keystrokes <return>, <insert> and <delete> behave differently. This is difference is documented internally in Dmuse and will not be discussed here.

The margins have meaning, even when wordwrap is off. If the cursor is in the middle of a group of sentences, each starting at the left margin, the command <ctrl> p will reformat the sentences into a single paragraph. Likewise, if the cursor is in the middle of a paragraph, the command <ctrl> s will reformat the paragraph into a set of sentences, each starting at the left margin. For these commands to work properly, all text must be to the left of the right margin.

1.11 Connect mode

Dmuse starts out as a simple screen editor. You can activate the connect mode feature using the F9 function key. Once you activate this feature, it stays activated for all future Dmuse sessions until you deactivate it.

The KeyPad <shft> (*) keystroke toggles connect mode. When you enter connect mode, Dmuse responds with the message, "Ready for program," and the connect mode flag [*] comes on in the top frame. Connect mode is window dependent, that is, each window has its own connect mode state.

When a window is in connect mode, you can type anything you want and put the cursor anywhere you want. Nothing happens until you type <return>. When you do that, Dmuse reads whatever in on that line, regardless of how it got there, and sends this to the connect portion of the program. The program at this point expects one of three things:

(1) the name of a specified program that you want to run. This must be a Zbex program, and it must be in prespecified library (see the section init files for how to do this).

(2) the command "zz" which invokes the Zbex compiler and interpreter (see the section of Running zbex programs for how this works).

(3) "&&" followed directly by a bash-shell command. For a limited number of commands, this will direct the command to the operating system, with the output from the command being direct back to the Dmuse window you are in. This works especially well for commands like "man", since you can easily scroll through the entire output, and even grab portions of

it to put in other windows -- even make your own documentation files .

The most important point here, and what makes Dmuse different from most other interfaces, is that it doesn't matter how or when something got put on the screen. If you type return, the entire line gets read and sent to the program. The Zbex language has an instruction, getc, which works the same way. When executing a getc, Zbex waits -- does not listen to what you type -- does not care if you change windows, insert or delete lines, move the cursor, whatever. It simple waits for you to type <return>, and when you do, it reads the line the cursor is currently on and sends this to the program.

2. Keyboard command list in Dmuse