Commit graph

26 commits

Author SHA1 Message Date
Charlie Gordon
d0f7b7a904 Various improvements for consistency
* add -Wno-packed compiler option
* add CONFIG_REGEX flag, undefined for tiny build
* disable regex commands in tiny build
* add documentation for some search commands and APIs
* reorder search tags for readability
* add isearch_yank_char
* use emacs names for:
  isearch-repeat-backward, isearch-repeat-forward,
  isearch-ring-advance, isearch-ring-retreat,
  isearch-yank-word-or-char
* add occur alias for list-matching-lines
* add char32_to_utf8()
* restored some macros in cutils.h:
  likely(x), unlikely(x), __maybe_unused, BOOL, FALSE, TRUE
* remove max(), min(), maxp(), minp(), clampp()
* add typed arithmetic functions:
   min_int(), max_int(), clamp_int(), min3_int(), max3_int()
   min_offset(), max_offset(), clamp_offset()
* use typed functions everywhere

* bump version to 5.4.1d
2022-11-21 00:20:18 +01:00
Charlie Gordon
6880277ec0 Improvements in search functions
* add search modes:
  copy-matching-lines, kill-matching-lines, list-matching-lines
  - add enum for search modes

* add search flag support in all search functions:
    search_forward, search_backward, count-matches, delete-matching-lines,
    delete-non-matching-lines, copy-matching-lines, kill-matching-lines,
    list-matching-lines, query-replace, replace-string
  - highlight matches during search string input
  - add search flag toggle functions in minibuffer_edit
    same code and bindings as for incremental search
  - add handlers in CompletionDef for minibuffer_edit session start and end
  - use generic search tag system to store flags in search string

* misc improvements and bug fixes:
  - test and set append-next-kill on kill-region
  - split `do_copy_region` from `do_kill_region`
  - remove argument in `do_kill_region` for `kill-region`
  - change immediate string argument code letter from 'S' to '@'
  - exit popup with do_popup_exit() in do_keyboard_quit
    remove popup_mode binding
  - add ESiii and ESsii command calling conventions
  - pass key and argval to:
    minibuffer_complete, do_minibuffer_complete_space,
    do_minibuffer_electric_key

* add default bindings:
    `next-error` on `M-g n`, `M-g M-n`
    `previous-error` on `M-g p`, `M-g M-p`
    `goto-line` on `M-g g`, `M-g M-g`, `C-x g`
    `goto-char` on `M-g c`

* bump version to 5.4.1a
2022-11-06 12:08:19 +01:00
Charlie Gordon
7e70e611b6 Use char32_t for all code point variables and arrays
- char32_t is defined in cutils.h but may conflict with <uchar.h>
- all qe_isxxx functions take a char32_t
- add etf8x encoding for full range of char32_t type
- add utf8_decode_strict()
- add ustr_match_keyword()
- utf8_encode() / utf8_decode() handle up to 32 bits
- improve detect_charset():
  - detect utf8 and utf8x
  - avoid failure on partial utf8 sequence at end of buffer
  - detect overlong utf8 sequences
- fix display bugs for code points beyond MAX_UNICODE_DISPLAY
- simplify do_compare_windows(), avoid magic char values.
- rename functions:
    eb_encode_uchar -> eb_encode_char32
    eb_insert_uchar -> eb_insert_char32
    eb_insert_uchars -> eb_insert_char32_n
    eb_match_uchar -> eb_match_char32
    eb_delete_uchar -> eb_delete_char32
    eb_replace_uchar -> eb_replace_char32
    utf8_to_unicode -> utf8_to_char32
- use char32_t for all variables and arrays holding code-points
- fix some language syntax parsers.
- fix detect_eol_type_32bit(), used uint16_t instead of uint32_t
- bump VERSION to 5.4.0
2022-10-29 19:43:38 +02:00
Charlie Gordon
0be702e51b use UTF-8 in uppercase in comments 2022-10-04 14:53:25 +02:00
Charlie Gordon
490ebfbb0b Fix gcc warning. Fixes issue #9 2022-09-29 12:19:58 +02:00
Charlie Gordon
1beb610d76 Update glyph width methodology
- rename unicode_tty_glyph_width() as qe_wcwidth()
- compute tables for qe_wcwidth() with tools/unicode_gen.c
  from the latest Unicode version
- add qe_wcwidth_variant() to determine if terminal may use
  incorrect width for a given glyph.
- reposition TTY cursor for glyphs with ambiguous width
- remove unicode_width.h
- add wcwidth.h and wcwidth.c generated by tools/unicode_gen.c
- update tools/unicode_gen.c and tools/unitable.c
- determine Unicode version support at start time
  displayed by describe-screen command
- display code point width and variant in what-cursor-position command (C-x ?)
- bumped VERSION to 5.3.4x
2022-09-27 22:30:05 +02:00
Charlie Gordon
d1fb4dde64 Add macros for block comparison, copy and move
After spending a few hours debugging a stupid memcpy size error, I
decided to use a typed version of memcpy, memcmp and memmove wherever
the array type size is greater than 1.

- add blockcmp(p1, p2, n), blockcpy(p1, p2, n), blockmove(p1, p2, n)
  for operation on typed arrays
- add max_uint() and min_uint()
- bumped VERSION to 5.3.4w
2022-09-27 09:32:41 +02:00
Charlie Gordon
bd50376780 Various improvements
- add charset.h
- add tools/unitable.c to compute unicode_width.h
- add tools/unicode_gen.c to compute more unicode tables
- use Unicode 15.0.0
- add rules to compute width tables from Unicode tables and TTY
- move basic definitions from util.h to cutils.h
- use CONFIG_SESSION for session support (undefined if CONFIG_TINY)
- define CompleteFunc and CT_xxx flags for completion functions
- pass CompleteFunc to xxx_complete() functions
  this allows more generic implemetation, without including qe.h
- rename fill_border() as fill_window_slack() for readability
- add QELEVEL environment variable to detect recursive invocation
- use stricter parser for load_ligatures()
- bump VERSION to 5.3.4u
2022-09-19 15:16:59 +02:00
Charlie Gordon
8c08dae0b0 Only report errors when evaluating configuration files
- fix has_linum_mode(), was reporting incorrect value
- put_error() messages are also reported as status messages
- qe_parse_script() reports parsing errors with put_error()
- prevent potential infinite loop in shell_mode_free()

- bump VERSION to 5.3.4o
2022-09-06 22:19:03 +02:00
Charlie Gordon
e7c7a14400 Improve qescript parser and evaluator
- improve operator lexer: produce token and precedence on 1 step
- merge parser.c and qescript.c

Fix other bugs
- close display before freeing memory in --free-all
- free TTYState in tty_dpy_close()
- free VarDef memory in --free-all
- fix crash bug on --free-all due to duplicating ModeDef structures

Improve variable handling:
- move do_describe_variable() to variable.c
- add var_alloc and str_alloc flags in VarDef to fix `end` hack
- remove ugly kludge to detect allocated strings
- type variables retrieved from environment
- free variable data on --free-all

- bump VERSION to 5.3.4m
2022-09-05 20:27:48 +02:00
Charlie Gordon
4475afab01 Use isearch pseudo mode for function dispatch
Extend command dispatch system:
- add CMD_ARG_OPAQUE argument type
- add ISS and ISSi command signatures for ISearchState
- add CMDx() macro for disabled and future commands
- restrict command set in parsers
- add opaque argument for exec_command()
- add sort-region command, same as sort-lines

Extend binding system:
- move do_unset_key() from extras.c to qe.c
- accept bindings lists in unset-key commands
- add exact argument for qe_find_binding()
- reorder xxx_bindings arrays

Improve emulation functions:
- improve set-emulation command:
  - add xxx_bindings arrays for emulations
  - add register_emulation_bindings()

Search system:
- use exec_command to dispatch isearch functions
  this allows easy redefinition of bindings, especially
  useful for emacs flavor emulations
- add isearch_commands[] with bindings and command descriptions

- bumped version to 5.3.4g
2022-08-30 10:00:42 +02:00
Charlie Gordon
fc698bd138 Fix compilation warnings
- use correct variable to expand TABs in corner case in VT100 emulator
  thanks to gcc who spotted a variable set but not used :)
2022-08-29 19:02:02 +02:00
Charlie Gordon
4939f6e927 Fix overwrite mode issues
- rename s->insert as s->overwrite with opposite semantics
- fix overwrite mode behavior:
   TABs are filled, then removed
   TABs and newlines are always inserted
   backspace removes TABS and newlines
   backspace overwrite previous glyph with 1 or 2 spaces except at EOL
   backspace only replaces with spaces before a TAB to preserve layout
   quoted-insert always inserts
- quoted-insert inserts special key as escape sequences
- make KEY_UNKNOWN and KEY_NONE special keys matched by KEY_IS_SPECIAL()
- eb_replace() returns the number of bytes written
- add text_screen_width() to compute the actual screen column
- add convenient bindings for laptops with limited special keys:
  - overwrite-mode: C-c o
  - insert-mode: C-c i
  - toggle-read-only: C-c %
  - not-modified: C-c ~
- document set-visited-file-name
- remove filename if set-visited-file-name with an empty string
- simplify eb_insert_uchars()
- bumped version to 5.3.4e
2022-08-29 18:41:29 +02:00
Charlie Gordon
7aca319d3c Fix backspace behavior over wide glyphs
- add qe_iswide()
- add eb_next_glyph() / eb_prev_glyph()
- use a larger unicode_glyph_range_index[] array
- add s->cur_offset_hack to track when current position is in
  the middle of a wide glyph
- pass w to qe_term_overwrite(): erasing 1 or 2 positions
- erase partially overwritten wide glyphs
- remove qe_term_put_char()
- bumped version to 5.3.4d
2022-08-29 02:55:50 +02:00
Charlie Gordon
36d3644dbe Fix behavior on special glyphs
- add eb_skip_accents(), eb_skip_glyphs(), eb_delete_glyphs()
- overwriting a character with accents replaces it completely
- C-d deletes characters along with subsequent accents
- handle wide characters and accents in shell console
- handle repeated wide characters
- use Hex in trace_buffer for non-ASCII bytes
- bumped version to 5.3.4c
2022-08-28 20:28:40 +02:00
Charlie Gordon
c0544c741f More improved VT100 emulation in shell buffers
- use qe_term_get_pos2() for DCH
- bump VERSION to 5.3.3f
2022-08-27 19:27:44 +02:00
Charlie Gordon
f85805f683 Improved VT100 emulation in shell buffers
- add screen_top to avoid recomputing from buffer contents
- fix getline behavior on very long lines in shell buffer
- add LF bindings to run qemacs in lldb session
- qe_term_get_pos() returns screen start
- handle \t and wide chars inside shell buffers for xy positioning
- split qe_term_goto_pos() from qe_term_goto_xy()
- add flags in qe_term_goto_pos():
  TG_RELATIVE_COL: column number is relative to offset position
  TG_RELATIVE_ROW: row number is relative to offset position
  TG_RELATIVE: column and/or row is relative
  TG_NOCLIP: do not clip destx/desty coordinates
  TG_NOEXTEND: do not modify buffer to reach destination
- add qe_term_fix_wrap() to break wrapping lines
- fix qe_term_goto_tab() behavior on long lines
- fix qe_term_skip_lines() to handle wrapping lines
- handle UTF-8 for lastc and repeat graphics character
- bump VERSION to 5.3.3e
2022-08-26 12:30:29 +02:00
Charlie Gordon
3bbee69742 Multiple improvements
improve command and bindings registration:
- simplify command and binding registration APIs
- add bindings member in ModeDef structures
- rename qe_register_cmd_table() as qe_register_commands(), change API
- add qe_register_bindings() taking mode, command-name and bindings string
- rename qe_mode_set_key() as qe_register_command_binding()

improve buffer listing:
- add BF_SHELL buffer flag for shell buffers
- show current directory of shell buffers in bufed

improve dired:
- add dired-hide-details-mode on "("
- use details_mask to control long listing

improve trace doctor:
- add EB_TRACE_DEBUG trace flag for debugging traces
- add do_set_trace_flags()
- change do_start_trace_mode() to do_toggle_trace_mode() with arg

misc:
- fix make_user_path() for pathnames without a trailing slash
- use separate commands for prefix_argument handling
- improve strstart(), strend(), pstrcpy(), pstrncpy(), get_dirname()
- add strmatchword() like strstart with check for word boundary
- bumped version to 5.3.3d
2022-08-22 17:13:26 +02:00
Charlie Gordon
cde31421e7 More command description improvements
- use code characters from emacs (interactive) function
  - 'd' for numeric point value
  - 'p' for numeric prefix argument
  - 'P' for raw prefix argument
  - 'q' for negated numeric prefix argument
- handle synthetic and default arguments in parser.c
- add describe-function, bound to C-h f, need more work
- add sort-columns, sort-numbers, sort-paragraphs
- rename sort-region as sort-lines
- remove reverse-sort-buffer and reverse-sort-region
  passing C-u argument does reverse on all sort commands
- update TODO list
- bumped version to 5.3.3a
2022-08-19 16:52:26 +02:00
Charlie Gordon
8061f9493a Change command definitions
- pass description as 3rd argument to CMDx() macros
- normalize argument specifications
- 'p' means point
- 'a' means argval
- 'A' means argval premultiplied by value
- pass argval before value to do_split_window(),
  do_isearch(), do_sort_span(), do_sort_region(), do_sort_buffer()
- add SF_SILENT flag to suppress messages in eb_sort_span()
- bumped version to 5.3.3
2022-08-19 12:13:52 +02:00
Charlie Gordon
a6db66f470 Add command descriptions
- improve command definitions
- add descriptions for most commands
- bumped version to 5.3.2b
2022-08-18 01:33:00 +02:00
Charlie Gordon
1ba2c2b0bb Simplify and clean up command definitions
- use standard bindings string to all CMDx() definitions
- remove CMDx() key and alt_key
- remove compact key macros: KEY_CTRLX, KEY_CTRLXRET,
  KEY_CTRLH, KEY_CTRLC
- removed qe_register_binding2,
- qe_register_cmd_table() takes array length
- remove CMD_DEF_END and CmdDef chaining
- add CmdDefArray to store commands in const arrays
- strtokeys() takes end pointer
- add C-@ as name for null control key
- removed many hacks in CmdDef handling
- merge electric key commands
- fix ~ minibuffer behavior
- bumped version to 5.3.2
2022-08-16 22:40:44 +02:00
Charlie Gordon
d052ab31ff Fix many compilation warnings for clang -Weverything
- made some local objects static
- fix many const cast issues
- fix comma operator warnings
- add const correct strtol_c(), strtoll_c(), strtold_c()
- add unconst(t) to override const removal warnings
- comment VLAs and flexible arrays
- use get_basename_offset() to enable const correct
  get_basename() and get_basename_nc()
- use get_extension_offset() to enable const correct
  get_extension() and get_extension_nc()
- always include config.h
- use size_t for some size arguments:
  umemmove(), umemcpy(), umemcmp(), qe_memicmp()
- add qe-doc.info and qe-doc.pdf targets
- fix shadowing bug in buf_write: used tor return 0 instead of byte count
- bumped version to 5.3.1e
2022-08-10 18:50:19 +02:00
Charlie Gordon
1418387ce8 Improve buffer contents sorting
* add progress indicator every 8K comparisons
* add 2 byte cache on line contents
* add chunk offset to skip columns and ignored bytes
  also used for SF_BASENAME
* add filter-matching-lines
* prevent man-mode on .doc files
* allow ^Z bytes in text files
* add extra column syntaxes for compilers error messages
2022-03-21 16:30:28 +01:00
Charlie Gordon
213eba6ab7 use ptsname and posix_openpt for pseudo-ttys 2021-04-19 00:43:57 +02:00
Charlie Gordon
46d9be3442 Reorganize repository tree
- move language syntax handling to `lang` directory
- move other modes to `modes` directory
- move tools to `tools` directory
- compile tools to `bin` directory
- bump version to 5.3alpha
- remove duplicate node names in qe-doc
- update Makefiles
2020-11-11 19:31:07 +01:00
Renamed from shell.c (Browse further)