Commit graph

127 commits

Author SHA1 Message Date
Charlie Gordon
ee60fcd046 Improved TTY key decoding
- get_str() returns byte count
- add KEY_xxx definitions for SHIFT, CTRL and SHIFT+CTRL cursor keys
- allow KEY_META() for cursor and function keys
- add 'key' tracing option
- improve trace output readability
- add KEY_UNKNOWN for unrecognized TTY sequences
- add unknown-key command to display unknown key details
- add buf_encode_byte() to share code
- recognise M-ESC

Improve config file parsers:
- add full-version global variable for tests in config file
- no longer display configuration file errors in tqe
- recognise variable setting syntax in tqe
  handle tab-width, default-tab-width, indent-tabs-mode, indent-width

- bump VERSION to 5.3.4
2022-08-27 20:11:38 +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
4e5e42d2ea Colorize apropos window
- split eb_command_print_entry from command_print_entry
- split eb_variable_print_entry from variable_print_entry
- fix eb_sort_span to handle static styles
- match description strings in apropos
- use eb_xxx_print_entry in apropos to share code and colorization
- bumped version to 5.3.2d
2022-08-18 14:59:10 +02:00
Charlie Gordon
f7c1621ebb Improve paragraph handling
- simplify do_delete_blank_lines(), fix case of non blank line
- remove eb_start_paragraph()
- do_mark_paragraph() takes ARG_VAL, make emacs compatible
- simplify eb_prev_paragraph(), make emacs compatible
- improve fill_paragraph():
  compute actual indent size (handle TABs)
  compute actual word sizes (handle accents and double width glyphs)
- bumped version to 5.3.1j
2022-08-13 16:16:21 +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
e08de03499 updated credits and copyrights 2022-08-03 17:00:38 +02:00
Charlie Gordon
b72b1773db Fix gcc compilation
- be more careful about snprintf target arrays
- fix bug in qe_load_file(): was testing local array instead of argument
- remove unused indent variable in clang.c
- pass pointer to CSSFile in css_close()
2022-08-03 16:47:12 +02:00
Charlie Gordon
e13fcfb543 remove trailing blanks 2020-10-21 15:01:52 +00:00
Charlie Gordon
d0b9f3dad4 bumped copyrights on modified files 2020-10-17 21:09:49 +00:00
Charlie Gordon
6e0564d4ed Improve completion system
- pass CompleteState to print_entry() handler
- remove list_get_colorized_line()
- remove get_colorized_line() window handler
- add colorize_mode along with colorize_func
- add list_display_hook() to fix list mode navigation
- rename generic_get_colorized_line() as get_colorized_line()
- fix memory leak in eb_add_property()
- pretty print tags in tag_complete() and list_tags()
2020-10-17 20:55:47 +00:00
Charlie Gordon
9d967ad29c Improve completion system
- rename and extend CompletionEntry as CompletionDef
- create xxx_completion CompletionDef structures
- rename xxx_completion() functions to xxx_complete()
- register CompletionDef structs with qe_register_completion()
- add (start, end) range in CompleteState
- use eb_puts() and eb_putc() instead of eb_printf()
- simplify eb_delete_chars()
- ignore left pane in compare-windows()
- simplify qe_list_bindings()
- improve command and variable completion popup
2020-10-17 15:41:31 +00:00
Charlie Gordon
128d0c28dd build: use CONFIG_MMAP when unmapping buffer data in eb_clear() (F.Revol) 2017-05-07 06:08:57 +00:00
Charlie Gordon
d329669530 buffer: new APIs
- int eb_insert_uchars(EditBuffer *b, int offset, int c, int n);
- int eb_replace_uchar(EditBuffer *b, int offset, int c);
- inline eb_insert_spaces() using eb_insert_uchars() instead
- add minp(), maxp() and clampp() with side effect on first argument
- publish ucs2 and ucs4 charsets
2017-04-25 16:46:41 +00:00
Charlie Gordon
eacb2ad6e0 shell: major improvements in tty emulator
terminal emulator:
- add EditState.cols and EditState.rows: window dimensions in characters
- pass target window to new_shell_buffer()
- use window size for shell terminal emulator initial screen size
- set COLUMNS and LINES environment variables for child processes
- factorize emulator character output
- increase number of CSI arguments
- simplify and improve CSI m argument processing including
  multiple argument sequences
- minimal support for `:` as argument separator eg:
  \033[38;5;128:128:128m
- support erase line vt100 command:
  \033[K, \033[0K erase end of line
  \033[1K         erase beginning of line
  \033[2K         erase complete line
debugging:
- pass string argument to set-trace: on, off or list of trace indicators
- remove doctor command
- add QE_TRACE_EMULATE for emulator trace messages
- fix incorrect uses of eb_delete()
2017-04-21 14:44:14 +00:00
Charlie Gordon
e71273f3af syntax: improve tag display
- increase identifier buffer lengths
- fix some bugs in buffer property handling
2017-04-17 09:16:24 +00:00
Charlie Gordon
84547c6209 build: fix compile time warning
- fix some warnings on unused variables and variables potentially
  used before set
- force definition of va_copy() and atomic_get_and_set() for haiku
2017-04-15 09:39:02 +00:00
Charlie Gordon
b39607410e fixed compilation warnings 2017-04-14 06:59:17 +00:00
Charlie Gordon
6c595c1f2c colors: extend color system
- add 8K color modes and 64-bit QETermStyle values
- add 64-bit buffer style support
- reduce colored character system used in syntax handlers to 8-bit style
  and 24-bit code point
- use QETermStyle type instead of int wherever a composite style is used
- force color system used by the terminal with environment variables:
  USE_16_COLORS=1, USE_256_COLORS=1 or USE_TRUE_COLORS=1
2017-04-12 07:33:20 +00:00
Charlie Gordon
799b1489bc display: full support for 256 color virtual terminal
- add various utilities for color escape sequence testing:
  tests/16colors.pl
  tests/256colors2.pl
  tests/color-spaces.pl
  tests/truecolors.sh
  tests/xterm-colortest.sh
  tests/xterm-colour-chart.py
- use colored code-points only for syntax highlighting
- use QETermStyle and QEStyleDef internally
- convert to TTYChar attributes only for text terminal output.
- remove most CHAR_MASK and STYLE_SHIFT handling
- pass QETermStyle array to get_colorized_line mode handlers
- pass QETermStyle array to isearch_colorize_matches
- remove combine_static_colorized_line
- move color matching functions to util.c
- rename get_tty_color as qe_map_color
- improve local variable naming consistency:
  DisplayState *ds, QEStyleDef *stp, QEStyleDef styledef.
2017-04-03 08:33:57 +00:00
Charlie Gordon
35d2610146 clang: add primitive tag support
- add buffer properties with offset tracking
- use buffer properties for type, macro, function and object definitions.
- display current function or type name on mode line
- add list-tags command to show the tags detected for the current buffer
- add goto-tag on C-X , and M-F1 to jump to the definition of the current word
- add find-tag on C-X . to search for a given tag with completion
2017-03-31 07:51:56 +00:00
Charlie Gordon
d06fdbfd14 basic: changed API for popup windows
- pass current window to show_popup()
- remove show_ptr argument from new_help_buffer()
- call show_popup() unconditionally
- add int eb_vprintf(EditBuffer *b, const char *fmt, va_list ap);
2017-03-26 15:57:24 +00:00
Charlie Gordon
c5a3bb8ecb updated heading 2017-03-25 18:14:59 +00:00
Charlie Gordon
6a7ac743a4 shell: fix crash on large process output
- fix `eb_fgets()`: used to return out of bound length.
2017-01-03 04:55:24 +00:00
Charlie Gordon
79bf90c8d6 basic: simplifications
- remove `eb_nextc_style()`
- `eb_nextc()` does not modify `b->cur_style`
- add `eb_get_style()` to retrieve style for given offset in full-style buffers
- add `eb_next()` and `eb_prev()` to skip chars
- pass `offset` to `eb_get_line()` and `generic_get_colorized_line()`...
- use `eb_skip_chars()` in `do_delete_char()` and `text_write_char()`
- replaced `eb_get_strline()` with `eb_fgets()` with similar semantics
  except return value is number of bytes before the newline or end of line
- no longer pass end offset to `isearch_colorize_matches()`
- just pass number of code points to `combine_static_colorized_line()`
- no longer call `isearch_colorize_matches` from `generic_get_colorized_line`
2016-12-23 19:51:48 +00:00
Charlie Gordon
71ab83a208 display: optimize low level buffer content read functions
- remove style handling from eb_nextc()
- add eb_nextc_style()
2016-12-13 17:20:51 +00:00
Charlie Gordon
31f4362ce2 shell: improve shell editing, yank kill buffer at shell prompt
- add mode specific `delete_bytes()` method
- reorder `write_char()` and `mouse_goto()` mode methods
- pass `keep` argument to `do_kill()`
- pass `argval` to `do_kill_line()`
- add `do_kill_beginning_of_line()` command
- allow kill commands in read-only buffers, copies contents to kill-ring and
  moves point.
- change `do_kill_line()` semantics when invoked with numeric argument
- add `cur_prompt` and `last_char` in ShellState to track start of
  shell input line
- C-a moves to start of shell input, exits interactive mode if there already
- force interactive mode on shell-end-of-line and shell-end-of-buffer
- simplify shell_write_char(), remove hard coded dispatcher
- add `shell_delete_bytes()` to delete contents in shell input line
- change shell-kill-word and shell-kill-line to not rely on mode specific
  cursor movement commands because of asynchronous behavior.  This is also
  a problem for macros
- make shell-yank insert data via shell input.
- pause for 1ms after each CR sent to the process
2016-06-07 08:56:39 +00:00
Charlie Gordon
b962e33ade updated copyrights 2016-03-06 19:53:06 +00:00
Charlie Gordon
bb96ec15af shell: fixed colors for libcaca output
- increase number of ANSI escape arguments to 6
- added debug traces for unhandled escape sequences
- wrap traces before 80 columns in *trace* buffer
2016-03-06 17:42:26 +00:00
Charlie Gordon
1f5a77a784 portability: stop defining symbols starting with __ 2015-09-16 22:18:22 +00:00
Charlie Gordon
9b433ae687 sessions: implement session saving/restoring
- add qe_save_variables(s, b)
- add use_session_file global variable
- add VarDef::modified flag to detect customized variables
- set modified flag upon variable modifications
- dired: set modified flag when changing in dired variables
- fix BUG in qe_register_variables, did not set set_value handler
  on last VarDef element
- make qe_save_variables() public
- remove do_save_variables(), move save_session() to parser.c
- add eb_puts() and eb_putc() for consistency
- add WF_HIDDEN window flag to temporarily flag windows to be deleted
- add do_hide_window(), do_delete_all_windows() and do_delete_hidden_windows()
- add qe_save_window_layout() to save window layout to session file
- add do_create_window(s, filename, layout) to restore window layout
- add qe_save_macros() to save keyboard macros to session file
- detect keyboard macro redefinitions and avoid duplicates
- add qe_save_open_files() to save list of open files and directories
- pass `all` flag to do_delete_other_windows() to force complete deletion
- add qe_load_session() and do_save_session():
  * qe_load_session() is invoked before parsing the command line if
    use_session_file is set, via the config file or command line option (-s)
  * do_save_session() is invoked just before closing qemacs.  It can also
    be invoked as a command and shows a popup window with the contents of
    the session file produced instead of saving it.
- fix CRASH BUG in command definitions, missing argument specifier caused
  spurious crashes when invoking commands from script files. This affected:
  find-file(), find-file-other-window(), find-alternate-file(), kill-buffer()
  load-file-from-path().
- insert newly created windows in list in top-down left-right order
- update WF_RSEPARATOR flag upon deletion of vertically split window
2015-09-10 00:25:23 +00:00
Charlie Gordon
f0aa3a4bd8 cosmetics: untabify, remove trailing spaces 2015-08-27 23:03:39 +00:00
Charlie Gordon
581eef3b5d buffers: fix improbable bugs
- make kill buffers system buffers (not displayed in buffer-list)
- only create *scratch* buffer in qe_kill_buffer() if needed
- prevent crash if killing style, log or kill buffers
- display \n as ^J in minibuf
2015-08-27 22:51:56 +00:00
Charlie Gordon
060f860756 fix more linux compilation warnings 2015-08-27 18:59:56 +00:00
Charlie Gordon
9ab179d048 fix linux compile warnings 2015-08-27 18:52:30 +00:00
Charlie Gordon
9331372a54 modes: upgrade mode selection and handling
- separate buffer and window specific mode data management, new API:
   QEModeData *qe_create_buffer_mode_data(EditBuffer *b, ModeDef *m);
   void *qe_get_buffer_mode_data(EditBuffer *b, ModeDef *m, EditState *e);
   QEModeData *qe_create_window_mode_data(EditState *s, ModeDef *m);
   void *qe_get_window_mode_data(EditState *e, ModeDef *m, int status);
   int qe_free_mode_data(QEModeData *md);
- make a list of buffer specific mode data areas so multiple major modes
  can co-exist in different windows for the same buffer
- add mode.mode_free callback to release buffer specific resources
- remove buffer.close callback
- shell state is now buffer specific shell_mode data
- clean up compress and archive mode
- show more buffer modes in buffer-list
- simplify edit_set_mode(), display error message on failure
2015-08-27 15:31:59 +00:00
Charlie Gordon
f408a15503 buffers: misc improvements
- renamed kill_buffer_noconfirm(b) to qe_kill_buffer(b)
- pass extra argument to do_kill_buffer(b, force)
- add buffer name cache to quicken eb_find()
- always make buffer names unique with simpler naming scheme
- small improvement in new_yank_buffer()
2015-08-26 00:53:23 +00:00
Charlie Gordon
bc874d74b7 buffers: improved tracing function
- add EB_TRACE_COMMAND
- change the format of the *trace* buffer
2015-08-26 00:24:14 +00:00
Charlie Gordon
9014b3de79 buffers: clean up, add data_type_name
- rename raw_buffer_load1() to eb_raw_buffer_load1()
- rename log_reset() to eb_free_log_buffer()
- add buffer.data_type_name to display proper handler on modeline
2015-08-25 16:19:42 +00:00
Charlie Gordon
7b996ac907 buffers: changed find_page() low-level routine
- pass offset separately from page_offset return value.
  This will ease the change of int type to support huge files in 64 bits.
- use the page cache also for offsets beyond the page cache.
2015-08-24 12:59:25 +00:00
Charlie Gordon
315147c81f buffers: fixed crash bug and pathological memory fragmentation
- simplify eb_insert_low_level() and eb_insert_buffer() to avoid
  pathological cases of kill/yank sequences loading to catastrophic
  fragmentation. eg: kill a 1 byte region and yank it 1000 times
- mmapped pages are (temporarily) no longer shared between buffers
2015-08-22 20:49:01 +00:00
Charlie Gordon
bccfbef8a0 window handling, bufed/dired: fixed bugs, simplified code
- make show_popup(b) return the window
- pass an extra window argument to find_window() as a default return value
- add check_buffer(EditBuffer **sp) to validate a buffer pointer
- changed eb_find_window(): find a different window attached to a given buffer
- removed edit_find(), use eb_find_window() instead
- change edit_attach():
  take window before which to move arg window, use NULL to append at the end.
  If qs->active_window is NULL, set it to the first window
- add buffer flags BF_IS_LOG and BF_IS_STYLE
- create style buffers with a meaningful name
- create log buffers with a meaningful name
- add window flag WF_POPLEFT for dired interactive buffers
- no longer create process buffer and find files in dired pop left pane
- remember last buffer upon switch_to_buffer for predict_switch_to_buffer()
- rename do_file1() as extern qe_load_file() and make it return success status
- prevent do_find_file_other_window() from splitting window if too shallow
- fix window fusion algorithm when deleting left pane with split right pane
- prevent delete-other-windows() from minibuf and poups
- use mode structure as signature for bufed-mode, shell-mode
- make list-buffers open an interactive popup window
- toggle full buffer list with '.'
2015-08-19 19:20:57 +00:00
Charlie Gordon
1033a348d8 search: another 35% speed improvement on large files
- improve utf8 handling in eb_prevc() using eb_read_one_byte()
- added utf8_is_trailing_byte(b) to standardize testing for this
- improve hex searching by 50% using eb_read_one_byte()
- improve regular searching by 35% by removing extra calls to eb_nextc()
2015-08-16 23:15:01 +00:00
Charlie Gordon
e80cb5a149 search: another 2.5x speed improvement on large files
- simplify eb_read() and eb_write() primitives
- make eb_write() return number of bytes actually written
- add eb_read_byte(buffer, offset) to read a single byte
- simplify eb_nextc() accordingly
2015-08-16 19:22:01 +00:00
Charlie Gordon
5af9d29a2e searching: many improvements
- clean search and replace code
- fix point position upon matches in forward and backward directions
- prevent reverse search from find overlapping matches
- hilite current match
- add style search-match to hilite the current match in incremental-search
  defaults to cyan / magenta
- C-l centers the window
- C-q quotes next character in incremental search
- C-w grabs the word at point
- C-y grabs from point to next end of line
- A-b cycles unihex hex and normal search
- A-w toggles word matching
- A-y yanks last kill in search string
- add same control keys to query-replace command
- fix searching and replacing in hex and unihex modes
- wrap search after failure
- pass search data as u32 buffer
- add eb_insert_u32_buf(b, offset, buf, len) to insert unicode code points
- add window.offset_end -> offset of first char beyond the window
- add qestate.emulation_flags to select between standard emacs behaviour and
  alternate behaviours in internal commands
- fix do_center_cursor() when point is before window start
- add do_center_cursor_maybe() to center window if point is not visible
- allow C-q to quote DEL key (ASCII 127)
2015-08-15 13:08:41 +00:00
Charlie Gordon
2b5d26028e fixed cr lf translation for older mac files
* when MAC_EOL end of line is used, \n and \r are swapped for internal
  EOL handling and restored, but restored for display in hex and
  what-cursor-position buffer contents display.
2015-06-08 06:54:56 +00:00
Charlie Gordon
ebc8f89a82 prevent strict warnings 2014-05-27 22:59:48 +00:00
Charlie Gordon
061b18655c clean up header, rename some fields 2014-05-26 14:35:37 +00:00
Charlie Gordon
f9f5ef791a fixed bugs in memory mapped buffers
* unmap file upon buffer clear
* fix bug that caused file to be mmapped AND loaded (!)
2014-05-18 11:01:55 +00:00
Charlie Gordon
90971b9861 improve c-mode
* add indent_func method in ModeDef
* make c-indent-region more general as indent-region
* add c-forward-conditional on M-]
* add c-backward-conditional on M-[
* add c-list-conditionals on M-i
* use trick to disambiguate M-[ and CSI sequences
* add eb_is_in_indentation(b, offset)
* fix c-mode indentation of case and default lines
2014-03-23 01:11:34 +00:00
Charlie Gordon
0e9fbc96a1 add tabify / untabify support
* add tabify-buffer and tabify-region
* add untabify-buffer and untabify-region
* make eb_delete and eb_delete_range return actual number of bytes removed
* simplify some deletions with better use of eb_delete_xxx functions
2014-03-21 20:49:30 +00:00