Next Previous Contents

25. Functions that deal with the S-Lang readline interface

25.1 rline_bolp

Synopsis

Test of the editing point is at the beginning of the line

Usage

Int_Type rline_bolp()

Description

The rline_bolp function returns a non-zero value if the current editing position is at the beginning of the line.

Notes

This function is part of the S-Lang readline interface.

See Also

rline_eolp, rline_get_point, rline_get_line

25.2 rline_call

Synopsis

Invoke an internal readline function

Usage

rline_call (String_Type func)

Description

Not all of the readline functions are available directly from the S-Lang interpreter. For example, the "deleol" function, which deletes through the end of the line may be executed using

    rline_call("deleol");
See the documentation for the rline_setkey function for a list of internal functions that may be invoked by rline_call.

Notes

This function is part of the S-Lang readline interface.

See Also

rline_setkey, rline_del, rline_ins

25.3 rline_del

Synopsis

Delete a specified number of characters at the current position

Usage

rline_del(Int_Type n)

Description

This function delete a specified number of characters at the current editing position. If the number n is less than zero, then the previous n characters will be deleted. Otherwise, the next n characters will be deleted.

Notes

This function is part of the S-Lang readline interface.

See Also

rline_ins, rline_setkey

25.4 rline_eolp

Synopsis

Test of the editing point is at the end of the line

Usage

Int_Type rline_eolp()

Description

The rline_bolp function returns a non-zero value if the current editing position is at the end of the line.

Notes

This function is part of the S-Lang readline interface.

See Also

rline_bolp, rline_get_point, rline_get_line

25.5 rline_getkey

Synopsis

Obtain the next byte in the readline input stream

Usage

Int_Type rline_getkey ()

Description

This function returns the next byte in the readline input stream. If no byte is available, the function will wait until one is.

Notes

This function is part of the S-Lang readline interface.

See Also

rline_input_pending, rline_setkey

25.6 rline_get_edit_width

Synopsis

Get the width of the readline edit window

Usage

Int_Type rline_get_edit_width ()

Description

This function returns the width of the edit window. For slsh, this number corresponds to the width of the terminal window.

Notes

This function is part of the S-Lang readline interface.

See Also

rline_ins

25.7 rline_get_history

Synopsis

Retrieve the readline history

Usage

Array_Type rline_get_history ()

Description

This function returns the readline edit history as an array of strings.

Notes

This function is part of the S-Lang readline interface.

See Also

rline_set_line

25.8 rline_get_line

Synopsis

Get a copy of the line being edited

Usage

String_Type rline_get_line ()

Description

This function returns the current edit line.

Notes

This function is part of the S-Lang readline interface.

See Also

rline_set_line, rline_get_history

25.9 rline_get_point

Synopsis

Get the current editing position

Usage

Int_Type rline_get_point ()

Description

The rline_get_point function returns the byte-offset of the current editing position.

Notes

This function is part of the S-Lang readline interface.

See Also

rline_set_point

25.10 rline_input_pending

Synopsis

Test to see if readline input is available for reading

Usage

Int_Type rline_input_pending (Int_Type tsecs)

Description

This function returns a non-zero value if readline input is available to be read. If none is immediately available, it will wait for up to tsecs tenths of a second for input before returning.

Notes

This function is part of the S-Lang readline interface.

See Also

rline_getkey

25.11 rline_ins

Synopsis

Insert a string at the current editing point

Usage

rline_ins (String_Type text)

Description

This function inserts the specified string into the line being edited.

Notes

This function is part of the S-Lang readline interface.

See Also

rline_set_line, rline_del

25.12 rline_setkey

Synopsis

Bind a key in the readline keymap to a function

Usage

rline_setkey (func, keyseq)

Description

The rline_setkey function binds the function func to the specified key sequence keyseq. The value of func may be either a reference to a S-Lang function, or a string giving the name of an internal readline function.

Functions that are internal to the readline interface include:

   bdel             Delete the previous character
   bol              Move to the beginning of the line
   complete         The command line completion function
   del              Delete the character at the current position
   delbol           Delete to the beginning of the line
   deleol           Delete through the end of the line
   down             Goto the next line in the history
   enter            Return to the caller of the readline function
   eol              Move to the end of the line
   kbd_quit         Abort editing of the current line
   left             Move left one character
   quoted_insert    Insert the next byte into the line
   redraw           Redraw the line
   right            Move right one character
   self_insert      Insert the byte that invoked the function
   trim             Remove whitespace about the current position
   up               Goto the previous line in the history

Notes

This function is part of the S-Lang readline interface.

See Also

rline_unsetkey

25.13 rline_set_completion_callback

Synopsis

Set the function to be used for completion at the readline prompt

Usage

rline_set_completion_callback (Ref_Type func)

Description

This function sets the callback function to be used for completion at the readline prompt. The callback function must be defined to accept two values, the first being a string containing the text of the line being edited, and an integer giving the position of the byte-offset into the string where completion was requested.

The callback function must return two values: an array giving the list of possible completion strings, and an integer giving the byte offset into the string of the start of the text to be completed.

Example

See completion-callback function defined in the slsh library file rline/complete.sl.

Notes

This function is part of the S-Lang readline interface.

See Also

rline_set_list_completions_callback

25.14 rline_set_history

Synopsis

Replace the current history list with a new one

Usage

rline_set_history (Array_Type lines)

Description

The rline_set_history function replaces the current history by the specified array of strings.

Notes

This function is part of the S-Lang readline interface.

See Also

rline_get_history

25.15 rline_set_line

Synopsis

Replace the current line with a new one

Usage

rline_set_line (String_Type line)

Description

The rline_set_line function replaces the line being edited by the specified one.

Notes

This function is part of the S-Lang readline interface.

See Also

rline_get_line

25.16 rline_set_list_completions_callback

Synopsis

Set a callback function to display the list of completions

Usage

rline_set_list_completions_callback (Ref_Type func)

Description

This function sets the S-Lang function that is to be used to display the list of possible completions for current word at the readline prompt. The callback function must be defined to accept a single parameter representing an array of completion strings.

Example

This callback function writes the completions using the message functions:

     private define display_completions (strings)
     {
        variable str;
        vmessage ("There are %d completions:\n", length(strings));
        foreach str (strings) vmessage ("%s\n", str);
     }
     rline_set_list_completions_callback (&display_completions);

See Also

rline_set_completion_callback

25.17 rline_set_point

Synopsis

Move the current editing position to another

Usage

rline_set_point (Int_Type ofs)

Description

The rline_set_point function sets the editing point to the specified byte-offset from the beginning of the line.

Notes

This function is part of the S-Lang readline interface.

See Also

rline_get_point

25.18 rline_unsetkey

Synopsis

Unset a key binding from the readline keymap

Usage

rline_unsetkey (String_Type keyseq)

Description

The rline_unsetkey function unbinds the specified key sequence from the readline keymap.

Notes

This function is part of the S-Lang readline interface.

See Also

rline_setkey


Next Previous Contents