summaryrefslogtreecommitdiffstats
path: root/linenoise
Commit message (Collapse)AuthorAgeFilesLines
* linenoise: callback for checking syntax completeness.Kaz Kylheku2017-06-162-1/+23
| | | | | | | | | | | | | | | | | | | The idea is that when the user types Enter to submit a line, it can be checked whether it is complete syntax using a callback. If the callback indicates that the syntax is incomplete (there are open expressions, string literals or whatever), then Enter is inserted verbatim. This is active in multi-line mode only. * linenoise.c (struct lino_state): New members, enter_callback and ce_ctx. (lino_set_enter_cb): New function. (edit): If enter is issued, and multi-line mode is in effect, and there is an enter callback, then call it. If the callback returns false, then just insert the character. * linenoise.h (lino_enter_cb_t): New typedef. (lino_set_enter_cb): Declared.
* linenoise: Ctrl-X ? displays editing cheatsheet.Kaz Kylheku2017-06-141-0/+101
| | | | | * linenoise/linenoise.c (show_help): New static function. (edit): Call show_help on Ctrl-X ?.
* linenoise: support forcing of noninteractive mode.Kaz Kylheku2017-04-042-1/+14
| | | | | | | | | | | | * linenoise/linenoise.c (struct lino_state): New member, noninteractive. (lino_set_noninteractive, lino_get_noninteractive): New functions. (linenoise): Check noninteractive flag; if set, treat the situation like !isatty(ls->ifd). * linenoise/linenoise.h (lino_set_noninteractive, lino_get_noninteractive): Delared.
* linenoise: bugfix: use persistent stream for non-tty.Kaz Kylheku2017-04-031-12/+18
| | | | | | | | | | | | | | This bug causes data to be thrown away after reading one line. * linenoise/linenoise.c (struct lino_state): New member, ifs. (linenoise): Do not fdopen a new stream on each call, because this will read a buffer full of data, from which it will just read one line, and then throw the rest of away when fclose is called on the stream. Open the stream once and store it in the ifs member. (lino_cleanup): If the ifs member is non-null, then call fclose on it.
* linenoise: close descriptor before external edit.Kaz Kylheku2017-03-171-1/+6
| | | | | | | | * linenoise/linenoise.c (edit_in_editor): Close the file stream after writing out the temporary file, before launching the editor. On Windows, Notepad complains that the file is in use by another application and cannot write to it. Windows Vim treats the file as read-only in spite of good permissions.
* linenoise: Ctrl-X Ctrl-P edits result of command.Kaz Kylheku2016-10-122-0/+21
| | | | | | | | | | | | * linenoise/linenoise.c (struct lino_state): New member, result. (edit): Ctrl-P or p in extended mode cause result string to be inserted into the buffer. (lino_copy): Ensure result string in copy is null. (lino_cleanup): Free result string and set to null. (lino_set_result): New function. * linenoise/linenoise.h (lino_set_result): Declared.
* linenoise: bug in resubmit historic line when dupe.Kaz Kylheku2016-10-121-2/+4
| | | | | | | | | | | When Ctrl-X Enter is used to resubmit a line from the history, and it is a duplicate, it is not entered into the history. The position then doesn't advance to the next historic line. * linenoise/linenoise.c (lino_hist_add): Do add the line even if it is duplicate if the last submitted line was from the middle of the history.
* linenoise: bugfix: handle ESC in extended command.Kaz Kylheku2016-09-301-1/+2
| | | | | | | | | | | | If the user types Ctrl-X and then an arrow key, we don't want garbage. We let an ESC received in Ctrl-X extended command mode to be processed normally and cancel that mode. * linenoise.c (edit): Bypass the extended command switch if the character is ESC. Then down below in the ESC case of the regular command switch, clear extended mode.
* linenoise: use USERPROFILE for home dir on Cygnal.Kaz Kylheku2016-09-171-1/+18
| | | | | | | * linenoise/linenoise.c (get_home): New static function. (edit_in_editor): Call get_home instead of getenv("HOME").
* linenoise: support inclusive selection.Kaz Kylheku2016-05-192-3/+23
| | | | | | | | | | | | | | * 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.
* linenoise: g++ signed/unsigned warnings.Kaz Kylheku2016-04-201-4/+5
| | | | | | | | * linenoise/linenoise.c (free_completions): Use size_t for iterating over completions vector. (complete_line): Likewise. (edit_insert, edit_insert_str): Cast size_t value to int before comparing with l->dlen.
* linenoise: replace poor uses of size_t with int.Kaz Kylheku2016-03-291-76/+75
| | | | | | | | | | | | | | | | | | | * linenoise/linenoise.c (struct lino_state): Members plen, pos, sel, end, dlen, dpos, dsel, dend, cols, oldrow and maxrows change from size_t to int. (struct lino_undo): Member dpos changes likewise. (restore_undo, free_completions, complete_line, next_hist_match, history_search, sync_data_to_buf, copy_display_params, refresh_singleline, screen_rows, col_offset_in_str, refresh_multiline, scan_match_rev, scan_rev, scan_match_fwd, scan_fwd, find_nearest_paren, paren_jump, update_sel, yank_sel, delete_sel, edit_insert, edit_insert_str, edit_move_eol, edit_move_matching_paren, edit_delete_prev_all, edit_delete_to_eol, edit_delete_prev_word, edit_delete_line, edit): Replace various size_t's in function arguments, return values and local variables with int. Drop what would now be useless casts of constants to type int.
* Replace all stray C style casts with macros.Kaz Kylheku2016-03-291-33/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * gc.c (gc_report_copies): C style casts found in this function. * linenoise.c (strip_qual, convert, coerce): Copy and paste the macros here. (record_undo, compare_completions, lino_add_completion, history_search, ab_append, sync_data_to_buf, refresh_singleline, screen_rows, refresh_multiline, find_nearest_paren, paren_jump, yank_sel, edit_move_matching_paren, edit, lino_make, lino_copy, lino_hist_add, lino_hist_set_max_len): C style casts replaced. * mpi/mpi-types.h (MP_DIGIT_BIT, MP_DIGIT_MAX, MP_WORD_BIT, MP_WORD_MAX, RADIX): C style casts replaced. * mpi/mpi.c (convert, coerce): Copy and paste the macros here. (mp_init_size, mp_init_copy, mp_copy, mp_set_int, mp_div_d, mp_bit, mp_to_double, mp_to_signed_bin, mp_to_unsigned_bin, mp_to_unsigned_buf, mp_toradix_case, mp_grow, s_mp_set_bit, s_mp_mod_2d, s_mp_mul_2d, s_mp_div_2d, s_mp_mul_d, s_mp_mul, s_mp_sqr, s_mp_div, s_mp_2expt, s_mp_todigit): C style casts replaced. * mpi/mplogic (convert): Macro copy and pasted here. (mpl_num_set, mpl_num_clear): C style casts replaced. * parser.c (provide_completions): Likewise. * signal.c (small_sigfillset): Likewise. * stream.c (stdio_truncate, test_set_indent_mode, set_indent_mode): Likewise.
* Header file cleanup.Kaz Kylheku2016-01-221-3/+0
| | | | | | | * arith.c, cadr.c, debug.c, eval.c, filter.c, gencadr.txr, glob.c, hash.c, linenoise/linenoise.c, lisplib.c, match.c, parser.c, rand.c, regex.c, signal.c, stream.c, struct.c, sysif.c, syslog.c, txr.c, unwind.c, utf8.c: Remove unncessary header files.
* Copyright year bump.Kaz Kylheku2015-12-313-3/+3
| | | | | | | | | | | | | | | | | | | | | | | * 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: submit and stay in history.Kaz Kylheku2015-12-311-0/+19
| | | | | | | | | | * linenoise/linenoise.c (struct lino_state): New member save_hist_idx. (edit): If save_hist_idx is set, jump to that history position and clear it. Handle ENTER in extended (Ctrl-X) mode similarly to regular ENTER, but setting save_hist_idx. * txr.1: Documented.
* linenoise: bugfix: Ctrl-X bails out of hist searchKaz Kylheku2015-12-311-1/+1
| | | | | | | * linenoise/linenoise.c (history_search): Add CTL('X') to set of characters which terminate search and are processed again in the main editing function, so that Ctrl-X commands work in search.
* linenoise: substring flag in completion callback.Kaz Kylheku2015-10-032-4/+8
| | | | | | | | | | | | | | | | | | | 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: Ctrl-X/Ctrl-[AWR] relative to hist pos.Kaz Kylheku2015-10-021-6/+9
| | | | | | | | | | * linenoise/linenoise.c (edit): The recall previous word, atom and line features now offset relative to the current navigation position in the history. Previous line means the line before the currently showing history line, not the line most recently entered into the history. * txr.1: Documented.
* linenoise: insert previous line command.Kaz Kylheku2015-10-021-0/+14
| | | | | | | * linenoise/linenoise.c (edit): Extended Ctrl-X Ctrl-R/r command added. * txr.1: Documented.
* linenoise: Ctrl-A/E overloaded in multi-line mode.Kaz Kylheku2015-10-011-1/+4
| | | | | | | | | | | | | * linenoise/linenoise.c (edit_move_sol): If the cursor is already at the beginning of a line, then move it to the start of the buffer. (edit_move_eol): If the cursor is at the end of the line, then move it to the end of the buffer. This also fixes a bug: previously, if the cursor was at the end of the line already, it moved to the end of the following line. * txr.1: Documented.
* linenoise: fix multi-line issue in history search.Kaz Kylheku2015-09-301-1/+12
| | | | | | | | | | | | | | | | Aborting a multi-line search result with Ctrl-C messes up display because the row-related values are being done on a linenoise copy, and their latest values aren't backpropagated to the master lino_t. * linenoise/linenoise.c (copy_display_params): New static function. (history_search): Use the lino_t copy when clearing the screen, because lino_clear_screen manipulates a display parameter. When leaving the function, copy the latest display-related parameters from lc to l, so that l has the latest number of columns and all the right row stuff for multi-line mode.
* linenoise: backspace also causes parenthesis jump.Kaz Kylheku2015-09-271-0/+1
| | | | | | | * linenoise/linenoise.c (edit): Do paren_jump after backspace * txr.1: Documented.
* linenoise: paren matching jump finds closes paren.Kaz Kylheku2015-09-271-8/+57
| | | | | | | | | | * linenoise/linenoise.c (find_nearest_paren): New static function. (edit_move_matching_paren): Use find_matching_paren to usefully handle situations when the cursor is not on a parenthesis, bracket or brace. * txr.1: Documented.
* linenoise: no wasteful retrace on clear screen.Kaz Kylheku2015-09-251-0/+1
| | | | | | | * linenoise/linenoise.c (lino_clear_screen): Set l->maxrows to zero so that refresh_multiline won't emit useless upward cursor movement sequences. These have nowhere to go from the top line of the screen.
* linenoise: no upward retrace after suspend resume.Kaz Kylheku2015-09-251-0/+1
| | | | | | | | | * linenoise/linenoise.c (edit): After coming back from a Ctrl-Z suspend, set l->maxrows to zero to force refresh_multiline to draw the buffer from the current cursor position down, without any retrograde cursor movement to above lines, trying to refresh existing lines which are not there.
* linenoise: fix broken move-to-end on Enter.Kaz Kylheku2015-09-251-18/+26
| | | | | | | | | | | | | | | | | | | | | The switch to Ctr-A/Ctrl-E within a logical line breaks when the edit_move_end function is relied upon to go to the end of the buffer. * linenoise/linenoise.c (edit_move_home): Restored to original behavior. (edit_move_sol): New static function that hosts new behavior of edit_move_home: calls edit_move_home in single-line mode, or implements move within logical line in multi-line mode. (edit_move_end): Restored to original behavior. (edit_move_eol): New static function that hosts new behavior of edit_move_end: calls edit_move_end in single-line mode, or implements move within logical line in multi-line mode. (edit): Call edit_move_sol instead of edit_move_home, and in editing functions onyl, call edit_move_eol instead of edit_move_end.
* linemode: multi-line behavior for Ctrl-A/Ctrl-E.Kaz Kylheku2015-09-251-6/+30
| | | | | | | | * linemode/linemode.c (edit_move_home, edit_move_end): Check for multi-line mode and implement movement within the physical line. * txr.1: Documented.
* linenoise: delete previous word fix for multi-line.Kaz Kylheku2015-09-251-4/+3
| | | | | | | | * linenoise/linenoise.c (SPACE): Preprocessor symbol removed; was only referenced in the edit_delete_prev_word function. (edit_delete_prev_word): Recognize carriage return as word-separating whitespace.
* linenoise: fix multi-line issues with long linesKaz Kylheku2015-09-251-34/+44
| | | | | | | | | | | * linenoise/linenoise.c (screen_rows): Restructured. Calculates correct cursor rows (out.rows[1]). It's now possible that the reported cursor row exceeds the number of rows (out.rows[0]), because the cursor is on the last line, which itself doesn't wrap, but the cursor does. (refresh_multiline): Cursor wrapping calculation is simple now: just check that nrow > rows. Coalesced code for dealing with cursor position.
* linenoise: wrong snprintf argument.Kaz Kylheku2015-09-231-1/+1
| | | | | * linenoise/linenoise.c (refresh_multiline): Fix size_t being passed to %d conversion specifier in snprintf call.
* linenoise: correct tab alignment in multi-line mode.Kaz Kylheku2015-09-231-4/+9
| | | | | | | * linenoise/linenoise.c (sync_data_to_buf): Maintain a colum variable which is reset when a new line is put out and takes into account the prompt length; use this for tabs.
* linenoise: C++ fixes, including g++ warnings.Kaz Kylheku2015-09-221-10/+10
| | | | | | | | * linenoise/linenoise.c (history_search, sync_data_to_buf, screen_rows, paren_jump, edit_move_matching_paren): Fix signed/unsigned warnings. (edit_in_editor): Avoid using template as a variable name. Use const char * for string literal.
* linenoise: forward paren jump too.Kaz Kylheku2015-09-221-0/+4
| | | | | | | | * linenoise/linenoise.c (paren_jump): Scan forward also, if reverse scan turns up nothing, thereby jumping to a closing parenthesis in the forward direction. * txr.1: Documentation updated.
* linenoise: selection endpoint toggle with Ctrl-^.Kaz Kylheku2015-09-221-0/+9
| | | | | | * linenoise/linenoise.c (edit): Implemented. * txr.1: Documented.
* linenoise: jump to matching parenthesisKaz Kylheku2015-09-221-0/+62
| | | | | | | | | * linenoise/linenoise.c (scan_match_fwd, scan_fwd, edit_move_matching_paren): New functions. (edit): New Ctrl-] command implemented using edit_move_matching_paren. * txr.1: Documented.
* linenoise: new Ctrl-X Ctrl-K command to delete line.Kaz Kylheku2015-09-211-0/+31
| | | | | | | | | * linenoise/linenoise.c (edit_delete_line): New static function. (edit): New Ctrl-K extended command case implemented using edit_delete_line. * txr.1: Documented.
* linenoise: multi-line behavior for del to bol/eol.Kaz Kylheku2015-09-211-12/+54
| | | | | | | | | | | | | * linenoise/linenoise.c (edit_delete_prev_all): In multi-line mode, delete only to beginning of physical line, not the entire logical line. Also, detect noop cases and don't do record undo or produce any effect. (edit_delete_to_eol): New function. (edit): Use edit_delete_to_eol function for Ctrl-K instead of inline code. * txr.1: Documented.
* linenoise: squelch some useless undo items.Kaz Kylheku2015-09-211-5/+24
| | | | | | | | | | | | | | | | | | | | | Sometimes edits don't do anything, and so the undo item recorded for them is superfluous. When undo is used nothing appears to happen for a turn. We use two strategies: detect the noop change and avoid recording the undo (or doing anything), or else detecting the noop undo afterward and removing it from the undo stack. * linenoise/linenoise.c (remove_noop_undo): New static function. (edit_delete, edit_backspace): Remove noop undo. (edit_delete_prev_word): Don't record undo, move memory or update vars if there is no word to delete. (edit_in_editor): Remove noop undo. (edit): For Ctrl-T, don't record undo or do anything other than clear the selection if the cursor is leftmost already.
* linenoise: do not undo to empty lineKaz Kylheku2015-09-211-9/+14
| | | | | | * linenoise/linenoise.c (restore_undo): If an undo item wants to produce a completely blank line, then discard and skip it.
* linenoise: much more sane, per-history-item undo.Kaz Kylheku2015-09-211-57/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Undo now works intuitively. It does not perform invisible jumps among history items, restoring instead just the history for the given line being edited. * linenoise/linenoise.c (LINENOISE_MAX_UNDO): Raised from 32 to a more generous 200. Since edits are per-history line, it makes sense to allow a lot more. (delete_undo): New static function. (free_undo): Static function removed to free_undo_stack. Trivial loop around delete_undo. (record_undo): Do not record the current history index; all edits are assigned the index INT_MAX. INT_MAX is an indicator that the edits do not have an assigned history line. The decision of where to assign them depends on whether history navigation is used to move to another history line or Enter is used to submit an edited line. A stinky part of the history trimming code is rewritten simply in terms of delete_undo. (record_triv_undo): Suppress a trivial item only if the top item belongs to the same history line, or is nonspecific (INT_MAX). (undo_pop): Static function removed. (restore_undo): Rewritten to look for the topmost item specific to the current history line or an INT_MAX nonspecific item. Removes undo items for expired lines as it goes. (undo_subst_hist_idx): New static function. (renumber_undo_hist): Renamed to undo_renumber_hist_idx. (edit_history_next): Do not record an undo; history navigation is no longer considered an edit. Rewrite all the INT_MAX entries in the undo stack with the current history index, permanently associating the undo items with the history line away from which we are navigating. (edit): Do not record an undo for a line terminating with Enter. It is not an edit action. When leaving the funtion, renumber any INT_MAX entries in the undo history to history index zero. Thus edits to any line which is submitted via Enter will (correctly) not be associated with that line, which was not in fact edited, but with the new line that was submitted. (lino_cleanup): Follow rename of free_undo. (lino_hist_add): Follow rename of undo_renumber_hist_idx. * txr.1: Documented.
* linenoise: renumber history indices in undo itemsKaz Kylheku2015-09-201-5/+27
| | | | | | | | | | | | | | | This has to be done because each time a history line is added, or taken back, the relative numbers change. * linenoise/linenoise.c (undo_pop): New static function. (restore_undo): Skip undo items which refer to lines of history which no longer exist. Restore history[0] also. (renumber_undo_hist): New static function. (edit): When leaving, and removing the extra history line representing the current line, renumber the undo items by -1. (lino_hist_add): After adding a line, bump the undo item history indices by 1.
* linenoise: single return out of edit.Kaz Kylheku2015-09-201-27/+27
| | | | | | | | * linenoise/linenoise.c (edit): Changing most returns to goto out. We have common clean-up to do, namely removing the last history item which represents the current line. This fixes a bug: not removing the history line in the Ctrl-C case.
* linenoise: move to end in mlmode on Ctrl-C, Ctrl-Z.Kaz Kylheku2015-09-201-4/+17
| | | | | | | | | | If we don't move the cursor to the end, then the shell prompt (Ctrl-Z) or next REPL prompt (Ctrl-C) comes in the middle of the previous input. * linenoise/linenoise.c (edit): in multi-line mode, move to end of input on Ctrl-C. On Ctrl-Z suspend, do the same, but save and restore the position.
* linenoise: undo feature.Kaz Kylheku2015-09-201-0/+125
| | | | | | | | | | | | | | | | | | | | | * linenoise/linenoise.c (LINENOISE_MAX_UNDO): New preprocessor symbol. (struct lino_state): New member, undo_stack. (struct lino_undo): New struct type. (free_undo, record_undo, record_triv_undo, restore_undo): New static functions. (edit_insert): Record trivial undo item with record_triv_undo. (edit_insert_str, edit_history_next, edit_delete, edit_backspace, edit_delete_prev_all, edit_delete_prev_word, edit_in_editor): Record undo item. (edit): Record undo item before Ctrl-R history recall and Ctrl-T twiddle. Also record one final undo item upon Enter, as well as Ctrl-C. New Ctrl-O command to undo. (lino_copy): Do not copy undo_stack, to prevent double freeing. (lino_free): Free the undo history. * txr.1: Documented.
* linenoise: visual select and clipboard copy/paste.Kaz Kylheku2015-09-201-38/+232
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * linenoise/linenoise.c (struc lino_state): New member, clip, sel, end, dsel, dend, need_refresh, selmode. (sync_data_to_buf): Update the sel and end members of the structure based on dsel and dend, the way pos is being updated from dpos. (refresh_singleline, refresh_multiline): If visual selection mode is in effect, show the selected region in inverse video. (update_sel, clear_sel, yank_sel, delete_sel): New static function. (edit_insert): Delete the selection before inserting, so that the character appears to replace the selection. Set need_refresh flag instead of calling refresh_line. (edit_insert_str): New static function. Inserts string, replacing existing selection, if any. (paren_jump, edit_move_left, edit_move_right, edit_move_home, edit_move_end, edit_history_next): Set new need_refresh flag instead of calling refresh_line directly. (edit_delete): If selection is in effect, just delete the selection and return. Set need_refresh flag instead of calling refresh_line. (edit_backspace): If selection is in effect, and selection is not inverted (cursor is to the right of selection) then just delete the selection. Otherwise delete the selection, and perform the backspace. Set need_refresh flag instead of calling refresh_line. (edit_delete_prev_word): Delete the selection and the word before the selection. Set need_refresh flag instead of calling refresh_line. (edit_in_editor): Set need_refresh_flag instead of calling refresh_line, and cancel visual selection mode. (edit): Clear selection mode on entry. Update the selection variables on each loop iteration. Honor the need_refresh flag. New commands implemented: Ctrl-S, Ctrl-Q, Ctrl-X Ctrl-Q. Some commands need to set need_refresh flag. Some need to cancel selection mode. (lino_copy): Set the clip member of the cloned structure to null, otherwise there will be a double free of the clipboard buffer. (lino_cleanup): Free the clipboard and null out the pointer. * txr.1: Documented visual select.
* linenoise: sync_data_to_to_buf loses pointless arg.Kaz Kylheku2015-09-201-8/+8
| | | | | | | | * linenoise/linenoise.c (sync_data_to_buf): prompt argument removed. The value passed is always l->mlmode, and that is what it indicates. (complete_line, complete_line, sync_data_to_buf, refresh_multiline, edit_insert): Updated calls.
* linenoise: atom-gathering callback feature.Kaz Kylheku2015-09-182-1/+38
| | | | | | | | | | | | * 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: insert previous word featureKaz Kylheku2015-09-181-3/+44
| | | | | | | | * linenoise/linenoise.c (edit): Ctrl-X Ctrl-W, or Ctrl-X w, with an optional number in between, cause a word from the previous line to be inserted. * txr.1: Documented.
* linenoise: support suffix on temp file name.Kaz Kylheku2015-09-182-2/+19
| | | | | | | | | | | | | | 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.