diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2015-09-22 21:59:33 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2015-09-22 21:59:33 -0700 |
commit | eed5dd5b038d947f8288111503c6bf48e7e30f17 (patch) | |
tree | 698a95256f39b7b0e624553f281fbf6c643d29e0 /utf8.h | |
parent | 78e12d9c43b606f7402100a7c3b3367057d103d9 (diff) | |
download | txr-eed5dd5b038d947f8288111503c6bf48e7e30f17.tar.gz txr-eed5dd5b038d947f8288111503c6bf48e7e30f17.tar.bz2 txr-eed5dd5b038d947f8288111503c6bf48e7e30f17.zip |
linenoise: switch to wide characters, support Unicode.
* lib.c (chk_wrealloc): New function.
* lib.h (mem_t): Wrap with ifndef block.
(MEM_T_DEFINED): New preprocessor symbol.
(chk_wrealloc): Declared.
* linenoise/linenoise.c (LINENOISE_MAX_DISP): Adjust to a
reasonable value; just twice the number of abstract
characters. The 8 factor had been chosen to cover the worst
case that every character is mapped to a tab.
(struct lino_state): Almost everything char typed turns to
wchar_t. The TTY isn't referenced with Unix file descriptors,
ifd and ofd, but abstract stream handles tty_ifs and tty_ofs.
The ifs member isn't required any more since plain mode is
handled via the tty_ifs stream.
(mem_t): Declaration removed; now in linenoise.h.
(chk_malloc, chk_realloc, chk_strdup_utf8): Declarations
removed.
(lino_os): New static structure.
(nelem): New macro.
(wcsnprintf): New static function.
(enable_raw_mode, disable_raw_mode): Get Unix FD from stream
using lino_os interface.
(get_cursor_position, get_columns, handle_resize, record_undo,
remove_noop_undo, restore_undo, undo_renumber_hist_idx,
compare_completions, complete_line, lino_add_completion,
next_hist_match, history_search, show_help,
struct abuf, ab_append, ab_free, sync_data_to_buf,
refresh_singleline, screen_rows, col_offset_in_str,
refresh_multiline, scan_match_rev, scan_match_fwd, scan_fwd,
find_nearest_paren, usec_delay, flash, yank_sel, delete_sel,
edit_insert, edit_insert_str, edit_move_eol,
edit_history_next, edit_delete, edit_backspace,
edit_delete_prev_all, edit_delete_to_eol, edit_delete_line,
edit_in_editor, edit, linenoise, lino_make, lino_cleanup.
lino_free, free_hist, lino_hist_add, lino_hist_save,
lino_set_result): Revised using streams, wide chars and
lino_os interface.
(lino_init): New function.
* linenoise/linenoise.h (LINO_PAD_CHAR): New preprocessor
symbol.
(mem_t): Defined here.
(MEM_T_DEFINED): New preprocessor symbol.
(struct lino_os, lino_os_t): New structure.
(lino_os_init): New macro.
(struct lino_completions, lino_compl_cb_t, lino_atom_cb_t,
lino_enter_cb_t): Switch to wchar_t.
(lino_init): New function.
(lino_add_completion, lino_make, linenoise, lino_hist_add,
lino_hist_save, lino_hist_load, lino_set_result)
* parser.c (find_matching_syms, provide_completions,
provide_atom, is_balanced_line, repl): Adapt to
wide character linenoise.
(lino_fileno, lino_puts, lino_getch, lino_getl, lino_gets,
lino_feof, lino_open, lino_open8, lino_fdopen, lino_close):
New static functions.
(linenoise_txr_binding): New static structure.
(parse_init): Call lino_init, passing OS binding.
* txr.1: Update text about the listener's limitations.
Diffstat (limited to 'utf8.h')
0 files changed, 0 insertions, 0 deletions