Commit graph

1,268 commits

Author SHA1 Message Date
oguillaumin
0450984ffd more ideas 2024-08-31 13:49:00 +02:00
oguillaumin
d2aa2a8c13 colorize grep -[ABC] output in shell buffers 2024-08-31 13:49:00 +02:00
oguillaumin
f05215c22c Add space deleting commands
* `delete-leading-space`: Delete any leading whitespace on the current line
* `delete-trailing-space`: Delete any trailing whitespace on the current line
* `delete-trailing-whitespace` Delete all the trailing whitespace across the current buffer.
These commands handle the region if highlighted
2024-08-31 13:49:00 +02:00
oguillaumin
1e691469a2 Add automatic block quoting on electric keys
* typing '"`<>()[]{} when a block is highlighted inserts matching delimiters
  around the block.
2024-08-31 13:49:00 +02:00
oguillaumin
5bef7b771f Add state and buffer fields
* add `b->ref_count`
* add `b->qs` pointer
* add `qs->first_hidden_window`
* handle both window lists in `edit_detach()`
2024-08-31 13:49:00 +02:00
oguillaumin
2d9800662a Substantial dired rewrite
* add hierarchical view in dired left panel:
  - left on closed dir or file moves to parent dir
  - left on closed dir or file with no parent inserts the open parent dir at the top
  - right on closed dir opens the directory
  - right on open dir goes down to last visited item in this list or first if none
  - right on file skips to the right window in preview mode
  - space on directory expands or collapses it
* add `do_dired_path()`
* fix `qe_load_file()` for directories specified as relative paths
* fix `qe_load_file()` loading a directory into the dired left panel
* add dired sorting by fullname
* fix directory grouping for non alpha sort
* use direct array of `DiredItem` instead of `StringArray`
* add `dired_ignore_extensions[]`
* add `classify_fullnames()` to help with tree sorting
* add completion on `dired-sort` prompt
* add `dired-summary` on `?`
2024-08-31 13:49:00 +02:00
oguillaumin
574cb4ac0f Add utility functions
- `canonicalize_path` returns destination array
  allow for destination to overlap source
- `qe_strcollate` compare directory name before contents
  this fixes the pathnames sorting
- add `get_relativename(filename, dirname)`
2024-08-31 13:49:00 +02:00
oguillaumin
2995c4d9b4 Add colorizer for SerenityOS Jakt language 2024-08-31 13:49:00 +02:00
oguillaumin
17b0c4803d Add sreg_match(): simple regular expression matcher
Simple regexp patterns use a subset of POSIX regexp:
- only simple character classes, no escape sequences
- no assertions (except $), no backreferences
- embedded groups always generate maximal matches which
  may cause the outer expression to fail match
2024-08-31 13:49:00 +02:00
oguillaumin
667f18f774 more ideas 2024-08-31 13:49:00 +02:00
oguillaumin
2c2a91043e Fix some indentation issues
* fix `replace_indent` in mixed TAB/SPC cases
* merge `get_indent_chars` into `make_indent`
* improve `normalize_indent`
2024-08-31 13:49:00 +02:00
oguillaumin
329204ab58 improve C comment colorization of diff output in shell buffer 2024-08-31 13:49:00 +02:00
oguillaumin
d427acc62a Comments, ideas 2024-08-31 13:49:00 +02:00
oguillaumin
1d3cabeaa2 Improve indentation commands
* add `find_indent` and `make_indent` ancillary functions
* add `untabulate` on `S-TAB` to remove one indentation level
* rename `do_tab` as `do_tabulate` for consistency
* `tabulate` indents the region one level if visible
* add `indent-rigidly` commands: indent block interactively
2024-08-31 13:49:00 +02:00
oguillaumin
9fde8fd9b9 Add syntax mode for nanorc files 2024-08-31 13:49:00 +02:00
oguillaumin
a2ddad9aba Merge qeconfig.h into qe.c
- remove qeconfig.h
- insert `basic_commands` definition table in main module qe.c
2024-08-31 13:49:00 +02:00
oguillaumin
f44d9bdf74 Add multiline cursor editing
- add `swap_int()`
- add commands for multi-line cursor:
  * `start-multi-cursor` on `C-x <`
    set the mark for a region with a cursor on each line
  * `end-multi-cursor` on `C-x >`
    end recording the multi-line cursor region and start editing
    cancel the multi-line cursor with `C-g`
  * `add-multi-cursor` on `C-x #`
    add an extra cursor at point. Activate multi-line cursor editing
    with `C-x \`
  * `activate-multi-cursor` on `C-x \`
    start multi-line cursor editing. Stop with C-g.
- UX is tentative, more work needed based on usage.
2024-08-31 13:49:00 +02:00
oguillaumin
6d4f13b9ea add preliminary syntax mode for the rye language 2024-08-31 13:49:00 +02:00
oguillaumin
e77e21bffd Select region on shifted cursor movement keys 2024-08-31 13:49:00 +02:00
oguillaumin
509303a416 Improve documentation
- add @include directive
- add `match_annotation` for flexible matching, ignoring - and _
- add `fatal()`, `error()` and `warning()` handlers
2024-08-31 13:49:00 +02:00
oguillaumin
da0ce59b03 fix shell mode colorisation 2024-08-31 13:49:00 +02:00
oguillaumin
ee2e3c767b Colorize lines up to 16 MB
- add `eb_get_line_length()`
- move `buf` and `sbuf` to `QEColorizeContext`
- reallocate line and style buffers on long lines
2024-08-31 13:49:00 +02:00
oguillaumin
494ea38c33 Improve memory allocation APIs
- replace `qe_malloc_dup()` with `qe_malloc_dup_bytes()` and `qe_malloc_dup_array()`
- replace `qe_realloc()` with `qe_realloc_bytes()` and `qe_realloc_array()`
- pass numbers of objects to `qe_malloc_dup_array` and `qe_realloc_array`
- add `qe_strndup()`
2024-08-31 13:49:00 +02:00
François Revol
0935cb4894
Atari port fixes (#35)
* Do not use CFLAGS for host tools when cross-compiling.
* Add a missing $(EXE). Maybe we should have a HOST_EXE but at least we can build.
* set target OS & CPU
  Not really used, only for cosmetics.
  Also, m68k is big endian. (Do we use this anywhere yet?)
* Force GNU-C99 standard for LLONG_MIN
* work around missing d_type in dirent struct
2024-07-28 00:04:20 +02:00
Charlie Gordon
7b803ace0e Improve syntax coloring APIs
* pass const `char32_t` array and `QETermStyle` array to `ColorizeFunc`
* add `cp_colorize_line()` wrapper to call colorizer function on null
  terminated buffer.
* remove unused `EditBuffer` colorize fields
* remove `EditState` field `colorize_func`: rely on `colorize_mode` only
* no longer combine style into codepoint buffer.
* remove `STYLE_BITS`, `STYLE_SHIFT`, `CHAR_MASK`
* rename `set_colorize_func` as `set_colorize_mode`
* rename `SET_COLOR` and `SET_COLOR1` as `SET_STYLE` and `SET_STYLE1`
* add documentation for buffer API functions
2024-07-28 00:00:03 +02:00
Charlie Gordon
3852fb9c19 Update copyrights 2024-07-28 00:00:03 +02:00
Charlie Gordon
4be625f5c4 Improve macro handling
* add `macro-counter` variable
* add `QEState` fields `nb_macro_keys_run`, `macro_counter`, `macro_format`.
* add `int find_key_suffix(const char *str, char c)`
* pass `argval` to `do_call_last_kbd_macro` to handle early exit
* add `clear_macro`, `stop_macro`
* add `int check_format_string(const char *fmt, const char *template)`
* do not use `alloca` for `eb_vprintf`
* add `dbuf_str(db)`: null terminate the buffer and return a string pointer.
* add macro commands:
  `edit-last-kbd-macro`, `name-last-kbd-macro`, `insert-kbd-macro`,
  `read-kbd-macro`, `macro-add-counter`, `macro-set-counter`,
  `macro-insert-counter`, `macro-set-format`
* `start-keyboard-macro` restarts macro learning mode if learning already
* add documentation on macro commands
* stop macros upon errors (when ringing the bell)
* stop macros if prompting the user for confirmation
2024-07-28 00:00:03 +02:00
Charlie Gordon
84393d6c4f Add bell sounds
* add `QEDisplay::dpy_sound_bell`
* add `\007` prefix in `put_status` to sound bell
2024-07-28 00:00:03 +02:00
Charlie Gordon
492a8fc0ce Improve macro handling
* `C-x (` restarts macro learning mode if learning already
* add documentation on macro commands
2024-07-28 00:00:03 +02:00
Charlie Gordon
1df739bcb0 ocumentation
* add documentation comments
* `dbuf_init` and `dbuf_init2` return the object
* usr portable `memcpy` based approach for unaligned word access
2024-07-28 00:00:03 +02:00
Charlie Gordon
ea123bb012 Simplifications
* use `cp_skip_blanks` in language colorizers
* simplify signature matching for here documents
2024-07-28 00:00:03 +02:00
Charlie Gordon
af64810cb4 Add documentation on utility functions
* add `int ustr_get_identifier_x(dest, size, c, str, i, n, c1)`
* add `int cp_skip_blanks(const char32_t *str, int i, int n)`
2024-07-28 00:00:03 +02:00
Charlie Gordon
66f4b556ff Add documentation on utility functions
* adjusted `ustr_match_keyword` for consistency
* implement `byte_quote` natively
* implement `buf_byte_quote` using `byte_quote` instead of the reverse
2024-07-28 00:00:03 +02:00
Charlie Gordon
131490e482 Improve ppl-mode 2024-07-28 00:00:03 +02:00
Charlie Gordon
65e1bfcea7 Improve buf_t API and documentation
* rename `buf_encode_byte()` as `buf_quote_byte()`
* change `buf_printf` return value for consistency
* let `strquote` always return the length of the conversion like `snprintf`
2024-07-28 00:00:03 +02:00
Charlie Gordon
d60df466d3 Improve ustr_get_identifier
* remove `get_salmon_identifier()`
* change `swift_parse_identifier()` for consistency
* change `wolfram_get_identifier()` for consistency
2024-07-28 00:00:03 +02:00
Charlie Gordon
6e2b6e24c2 Add eb_add_tag()
* add `eb_add_tag(b, offset, name)`:
  * check for duplicate definitions
  * duplicate string argument
* use `ab_add_tag()` instead of `eb_add_property()` from language colorizers
* fix `get_js_identifier()` for `c == 0` case.
2024-07-28 00:00:03 +02:00
Charlie Gordon
a345775998 Add PPL mode
Add colorizer for Christian Neumanns' Practical Programming Language
2024-07-28 00:00:03 +02:00
Charlie Gordon
78254429f4 Some simplifications in C modes
* add `cp_skip_blanks()`
* extend `get_js_identifier()` for `c == 0` case
* export `java_mode`
* add documentation
2024-07-28 00:00:03 +02:00
Charlie Gordon
9e498ab933 remove unused target definitions 2024-07-28 00:00:03 +02:00
Charlie Gordon
e0d9a641d3
Add repeat-mode (#34)
- add `repeat` command on `C-x z`
- add `repeat-mode`, always enabled
- cycle all matching tags in current file on `goto-tag` and `find-tag`
- set up `repeat-mode` for these commands:
  - `undo` on `C-x u` (`u` repeats `undo`, `r` performs `redo`)
  - `undo` on `C-x r` (`r` repeats `redo`, `u` performs `undo`)
  - `find-window-left`, `find-window-right`, `find-window-up`, `find-window-dow`
    repeat navigation on `up`, `down`, `left`, `right`
  - `next-error`, `previous-error`: `M-n` and `M-p` repeat in corresponding direction
  - `next-buffer`, `previous-buffer: repeat buffers nagivation with `left` and `right`
  - `enlarge-window` / `shrink-window`: repeat resizing on `^`, `v`, `{`, `}`
     and cursor movement keys
  - `goto-tag` on `C-x ,` goto next tag with `,` and `.`
  - `call-last-kbd-macro` on `C-x e`: repeat macro on `e`
- add `eb_count_buffers` and `eb_get_buffer_from_index` for safe buffer navigation
- add transient bindings, known as repeat maps in GNU emacs
- pass `KeyDef **lp` (aka key maps) instead of mode for binding commands
- replace `do_next_buffer` and `do_prevous_buffer` with repeatable command
  `do_buffer_navigation`
- fix `bufed_select` crash bug when selecting buffer from a regular window
2024-05-25 23:37:05 +02:00
Charlie Gordon
6f34c65ef9
Use 1-based column numbers (#33)
- make `do-goto` accept a 1-based column number
- parse 1-based column numbers in filenames from the command line
- display 1-based column number in status lines
2024-05-21 15:14:55 +02:00
Charlie Gordon
7955a5aebb
Add window resizing commands (#32)
- add `enlarge-window` on `C-x ^`: Enlarge window vertically
- add `shrink-window` on `C-x v`: Shrink window vertically
- add `enlarge-window-horizontally` on `C-x }`: Enlarge window horizontally
- add `shrink-window-horizontally` on `C-x {`: Shrink window horizontally
- add `resize-window` on `C-x +`: Resize window interactively using the cursor keys
closes issue #21
2024-05-21 01:49:13 +02:00
Charlie Gordon
ea6a70963e
Improve documentation, configure and CI(#31)
- update **scandoc** tool
- start manual framework in qe-manual.c
- build qe-manual.md as a default target
- add more targets: linux-32bits, linux-390x, NetBSD, OpenBSD
- fix FreeBSD target: define `host_cc` 
- test for `bwapxx` macros
- test for `clang` / `gcc` / `tcc` compiler presence
- handle non standard `which` utility
2024-05-20 19:43:01 +02:00
Charlie Gordon
e2116cbdae
Modify perl colorizer for consistency with other languages (#30) 2024-05-20 11:03:29 +02:00
Charlie Gordon
b38d95345f
Add window-swap-states on C-x / to transpose windows (#29) 2024-05-20 00:29:23 +02:00
Charlie Gordon
04499c8adc
Sundries (#28)
- display character for `eval` results in range 32 to 127
- load files in memory up to 16MB
2024-05-19 21:32:00 +02:00
Charlie Gordon
ceb6b3370f
Add *equivalents* for compare-windows (#27)
*equivalents* are strings that should compare equal in a `compare-windows`
session. You can define such strings in a **.qerc** file in the directory of
one of the files being compared.  This helps ignoring known changes such as
type of function renaming... Here is an example to help compare files between
the `bellard/quickjs` and the `quickjs-ng/quickjs` repositories:
```
define_equivalent("JS_DupValue(ctx, ", "js_dup(");
define_equivalent("JSValue", "JSValueConst");
define_equivalent("JS_NewInt32(ctx, ", "js_int32(");
define_equivalent("JS_NewInt32(ctx,\n", "js_int32(");
define_equivalent("JS_NewUint32(ctx, ", "js_uint32(");
define_equivalent("JS_NewUint32(ctx,\n", "js_uint32(");
define_equivalent("JS_NewBool(ctx, ", "js_bool(");
define_equivalent("JS_NewFloat64(ctx, ", "js_float64(");
define_equivalent("JS_EXTERN ", "");
define_equivalent("JS_EXTERN JS", "JS");
define_equivalent("JS_EXTERN JS_", "JS_");
ignore_equivalent = 1;
```
Other changes were necessary for proper utf8 skipping:
- add `utf8_prefix_len(str1, str2)` to compute the length of a common initial
  prefix not falling inside UTF-8 encoded codepoints.
- add `utf8_decode_prev` to get the previous codepoint
- add `eb_match_str_utf8_reverse`
2024-05-19 21:16:37 +02:00
Charlie Gordon
c62d0f88ff
Fix fallthrough macro for older gcc compilers (#26) 2024-05-19 19:57:00 +02:00
Charlie Gordon
ed1cb90a91
add multi target build workflow (#25) 2024-05-19 19:28:59 +02:00