Commit graph

1,397 commits

Author SHA1 Message Date
Charlie Gordon
dc4eb3efb6 man: ensure full manual page is formatted and uses hightlighting
- set `MAN_KEEP_FORMATTING=1` and `MANPAGER=cat` for the man
  command and handle overstriking in the terminal emulation.
- this approach works on macOS, linux, FreeBSD and OpenBSD
2026-05-17 16:12:36 +02:00
huwwa
cbeb5d4acd Shell: prevent man command from paging
- apply infinite-height prior to winsize initialization.
- use `LESS_LINES` environment variable.
- use `PAGER=less -F` to make less quit at the end of the man page
2026-05-17 12:49:56 +02:00
Charlie Gordon
ca1eb2ff88 util: simplifications and doc fixes
* add `qe_shell_match` to replace `fnmatch`
* fix some documentation errors
2026-05-17 12:17:25 +02:00
Charlie Gordon
2109b2b536 util: do not test pointer before calling qe_free
* testing the pointer before calling `qe_free` is considered
  useless and bad style in the project.
2026-05-17 12:16:57 +02:00
huwwa
053871bec7 Pager: verify existance of last buffer on abort 2026-05-17 00:03:01 +02:00
huwwa
34488a2ed4 Shell: use window width and height fields directly 2026-05-17 00:03:01 +02:00
huwwa
e8518d0b9b popup: fix bugs
- if command was started from a popup window then reuse it.
- delete window only if popup.
2026-05-16 22:46:01 +02:00
huwwa
eefc007d60 Pager: add pager-abort command 2026-05-16 22:32:06 +02:00
huwwa
c654f504e5 Shell: refine target window selection logic
The behavior follows this priority order:

1. reuse an existing window already displaying the buffer,
2. if shell-command-other-window is not set, use the current
   window, otherwise
3. select the largest available non-active window.
4. split a new window if no sutiable window is found.
5. fall back to the current window if splitting fails.
2026-05-16 22:32:06 +02:00
huwwa
a927d093ab Shell: improve shell_close/shell_read_cb
- add check when process is signaled.
- put appropriate status message when non-interactive.
- follow output stream when non-interactive.
2026-05-16 22:32:06 +02:00
huwwa
ec1aee59a4 Shell: cosmetic changes
- add interactive shell process caption.
- rearrange lines.
2026-05-16 22:32:06 +02:00
huwwa
13d1668a63 modes: improve papup mode
- Add `popup-abort` command.
- Update caption and restore readonly when reusing popup buffer.
- Prevent bugs when changing from minibuf to popup window.
2026-05-15 14:31:58 +02:00
huwwa
e79b7974bc popup-list: support M-n and M-p to move by 4 lines 2026-05-15 14:31:58 +02:00
Charlie Gordon
e84394a8bb navigation: improve forward-block / backward-block
* improve block skipping:
  - if starting inside a string or a comment, skip to the end of the
    string or comment while balancing blocks
  - otherwise skip string and comments when balancing blocks
  - fix behavior on very long lines, eg: **highlight.pack.js**
* if a nesting error occurs, point and mark are set around the mismatched
  delimiters. use C-x C-x to skip between them
* simplify `get_colorized_line()`
* add `cp_get_line()` to factorize code
* add `eb_peek_prevc()` to get previous codepoint without end offset
* improve documentation conciseness
2026-05-14 16:13:16 +02:00
Charlie Gordon
5a37c1cbc3 occur: reuse the same buffer but clear contents
* use `BC_REUSE | BC_CLEAR` to avoid killing the `*occur*` buffer
* this ensures the `*occur*` buffer stays current in windows that show it
* modify the `BC_CLEAR` semantics to imply `BC_REUSE`
* simplify calls: remove redundant `BC_REUSE` flag
2026-05-11 19:16:05 +02:00
Charlie Gordon
7f3b31d8d4 Shell: add optional shell modes
- `shell_buffer_read_only` controls if the shell buffer should become
  read-only and use pager-mode when not interactive
- `shell_mode_auto_interactive` controls if the shell interactive mode is
  switched to and from automatically based on cursor movement commands
- disable auto interactive if region is highlighted
- fix crash bug in qe_register_emulation_bindings for "emacs" emulation
2026-05-11 00:21:56 +02:00
huwwa
880aa115cd shell: sync interactive state between windows sharing the same shell buffer 2026-05-11 00:21:56 +02:00
huwwa
7d7a7d0fac shell: update toggle input status message 2026-05-11 00:21:56 +02:00
huwwa
2af3c40706 shell: split interactive and non-interactive shell commands 2026-05-11 00:21:56 +02:00
huwwa
5b87d2e4ff shell: manage interactive mode and readonly state
* decouple interactive mode from cursor position.
* clear readonly when entering interactive mode and
  restore when leaving it.
* simplify navigation logic by removing offset-based toggling.
* set pager mode on interactive shell exit.
2026-05-11 00:21:56 +02:00
Charlie Gordon
3f9f332268 Mojo: fix string parsing
* simplify string parsing and state bits
* fix raw string parsing
* support template strings with recursive coloring
2026-05-11 00:20:33 +02:00
Charlie Gordon
b3433cf4f4 Lang: add colorizer for the Mojo language
* initial support for [Mojo](https://mojolang.org/), a high performance language
  with a Python-like syntax by Modular
2026-05-10 17:35:05 +02:00
Charlie Gordon
582a6ee384 Modes: Add MDX mode for markdown/JSX mixed contents
* preliminary support for [MDX](https://mdxjs.com/) mode
* uses only markdown for now, will detect and colorize JSX parts later
2026-05-10 17:34:48 +02:00
Charlie Gordon
b3355d3224 fix compilation warning 2026-05-06 14:23:14 +02:00
huwwa
8a9c4412ed shell: check process termination before closing 2026-05-06 14:23:14 +02:00
huwwa
668a4be142 shell: avoid leaving stray processes when reusing a shell buffer
* check for active processes in shell buffers before reusing them,
  and prompt the user to kill the running process to avoid leaving
  it detached and unreachable.
2026-05-06 14:23:14 +02:00
huwwa
640ad15e4d shell: try to split window for shell commands 2026-05-06 14:23:14 +02:00
huwwa
db2bbc4c71 remove extra new line with caption
* `ctime` format ends with a new line.
2026-05-06 14:23:14 +02:00
huwwa
4d3e1e0810 shell: encapsulate error variables in a global ShellError structure 2026-05-06 14:23:14 +02:00
huwwa
c6ea0d0d8c avoid mode name collision 2026-05-06 14:23:14 +02:00
huwwa
b3f37b7b23 check for active process associated with the buffer before killing it
* killing a shell buffer while its process is still running can leave the
  process alive but no longer accessible.
2026-05-06 14:23:14 +02:00
huwwa
42c88b10ca default exit status to -1 if not launched 2026-05-06 14:23:14 +02:00
huwwa
aeb0767a3c fix: defer pty closure until buffer is fully drained
fixes a race condition where pty data was lost on process exit.
The pid callback now flags the exit status, while `shell_read_cb`
handles the final teardown. This prevents truncation for
high-throughput processes.
2026-05-06 14:23:14 +02:00
huwwa
adc72a8b0a set readonly flag for compilation buffer 2026-05-06 14:23:14 +02:00
huwwa
9502e20d52 fix: use appropriate buffer flag 2026-05-06 14:23:14 +02:00
Charlie Gordon
74ed0a3806
windows: fix glitches in window size management (#109)
* fix bug on screen resize with default dired layout
* fix resize bug: vertical layout changed when screen width was adjusted
* rename `update_split_ratio` as `compute_virtual_window_size`
* remove `update_all_split_ratios` and `restore_coordinate_from_ratio`
* recompute window size in more necessary places
* use character sizes for minimum window width/height
* show virtual window size in `describe-window`
* add `C-x V` binding for `shrink-window`
2026-05-05 21:07:03 +02:00
4g4
de8bd02766
winlayout: use virtual coordinates to keep split ratio when changing screen dimensions (#93)
* add virtual window dimensions `xx1, xx2, yy1, yy2` in units of 1/1024
* update virtual coordinates when dragging vertical/horizontal split separator
* update window size using virtual coordinates on terminal resize
2026-05-04 10:24:50 +02:00
4g4
d2178d9b3b
Fix compile warning on macOS (#107)
* the macro `LIST_HEAD` is already defined in macOS
* rename macro `LIST_HEAD` as `QE_LIST_HEAD`
2026-05-04 08:29:43 +02:00
4g4
91f7ff6fe2
fix: occur command didn't clear the previous result (#104)
The `occur` command creates an `*occur*` buffer to show the matches in the current buffer.
If we used `occur` to search another string, then the old *occur* buffer was still there and our new search result were not shown. Killing buffer `*occur*` before creating a new one solves the problem.
2026-05-01 09:25:56 +02:00
huwwa
2fd8c1c9bb
bugfix: prevent infinite window splitting (#102)
* refuse to split vertically height is less than 3 line.
* refuse to split horizontally if width is less than 9 characters.
2026-05-01 08:44:07 +02:00
huwwa
f77ea8db3f fix: redraw minibuffer prompt when refocusing window
The minibuffer prompt was not redrawn after switching to another
window and then back to the minibuffer.
2026-04-30 23:05:24 +02:00
Charlie Gordon
6409d7eeb1 build: fix missing prototype warning
* fix clang warning [-Wmissing-prototype]:
  non static functions must be declared prior to definition
2026-04-30 16:38:52 +02:00
4g4
ded51b934f
feature: Add back-to-indentation command (#98)
Move point to the first non-whitespace character on this line.
2026-04-30 15:43:28 +02:00
4g4
202f599e99 Revert "fix bottom right corner refresh"
This reverts commit e593c24afbfec00137bc47a8b89790b295d3db3c.
2026-04-30 15:38:40 +02:00
4g4
5526233480 fix bottom right corner refresh
This hack is only needed in old terminals. In modern terminals we do not
need this. Besides, removing this hack will refresh the bottom right
corner.
2026-04-30 15:38:40 +02:00
Charlie Gordon
a599bc8503 Make important TODOs more obvious 2026-04-30 11:14:26 +02:00
popflag
9bfd8328ca fix #14: handle wrap mode when window is narrow 2026-04-30 09:42:56 +02:00
4g4
6cd79d45df bugfix: fix coredump when resizing terminal window
In the signal handler for the signal SIGWINCH tty_term_resize, we call
tty_dpy_invalidate function. In this function, we change the screen_size
and other critical fields.

While the process is executing the function tty_dpy_flush, and another
SIGWINCH occurs, then the screen_size is changed. And tty_dpy_flush will
access invalid memory which leads to coredump.

In the signal hander of SIGWINCH, we only need to set the flag
complete_refresh.
2026-04-30 08:41:26 +02:00
4g4
7303a8b693 docfix: fix LICENCE file name in README.md
- The filename is LICENSE, not LICENCE.
- There is no BUGS file in the repo.
2026-04-28 18:25:12 +02:00
Charlie Gordon
ebd1363764 CI: disable linux-s390x target
* `linux-s390x` continuous integration target takes too much time (>10mn)
2026-04-28 18:06:49 +02:00