summaryrefslogtreecommitdiffstats
path: root/linenoise/linenoise.h
Commit message (Collapse)AuthorAgeFilesLines
* linenoise: support inclusive selection.Kaz Kylheku2016-05-191-0/+2
| | | | | | | | | | | | | | * linenoise/linenoise.c (struct lino_state): New mode flag, selinclusive. (lino_set_selinclusive, lino_get_selinclusive): New functions. (sync_data_to_buf): Adjust rightmost endpoint when selection is reversed and inclusive mode is in effect, so that the included character will be visually highlighted. (yank_sel, delete_sel): Adjust endpoint of selection if in in inclusive mode. * linenoise/linenoise.h (lino_set_selinclusive, lino_get_selinclusive): Declared.
* Copyright year bump.Kaz Kylheku2015-12-311-1/+1
| | | | | | | | | | | | | | | | | | | | | | | * LICENSE, METALICENSE, Makefile, args.c, args.h, arith.c, arith.h, cadr.c, cadr.h, combi.c, combi.h, configure, debug.c, debug.h, eval.c, eval.h, filter.c, filter.h, gc.c, gc.h, glob.c, glob.h, hash.c, hash.h, jmp.S, lib.c, lib.h, lisplib.c, lisplib.h, match.c, match.h, parser.c, parser.h, parser.l, parser.y, rand.c, rand.h, regex.c, regex.h, share/txr/stdlib/cadr.tl, share/txr/stdlib/except.tl, share/txr/stdlib/hash.tl, share/txr/stdlib/ifa.tl, share/txr/stdlib/path-test.tl, share/txr/stdlib/place.tl, share/txr/stdlib/struct.tl, share/txr/stdlib/txr-case.tl, share/txr/stdlib/type.tl, share/txr/stdlib/with-resources.tl, share/txr/stdlib/with-stream.tl, share/txr/stdlib/yield.tl, signal.c, signal.h, stream.c, stream.h, struct.c, struct.h, sysif.c, sysif.h, syslog.c, syslog.h, txr.1, txr.c, txr.h, unwind.c, unwind.h, utf8.c, utf8.h: Add 2016 copyright. * linenoise/LICENSE, linenoise/linenoise.c, linenoise/linenoise.h: Bump one principal author's copyright from 2014 to 2015. The code is based on a snapshot of 2015 upstream work.
* linenoise: substring flag in completion callback.Kaz Kylheku2015-10-031-0/+1
| | | | | | | | | | | | | | | | | | | A feature is hereby introduced into linenoise whereby completion mode can be entered via Ctrl-X Tab also, not only Tab. This is distinguished with a flag in the completion structure. The intent is that the callback can use this to provide substring matches not only prefix matches. * linenoise/linenoise.c (complete_line): Takes a new argument, and stores it in the new substring member of lino_completions_t. (edit): If Tab is typed while in Ctrl-X extended mode, then fall through to the regular switch, where the TAB case now recognizes that it is in extended mode and passes the mode flag to complete_line. * linenoise/linenoise.h (lino_completions_t): New member, substring.
* linenoise: atom-gathering callback feature.Kaz Kylheku2015-09-181-0/+3
| | | | | | | | | | | | * linenoise/linenoise.c (struct lino_state): New members atom_callback and ca_ctx. (lino_set_atom_cb): New function. (edit): Ctrl-X Ctrl-A invokes atom callback, and inserts returned string. * linenoise/linenoise.h (lino_atom_cb_t): New function pointer typedef. (lino_set_atom_cb): Declared.
* linenoise: support suffix on temp file name.Kaz Kylheku2015-09-181-0/+1
| | | | | | | | | | | | | | This is so that when a command line is edited in an external editor, editors can choose appropriate syntax highlighting mode based on the suffix. * linenoise/linenoise.c (struct lino_state): New member, suffix. (edit_in_editor): If we have the mkstemps function, then use it to create a suffixed name. (lino_set_tempfile_suffix): New function. * linenoise/linenoise.h (lino_set_tempfile_suffix): Declared.
* Listener configuration variables.Kaz Kylheku2015-09-171-0/+1
| | | | | | | | | | | | | | | | | | * linenoise/linenoise.c (lino_get_multiline): New function. * linenoise/linenoise.h (lino_get_multiline): Declared. * parser.c (listener_hist_len, listener_multi_line_p_s): New symbol global variables. (repl): Set linenoise history length and multi-line mode from the *listener-hist-len* and *listener-multi-line-p* variables on each call. Set the *listener-multi-line* variable from the lino_t object's current state after each linenoise call. (parse_init): Initialize new global variables and register them as special variables. * txr.1: Update sentence which says that history is fixed at 100 lines. Document listener configuration variables.
* linenoise: lino_copy function.Kaz Kylheku2015-09-111-0/+1
| | | | | | | | | | | | * linenoise/linenoise.c (link_into_list, unlink_from_list): New static functions. (lino_make): Use link_into_list instead of open-coded list manipulation. (lino_copy): New function. (lino_free): Use unlink_from list instead of open-coded list manipulation. * linenoise/linenoise.h (lino_copy): Declared.
* linenoise: remove input-viewing debug function.Kaz Kylheku2015-09-091-1/+0
| | | | | | | | | | | | This is unused code which just addds to the executable size. Also it passes a char to isprint, which is undefined behavior if that char happens to be negative. * linenoise/example.c (main): Remove --keycodes option and reference to lino_print_keycodes function. * linenoise/linenoise.c, linenoise/linenoise.h (lino_print_keycodes): Function removed.
* linenoise: error code distinguishes interrupt from eof.Kaz Kylheku2015-09-061-0/+11
| | | | | | | | | | | | | | | | | | In this commit, we introduce a persistent error variable stored in the lino_t structure, and functions to access it. * linenoise/linenoise.c (struct lino_state): New member, error. (enable_raw_mode): Don't set errno to ENOTTY; set linenoise error to lino_notty. (complete_line, edit, go_raw, linenoise, lino_hist_save, lino_hist_load): Set linenoise error before returning -1. (lino_get_error, lino_set_error): New functions. * linenoise/linenoise.h (enum lino_error, lino_error_t): New enum. (lino_get_error, lino_set_error): Declared.
* linenoise: get rid of globals; everything in struct.Kaz Kylheku2015-09-041-10/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * linenoise/linenoise.c (completion_callback, orig_termios, rawmode, mlmode, history_max_len, history_len, history): Global variables removed; moved into struct lino_state. (struct lino_state): New members next, prev. New members completion_callback, orig_termios, rawmode, mlmode, history_max_len, history_len, history. (lino_list): New static variable: dummy node for circular list of struct lino_state structures. (lino_set_multiline): Operate on structure rather than global variable. (enable_raw_mode, disable_raw_mode): Operate on structure. Use file descriptors from structures rather than inconsistent hard-coded use of STDIN_FILENO and the argument fd, which is gone. (lino_clear_screen): Obtain file descriptor from structure, rather than global. (complete_line): Operate on structure rather than globals. Pass context to completion callback. (lino_set_completion_cb): Store callback in structure rather than global. Store new context argument also. (reresh_line): Take mode from structure rather than global. (edit_insert, edit_move_end): Operate on struture rather than globals. (edit): Do not accept file descriptor arguments. Do not update ifd and ofd members of structure; just rely on these values to already be there, since the lino_make constructor puts them there. (lino_print_keycodes, go_raw): Operate on structure. (lino_make, lino_free): New functions. (lino_cleanup): New static function. (linenoise, free_hist): Operate on structure. (atexit_handler): Loop over all structures in global list, and clean up each one. (lino_hist_add, lino_list_set_max_len, lino_hist_save, lino_hist_load): Operate on structure. * linenoise/linenoise.h (lino_t): New typedef. (lino_compl_cb_t): Function type takes new context argument. (lino_set_completion_cb, linenoise, lino_hist_add, lino_hist_set_max, lino_his_save, lino_hist_load, lino_clear_screen, lino_set_multiline, lino_print_keycodes): Declarations updated. * linenoise/example.c (completion): Take new context argument, and ignore it. (main): Create linenoise context with lino_make, giving it the input and output file descriptor, and pass it to all functions.
* linenoise: change naming to conform to project.Kaz Kylheku2015-09-041-12/+12
| | | | | | | | linenoise/linenoise.c, linenoise/linenoise.h: Renaming all camel-case identifiers to underscores. The verbose linenoise prefix becomes lino_. All caps enum tag gets lower cased. Static functions with linenoise prefix lose the prefix.
* linenoise: compile as C++ and use checked allocator.Kaz Kylheku2015-09-041-13/+0
| | | | | | | | | | | | | | | | | * linenoise/linenoise.c (mem_t): New typedef, compatible with the one in lib.h, which we don't want to include. (chk_malloc, chk_realloc): External declarations added. (unsupported_term): Make element type const char *. (linenoiseAddCompletion): Use checked allocator, add casts, use the superior "sizeof *dest_pointer_var" expression in size calculations rather than "sizeof (maybe_wrong_type)". (abAppend, linenoiseHistoryAdd, linenoiseHistorySetMaxLen): Likewise. * linenoise/linenoise.h: Remove unnecessary include guards; we don't use them in this project. Remove 'extern "C"'; we don't require C linkage when compiling everything as C++.
* Add linenoise library.Kaz Kylheku2015-09-031-0/+68
* LICENSE: Add Linenoise authors to the list of copyright holders. * linenoise/LICENSE: New file. * linenoise/linenoise.c: New file. * linenoise/linenoise.h: New file.