Interactive Input and Editing

Prev Next

Introduction

In interactive mode and other occasions where line input is requested, e.g. with the input() and table menu() functions in B4P programs, following editing features are available, as long B4P has not been started with the command line switches -c for disabling console features (but strongly recommended for batch processing) and -I for installation scripts.

Note: If either of the two beforementioned switches are used, then B4P uses standard input and output which allows redirection, using pipes and other features. All (distracting) console features will be kept inactive.

Following editing features are available:

Key Function
Arrow left Moves cursor 1 character to the left 1
CTRL-Arrow left Moves cursor 1 word to the left 1
Arrow right Moves cursor 1 character to the right 1
CTRL-Arrow right Moves cursor 1 word to the right 1
Home Moves cursor to 1st position 1
End Moves cursor to the end of the entered contents 1
Arrow up Accesses the history of previously entered commands and/or strings, beginning with the most recent one.
Arrow down Accesses the next more recently entered command and/or strings
CTRL-K Delete remaining text starting with the cursor
CTRL-C Copies marked text to clipboard 2
CTRL-X Cuts marked text to clipboard
CTRL-V Pastes contents from the clipboard
Backspace key Deletes the character on the left to the cursor and moves the cursor one character back
Delete key Deletes the character underneath the cursor
Insert key Toggles between insert and overwriting mode. In overwriting mode, the next character to be overwritten is marked and can also be cut or copied into the clipboard.

1 Text can be marked for cutting and copying when holding the shift key down and using the cursor navigation keys. Unfortunately, the mouse cannot be used.
2 Typing two CTRL-C consecutively will stop program execution

History of Recorded Commands and Strings

As mentioned in the table above, the vertical arrow keys support an input history.

The history of entered commands and strings are recorded in the following system variable: libraries[console library,history[n] where the number n is the array index. The first entered string gets index 0, with the additionally captured commands and/or strings following next and ending with the most recently entered command or string. If a string identical with one in the history is entered, then the position of the stored string will be moved to the most recent position in the array.

Clipboard

The clipboard as provided by the operating system will be used and allows cross application use. Copying texts will be made available as both plain ANSI and UNICODE text. In the other direction, both plain ANSI and UNICODE text can be pasted. Attempting to paste HTML contents, image and other objects will not work.

Using the mouse: B4P does not support the mouse directly. However, you can mark the text with the mouse and use the copy / paste features in the top menu bar or menu box after clicking the right mouse key to initiate copying and pasting text.

Note: Under LINUX, the xclip utility will be used. Make sure this utility is installed, e.g. with sudo apt-get install xclip.
Under MacOS, the standard pbcopy and pbpaste utilities are used internally.