Commit graph

478 commits

Author SHA1 Message Date
Charlie Gordon
6fb16e1cc2 Simplify and improve qe_check_buffer_file
* pass `QEmacsState` to key grab functions
* clear `grab_key_opaque` when freeing windows, buffers, mode_data
* add checks on window and buffer pointers in key grab functions
* this should fix a crash bug when deleting unsynched buffers from bufed
* fix `reload_buffer` to update buffer `file_size` and `mtime` fields
* check buffer file before invoking commands that modify the buffer
* check buffer file after command that changes the current window
  or the current window's buffer
2026-06-24 00:44:18 +02:00
huwwa
807339b3c8 Popups: fix stacking order of subsequent popups
* keep new popups on top by correcting boundaries when `next` is NULL
2026-06-23 08:53:39 +02:00
Charlie Gordon
863ae1736d split-window: fix window ordering in emacs emulation 2026-06-22 00:44:33 +02:00
Charlie Gordon
77a60060a4 split-window: improve split window logic
* add `split-window-left`, `split-window-right`, `split-window-above`
  and `split-window-below` to specify how to split window portably.
* improve split-window proportion handling, avoid tiny windows
* reduce minimum window size to 4x1 characters + modeline and borders
2026-06-21 23:30:37 +02:00
Charlie Gordon
be75d12772 Bindings: improve key binding handling
* fix dictionary sort to no longer ignore digits
* sort bindings in natural order
* improve `wall-chart` command: show overridden bindings with style
* add `describe-prefix-bindings` for a list of bindings with a common prefix
* add `describe-C-h`, `describe-C-c`, `describe-C-x`...
2026-06-20 11:06:11 +02:00
Charlie Gordon
227c3dc5e8 Help: improve describe-xxx functions and help popups
* rename and pass flags to byte quoting functions:
  `byte_quote` -> `strquote_byte`
* add `eb_print_style` to output data to a buffer in a given style
* add `eb_print_field` to output a field name and value using styles
* use styles in describe commands
* improve byte stats and page layout output in `describe-buffer`
* add `wall-chart` command (sorted list of bindings)
* add `describe-help` command
2026-06-18 23:30:17 +02:00
Charlie Gordon
b1613a8754 Display: fix popup display bug on bufed 2026-06-17 20:44:26 +02:00
huwwa
9f598197c7 Fix windows invalidation bug 2026-06-16 14:52:21 +02:00
Charlie Gordon
f61b6454ec Popups: fix display hacks
* force periodic redisplay for shell buffers even with active popups
* fix redisplay of overlapping popups
* fix stacked popup position and size
2026-06-16 12:17:43 +02:00
Charlie Gordon
18755e7e09 Popup handling: add generic approach to disable commands
* add `#` at the beginning of the comand argument description
  to disable command when current window is a popup or the minibuf
* update command definitions
2026-06-14 23:30:50 +02:00
Charlie Gordon
09fccc8508 Allow stacked popup windows
* `show-popup` now always allows popup windows. It is shown on top of an
  existing one and shifted down and right.
* fix redisplay in `do_popup_exit()`
2026-06-14 23:07:57 +02:00
Charlie Gordon
b56a8b9b44 buffer-navigation: simplify command dispatch
* use `p` and `q` to dispatch signed command argument
2026-06-14 22:31:17 +02:00
Charlie Gordon
abdf6a70c7 X11 display: fix frame redraw bug
* draw popup frames completely
* make frame borders 4 pixels thick by default
2026-06-14 01:35:15 +02:00
Charlie Gordon
0cb68d2d74 Shell: improve current directory traking
* parse process output for shell prompts with current directory
* parse `make -w -C` output for temporary subdirectory excursions
* handle property type and flags separately
* add `QE_PROP_MARK` to prevent offset update at range boundary
* use `QE_PROP_DUP` to optimize buffer properties with single allocation
* use mask in `eb_delete_properties` to delete tags selectively
* fix `eb_find_property` range glitch
* fix offset tracking for CWD properties
* simplify default directory selection for shell commands
* fix compiler warnings on variable shadow definitions
* optimize `next_error()`: no lookback needed anymore
* display buffer properties in `describe-buffer`
* update TODO.md
2026-06-13 18:12:57 +02:00
huwwa
f8a0b51d20 shell: improve current directory handling
* track the shell's current working directory using OSC 7.
* add `QE_PROP_CWD` buffer property, associate it with shell's cwd.
2026-06-12 15:41:07 +02:00
Charlie Gordon
a0c8560e1e Fix previous-buffer cycling
* fix modulo arithmetics for negative values
* no special case of single buffer
2026-06-10 04:25:13 -04:00
Charlie Gordon
77e57d11c7 Colorization: improve colorization of diff and process output
* improve color combining code for diff/patch output: preserve code
  syntax coloring on red or green background.
* improve `curline_style` handling (needs more work)
* add `QETermStyle` transparent color handling in `apply_style`
* highlight trailing blanks in a single place
* transpose `qe_term_get_style()` arguments for consistency
* add `qe_term_style_string()` and `qe_styledef_string()`
* extend style string parser to accept missing foreground color
2026-06-09 14:19:28 -04:00
huwwa
ce4ac13d48 Invalidate diag message on refresh and erase it on input 2026-06-07 13:48:53 +02:00
huwwa
ee2a886348 buffer/file fix some bugs
* fix crash bug on `C-X C-B C-X C-F xxx RET`.
* add check for `S_ISREG` as file name might contain a directory
  (e.g. *dired* buffer when starting qe with a directory), which
  caused a bug whenever that directory was modified asynchronously.
* increment pos after insertion.
2026-06-07 13:46:21 +02:00
Charlie Gordon
699bdff915 Simplify mode probing
* add `filenames` specification in `ModeDef` structures
* generic mode probing can match a list of filenames
* remove unneeded mode_probe functions
* this enables diff coloring on Makefile
2026-06-05 18:42:56 -04:00
Charlie Gordon
3da74c964b Buffer/file: add diff-buffer-file
* add command to compare buffer with its file in a popup
* add [d] for diff when prompting for buffer/file synching
* add default behavior for buffer/file synching
* add CONFIG_LINUX, CONFIG_FREEBSD, CONFIG_OPENBSD, CONFIG_NETBSD
* add diff styles
2026-06-04 15:08:24 +02:00
Charlie Gordon
eff66d1e8c Buffer/File: check for file changes
* keep track of original file size and time in buffer data
* check for file changes upon window change, buffer modification and save
* prompt for reloading buffer contents and other options
2026-06-04 15:08:24 +02:00
Charlie Gordon
7e2e2b5e7f improve colors and styles
* improve curline_style handling
* add completion for variable values
2026-06-04 13:21:46 +02:00
Charlie Gordon
897b7555d2 bufed: improve sorting method
* keep track of buffer creation, modification and access times
* add buffer sorting methods (buffer times, pathname, basename)
* always sort systems buffers last in alpha order
* small touch up in modeline
2026-05-23 22:34:28 +02:00
huwwa
832662b4a5 popup: prevent accidental window closure on keyboard-quit 2026-05-21 09:47:46 +02:00
huwwa
71963ca4c2 input: add select-input-method command 2026-05-20 20:35:56 +02:00
huwwa
34417ea5dc fix cursor on partial compose matches
Unconditional window offset increments caused incorrect increments
during partial matches.
2026-05-19 08:22:28 +02:00
Charlie Gordon
e89e07e318 bufed/dired: fix layout for non printing characters
* add `eb_put_filename()` to encode buffer or file names with
  non-ASCII characters according to PF_xxx flags
* add `CF_SAVE_LIST` flag for completions to store the list
  of matches in `MinibufState`
* fix bufed and dired layout issues
* fix buffer and filename completion popup layout
* add commands to control display of Unicode and non printing
  charcaters in buffer or file names:
  - U toggles unicode display
  - \ cycles through 4 possible encodings: ? ^J \x10 \010
* use `(*fp)()` syntax for indirect function calls
2026-05-18 12:31:06 +02:00
Charlie Gordon
d6b37ca511 Sundries: bug fixes
* fix crash bug on `delete_equivalent()`: qe_free takes a double pointer
* remove unused ShellState variables
* initialize term structures
2026-05-18 01:15:21 +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
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
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
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
Charlie Gordon
b3355d3224 fix compilation warning 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
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
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
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
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
popflag
9bfd8328ca fix #14: handle wrap mode when window is narrow 2026-04-30 09:42:56 +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
58174a7247 use FALLTHROUGH instead of fallthrough to avoid clash with x11 2026-03-14 21:55:25 +01:00
Charlie Gordon
93fe952ab8 fix clang 17 compilation warnings 2026-03-14 21:33:53 +01:00
Charlie Gordon
70260726f6 Improve colorization for c2 and c3
* support multiline raw c2 strings
* update c3 keyword list
* retire macos-13 CI tests
2026-01-12 20:55:22 +01:00