Commit graph

1,324 commits

Author SHA1 Message Date
Mohammed Musharaf
fb2285b2af x11 borderless fullscreen 2025-02-05 00:23:18 +01:00
Charlie Gordon
4d72f4ed05 cosmetics: remove trailing spaces, add trailing newline 2025-02-05 00:21:24 +01:00
Mohammed Musharaf
7bba7dc10c memory cleanup: x11 2025-02-04 09:19:11 +01:00
Mohammed Musharaf
2e87324590 Fix crash bug on qe_load_all_modules 2025-02-04 09:19:11 +01:00
Charlie Gordon
54248e1a29 fix crash bug on fill-paragraph 2024-12-22 00:08:01 +01:00
Charlie Gordon
ffb8aeb09e colorize yaml, c2 recipe, .gitignore, .clang-format fies 2024-12-22 00:08:01 +01:00
Charlie Gordon
e4fb8c8428
Improve language colorizers (#54)
* fix detection of javascript partial comments in diff output
* colorize python annotations
* add simplistic yaml colorizer
* colorize .gitignore files
* improve shell buffer diff output colorization
2024-12-14 23:56:54 +01:00
Charlie Gordon
13f0d3bec9
Improve C-like language colorizers (#53)
* add `CLANG_C_TYPES` flag for generic C types
* add `CLANG_C_KEYWORDS` flag for generic C keywords
* add `CLANG_T_TYPES` flag for generic `xxx_t` types
* more explicit regex testing
* support for `u`, `U` and `u64` encoding prefixes
* improve comment detection in diff output for js and c3
* change `get_c_identifier` API for consistency
* add `is_c_identifier_start()` and `is_c_identifier_part()`
* move `qe_haslower` to **util.c**
* update C2 language keyword and type lists
* improve Pike colorizer
2024-12-14 20:27:25 +01:00
Charlie Gordon
118d8f44c1
Add support for C3 language (#52) 2024-12-11 07:59:49 +01:00
Charlie Gordon
2f9dfb38ca Fix ASAN crash bug: allocate extra byte for null terminator in dbuf_str 2024-12-09 03:20:35 +01:00
Charlie Gordon
b2891d0cff show timing message to screen in qe_redisplay 2024-12-09 03:20:35 +01:00
Charlie Gordon
e0ba872d77
Improve error reporting (#50)
- rename `edit_new` as `qe_new_window`
- report error in `qe_new_buffer` and `qe_new_window` upon failure
- rename `qe_find_buffer_file` as `qe_find_buffer_filename`
- rename `read_charset` as `qe_parse_charset`
- reset yank buffer references in `eb_clear()`
- make `qe_init()` return error code and abort upon error
2024-12-08 19:43:26 +01:00
Charlie Gordon
57c46f97bc
Fix asan crash bug (#49)
- add debug info in asan, msan and ubsan builds
- avoid function call in `qe_unaccent` for ASCII chars
- fix `find_ligature` return type to detect simple ligatures with a simple test
- fix crash bug in `expand_ligature`, behavior was bogus anyway.
2024-12-05 12:04:58 +01:00
Charlie Gordon
d5200a06e6
Fix clipboard handling in Apple Terminal (#48)
- add clipboard handling method `2` using `pbcopy` and `pbpaste` on macOS
- use this method by default when running under macOS from the Apple
  Terminal. The last kill is copied to the system clipboard upon losing
  focus and the clipboard contents is retrieved and copied to a new kill
  buffer upon gaining focus.
2024-12-04 09:40:17 +01:00
Charlie Gordon
f674419e75
Fix put_status/put_error behavior (#47)
* Fix `put_status`/`put_error` behavior

- use `put_error` instead of `put_status` for command errors
- prevent status message output to console during initialization
- use `put_error` for side effects in command errors
- add `&` prefix in status messages to force screen flush
- flush screen in `qe_display()`, remove redundant calls to `dpy_flush`
- fix gcc compilation errors and warnings
- remove most references to `global_screen`
- free font cache before closing the screen
- prevent mouse handling upon focus detection

* drop CI on macos-12
2024-12-03 22:52:55 +01:00
Charlie Gordon
e3c5bfd457
Remove references to global qe_state (#45)
* Remove references to global `qe_state`

Add `QEmacsState *qs` field in context and object structures:
- `QEditScreen`, `EditState` (renamed from `qe_state`), `QuitState`
- `WinWindow` (win32.c), `X11State` (x11.c), `QEArgs` (cmd line arguments)
- `CmdLineOptionDef::func_arg()`, `QEModeData`
- move `QEKeyContext` to `QEmacsState`

Pass `QEmacsState *qs` to configuration and state functions:
- all `module_xxx_init` and static `xxx_init` functions
- `QEDisplay::dpy_init()`, `qe_register_display()`, `screen_init()̀`
- `load_input_methods()`, `unload_input_methods()`
- `register_input_method()`, `find_input_method()`
- `find_resource_file()`, `open_resource_file()`
- `qe_find_current_binding()`, `qe_list_bindings()`
- `qe_register_mode()`, `qe_find_mode()`, `qe_find_mode_filename()`
- `qe_register_cmd_line_options()`, `set_user_option()`, `set_tty_charset()`
- `qe_register_commands()`, `qe_register_bindings()`, `qe_find_cmd()`
- `qe_register_completion()`, `qe_register_variables()`
- `eb_register_data_type()`, `parse_command_line()`
- `eb_trace_bytes()`, `qe_toggle_control_h()` (split from `do_toggle_control_h()`)
- `unget_key()`, `qe_grab_keys()`, `qe_ungrab_keys()`, `qe_key_process()`
- `eb_new()`, `eb_find()`, `eb_find_new()`, `eb_scratch()`, `eb_find_file()`
- `new_shell_buffer()` `macro_add_key()`, `clear_macro(), `stop_macro()`
- `check_window()`, `check_buffer()`, `qe_kill_buffer()`, `qe_get_history()`
- `qe_register_charset()`, `find_charset()`

Add error message handlers:
- add `QEDisplay::dpy_error()` method
- add `qe_cfg_error()`, use for all expression parsing errors
- pass opaque pointer to `css_error()`
- add `qe_put_error()` and `qe_dpy_error()`

Add context argument:
- always pass a non-null window pointer to `do_refresh()`, `new_help_buffer()`

Rename functions:
- `find_resource_file` -> `qe_find_resource_file`
- `open_resource_file` -> `qe_open_resource_file`
- `input_methods_init` -> `qe_input_methods_init`
- `load_input_methods` -> `qe_load_input_methods`
- `unload_input_methods` -> `qe_unload_input_methods`
- `find_input_methods` -> `qe_find_input_methods`
- `register_input_method` -> `qe_register_input_method`
- `parse_command_line` -> `qe_parse_command_line`
- `eb_trace_bytes` -> `qe_trace_bytes`
- `eb_init` -> `qe_data_init`
- `eb_count_buffers` -> `qe_count_buffers`
- `eb_get_buffer_from_index` -> `qe_get_buffer_from_index`
- `init_all_modules` -> `qe_init_all_modules`
- `exit_all_modules` -> `qe_exit_all_modules`
- `load_all_modules` -> `qe_load_all_modules`
- `maybe_set_mark` -> `do_maybe_set_mark`
- `unget_key` -> `qe_unget_key`
- `minibuffer_init` -> `qe_minibuffer_init`
- `edit_display` -> `qe_display`
- `new_yank_buffer` -> `qe_new_yank_buffer`
- `new_shell_buffer` -> `qe_new_shell_buffer`
- `shell_find_mode` -> `qe_shell_find_mode`
- `save_selection` -> `qe_save_selection`
- `register_emulation_bindings` -> `qe_register_emulation_bindings`
- `macro_add_key` -> `qe_macro_add_key`
- `clear_macro` -> `qe_clear_macro`
- `stop_macro` -> `qe_stop_macro`
- `eb_format_message` -> `qe_format_message`
- `screen_init` -> `qe_screen_init`
- `charset_jis_init` -> `qe_charset_jis_init`
- `charset_more_init` -> `qe_charset_more_init`
- `check_window` -> `qe_check_window`
- `check_buffer` -> `qe_check_buffer`
- `eb_find_file` -> `qe_find_buffer_file`
- `eb_find` -> `qe_find_buffer_name`
- `eb_new` -> `qe_new_buffer`
- `eb_find_new` -> `qe_new_buffer` with `BC_REUSE`
- `eb_scratch` -> `qe_new_buffer` with `BC_REUSE | BC_CLEAR`
- `find_charset` -> `qe_find_charset`

Add asan, msan and ubsan targets
Fix `qe_encode64` buffer length computation.
Add `qe_new_shell_buffer` flags `SF_REUSE_BUFFER` and `SF_ERASE_BUFFER`
Bumped version to 6.3.3
fix redundant typedef
fix compilation errors
2024-12-01 23:34:00 +01:00
Charlie Gordon
d447da9ce0 Improve mouse support
Mouse:
- add `shift` state in all mouse events
- pass `QEmacsState *qs` to `qe_mouse_event`
- support non drag mouse events with `-m:2` command line option
- dragging beyond window borders generates scrolling events
  (should autorepeat, should have menu line at the top for scrolling up)
- cancel active search on mouse_goto
- do not mouse activate window if current active window is modal (popup or
  minibuf)
- handle double and triple click: select by words or lines
- handle shift click: extend selection
- add `EditState::mouse_down_offset` for initial dragging buffer offset
- pass `QEEvent *ev` to `mouse_goto()` handlers

events:
- add synthetic key events: QUIT CLOSE EXIT
- use synthetic events for GUI interaction (no longer simulate keystrokes)

tty:
- fix large OSC sequence support for terminal clipboard retrieval

Multicursor:
- use new `QECursor` for multicursor local states
- reallocate `multi_cursor` array in chunks

misc:
- add `eb_peekc(EditBuffer *b, int offset)`
- boolean cmdline options no longer require an argument, true if none provided
- int cmdline options either require an argument (CMD_LINE_INT_ARG) or take an
  optional argument, value is incremented if argument is not provided.
2024-11-10 00:44:20 +01:00
Charlie Gordon
34620b7ce8 add cljc extension for Clojure and more TODOs 2024-11-10 00:44:20 +01:00
Charlie Gordon
fcc70e87ce add C2x keywords and types 2024-11-10 00:44:20 +01:00
Charlie Gordon
4bccb6f2d9 drop capitalized bufed bindings 2024-11-10 00:44:20 +01:00
Charlie Gordon
788d537ba9 disable non-ASCII binary character display to fix alignment in screen sessions 2024-11-10 00:44:20 +01:00
Charlie Gordon
a99e3d672d fix TAB in preview mode in do_c_indent 2024-11-10 00:44:20 +01:00
Charlie Gordon
07164c95b9 redirect S-RET, S-DEL and C-RET if not bound explicitly
- remove explicit bindings for `S-DEL` and `S-RET`
- add bindings for `C-RET` in org-mode and markdown-mode
2024-10-11 09:14:16 +02:00
Charlie Gordon
ab86598e29 Automate modifyOtherKeys, mouse and clipboard support detection
- intialize `tty_mk`, `tty_mouse` and `tty_clipboard` to `-1` for automatic
- command line options force setting
- otherwise, configure support from environment variables (for now)
2024-10-11 09:14:16 +02:00
Charlie Gordon
4d5a5b001e use clipboard by default 2024-10-11 09:14:16 +02:00
Charlie Gordon
ea7665dee9 New indenting commands
- rename `indent_size` window field as `indent_width` for consistency
- handle negative argval in `do_tabulate`
- fix reverse region in `indent-rigidly`
- only indent lines that start in the region, ie: lines whose beginning
  offset >= start and < end
- fix `do_backspace` to delete a TAB worth of white space after TAB.
  no longer use `undo` for this.
- fix `find_window` to locate window according to top-left corner of current
- add `unindent-region` on `M-C-|` to unindent current region
- add `unindent-buffer`
- redirect `S-RET` and `S-DEL` to their unshifted versions
- rename `c-indent-command` command as `c-indent-line-or-region`
2024-10-11 09:14:16 +02:00
Charlie Gordon
1df2fee78d more ideas 2024-10-11 09:14:16 +02:00
Charlie Gordon
e8d132e4ba Improve mouse support
- increase window border to 3px on graphics UI
- fix mouse handling issues
- move `motion_xxx` global variables to `QEmacsState`
- remove `check_motion_target()`
- split `qe_mouse_event` into separate handlers
- keep popup windows at end of window list
2024-10-11 09:14:16 +02:00
Charlie Gordon
7739320220 fix colorize_states display in describe-window 2024-10-11 09:14:16 +02:00
Charlie Gordon
36b8eac509 fix dired invoked from an actual file: enumerate file directory 2024-10-11 09:14:16 +02:00
Charlie Gordon
217f2d50c9 Make trace flags more generic
- add `QETraceDef qe_trace_defs[]` and `qe_trace_defs_count` to enumerate
  flags and flag names
- use this for all trace commands instead of explicit tests
- add traces for mouse and clipboard events
2024-10-11 09:14:16 +02:00
Charlie Gordon
26c3d3a9b1 Improve buffer list
* sort normal, system, log and style buffers separately
* add `bufed-summary` command to display list of bufed commands
* cycle 3 filter levels with `.`: normal, system, log/style
* `bufed` requires extra `C-u` prefix to display log/style buffers
2024-10-11 09:14:16 +02:00
Charlie Gordon
ad69d01541 Add xterm clipbord support
- add `qe_encode64` and `qe_decode64` utility functions
- add command line option --clipboard to enable/disable tty clipboard support
- add `clipboard` trace option
2024-10-11 09:14:16 +02:00
Charlie Gordon
6a35bc268a Add xterm tty mouse support
- add command line option -m:X to configure mouse support
- add `mouse` trace option
2024-10-11 09:14:16 +02:00
Charlie Gordon
af1215ba24 Miscellaneous improvements
- add some missing emacs color names
- use `M-C-` prefix instead of `C-M-` in bindings, source and documentation
  but support both in `strtokey`
2024-09-25 01:02:14 +02:00
Charlie Gordon
0e90c18107 Add support for suspending qemacs
- add `suspend-qemacs` command
- add `dpy_suspend` QEDisplay method to handle suspending qemacs appropriately
- catch `SIGTSTP` and `SIGCONT` to adjust terminal state.
- add `qemacs-version` command
- bump VERSION to 6.3.2
2024-09-25 01:02:14 +02:00
Charlie Gordon
7a94d82d6c Fix some terminal encoding issues
- fix `buf_put_key()` for control keys
- add command line argument -mk=X  for xterm modifyOtherKeys setting (0,1,2)
- improve argument parsing to avoid seg fault on bogus arg spec
- report command line argument errors in popup window
- improve escape sequence handling in tty.c
- support bogus iTerm2 encoding of option/command/control key combinations
2024-09-25 01:02:14 +02:00
Charlie Gordon
9815df4c68 Fix shell buffer CSI parameter parsing 2024-09-25 01:02:14 +02:00
Charlie Gordon
e9bcc3a963 user more standard styles in Perl mode 2024-09-25 01:02:14 +02:00
Charlie Gordon
288eeb450e Improve modern terminal support
- improve ANSI tty and shell buffer escape sequence parser
- detect backspace/delete input setting from termios structure
- renumber special keys, remove redundant definitions
- handle shift state modifiers generically
- support tty `modifyOtherKeys` key encoding
- support tty `CSI u` key encoding
- simplify x11 key handling
- simplify haiku key handling (untested)
- bump VERSION to 6.3.1
- rename `insert-color` as `read-color`, insert code on `C-u C-c #`
- simplify string to key conversions
- improve CSI and OSC sequence support (ESC ] ... ^G or ST)
- `do_toggle_control_h()` should just toggle `ts->term_flags & KBS_CONTROL_H`
2024-09-25 01:02:14 +02:00
Charlie Gordon
a09f1adf9f Add missing initializers
This fixes compiler warnings for `-Wmissing-field-initializers`
2024-09-08 01:55:38 +02:00
Charlie Gordon
e566f23064 Fixed color handling
- bumped VERSION to 6.2.1
- add `css_get_color_name()` to get the name or hex spec for a color
- display style details in style completion window
- add `insert-color` command on `C-c #` to convert color names to hex strings
- fix missing intializers in `scale_cube6[]`
- improve grey/gray aliasing
- add color parser for XParseColor hex syntax rgb:rrrr/gggg/bbbb
- add `tests/reset-term-palette.sh` to reset the terminal color palette to
  default values.
2024-09-08 01:06:17 +02:00
Charlie Gordon
9f2d282aa3 Improve color handling
- document style bits in 16, 32 and 64-bit style models
- add `color_y(QEColor)` to compute the weighted light value
- publish `color_dist()`
- add `colors_init()` to initialize color support structures
- improve list of named colors:
  * use CSS color names
  * add X11 color names
  * make grey a generic synonym for gray
- improve `qe_color_map` using ramp lookup arrays
- fix `qe_unmap_color()` bug on 4K color cube
- add custom palette to store extra named user defined colors
- improve `css_lookup_color()` and `css_get_color()`
- enumerate palette entries on `p` and `#`
- improve color scripts in `tests/`
- add `tests/getpalette.sh` to dump the current terminal palette colors
- add `tests/term-palette.sh` to compare palette colors and rgb colors
2024-09-07 18:40:44 +02:00
Charlie Gordon
c828940520 make M-< and M-> apply to completion window 2024-09-07 18:40:44 +02:00
Charlie Gordon
08fc3e80e9 fix electric key ~ behavior in filename completion 2024-09-07 18:40:44 +02:00
Charlie Gordon
52da57f60c fix partial comment detection 2024-09-07 18:40:44 +02:00
Charlie Gordon
9e10de752e Improve color selection and completion
- add `set-style-color(string style, string color)` command
- display color and style samples in completion window
- display style names in `what-cursor-position` on `C-x =`
- remove duplicates in completion lists
2024-09-07 18:40:44 +02:00
Charlie Gordon
454cf61a79 use C indenter for Perl 2024-09-07 18:40:44 +02:00
Charlie Gordon
00131d44d1 fix cast and comment 2024-09-07 18:40:44 +02:00
Charlie Gordon
e6fa7527bc Fix variable name completion display 2024-09-07 18:40:44 +02:00