Commit graph

94 commits

Author SHA1 Message Date
Charlie Gordon
fcf9136fdb Improve naming consistency
- rename qe_skip_spaces() as eb_skip_spaces() and take EditBuffer
- rename skip_spaces() as qe_skip_spaces()
- use qe_skip_spaces() return value to simplify loops
2020-11-25 18:55:15 +01:00
Charlie Gordon
c5e4d9d3dc Improve file completion, sundries
- fix bogus test for . and .. in find_file_next()
- use strequal() instead of !strcmp()
- add some emacs-lisp defined symbols
- fixed awk mode for `#` comments
2020-11-14 09:57:48 +01:00
Charlie Gordon
120380987c Improve file completion
- add flags to find_file_open():
  - FF_PATH:    enumerate path argument
  - FF_NODIR:   only match regular files
  - FF_NOXXDIR: do not match . or ..
  - FF_ONLYDIR: do not match non directories
  - 0..15:      max recursion depth
- add recursion level in find_file_next()
- add completion pointer in CompleteState
- add CF_DIRNAME and CF_RESOURCE CompletionDef flags
- pass filename to load_ligatures() and load_input_methods()
- remove find_resource_file() dummy definition in html2png.c
- add dir and resource completion methods
- allow makepath() to modify path in place
- enable completion in `load-resource-file` and `load-file-from-path`
2020-11-12 00:21:50 +01:00
Charlie Gordon
a3fac89268 Add standard bindings, improve consistency
- `C-g` invokes keyboard-quit
- bind `ESC ESC ESC` to keyboard-quit
- prevent ESC key combination in `combine_keys()` if not first
- rename `abort` as `keyboard-quit` and do_break() as do_keyboard_quit()
- rename do_combine_char() as do_combine_accent()
- rename do_word_right() as do_word_left_right()
- pass numeric argument to do_scroll_left_right()
- pass numeric argument to do_minibuffer_history()
2020-11-08 00:47:24 +01: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
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
49a1c1275b style and color fixes:
- document default styles
- skip_blanks() returns the next character
- simplify minimal parser
- handle multiline comments in config files
2020-10-09 00:00:55 +00:00
Charlie Gordon
785bb524ab fix off by one bug, missing * 2020-10-02 20:06:02 +00:00
Charlie Gordon
de1ce1f3f9 Small fixes
- add qe_digit_value(): returns arithmetic value of character
- single test in qe_inrange()
- simplify qe_isxdigit() and use qe_isxdigit_()
- remove to_hex()
- hex.c: use qe_digit_value() instead of to_hex()
- update TODO.org, README
- bump VERSION to 5.2alpha
2019-03-27 07:43:56 +00:00
Charlie Gordon
fc85c4f8e6 colorizers: some factorisation
- pass initial character to `ustr_get_identifier` and `ustr_get_word`.
- add lowercasing variant `ustr_get_identifier_lc()`
- remove `get_word_lc()` in makemode.c
- remove `get_js_identifier()` in clang.c
2017-05-29 06:21:42 +00:00
Charlie Gordon
efa89670be basic: add syntax colorizer for Falcon
- add generic word converter for syntax parsers:

  // handle qe_isalnum_
  int ustr_get_identifier(char *buf, int buf_size,
                          const unsigned int *str, int i, int n)

  // handle qe_isword
  int ustr_get_word(char *buf, int buf_size,
                    const unsigned int *str, int i, int n)
- simplify Magpie syntax colorizer
- handle nested block comments and char constants in Magpie
- add Falcon syntax colorizer
2017-05-21 07:57:19 +00:00
Charlie Gordon
abe81df0b2 basic: move some global variables
- move up_down_last_x to an EditState member
- make single_window static in qe.c
- move user_option to the QEmacsState structure
- move minibuffer and completion state to a MinibufState structure
- remove static state in do_minibuffer_exit
- add key name: LB for `{`, RB for `}` and VB for `|`
2017-04-16 17:31:14 +00:00
Charlie Gordon
3dccd7f696 basic: improve command line parsing
- add qe_strtobool(str, def). Returns boolean value from str:
  y yes t true 1 evaluate to true
  any other string evaluates to false
  the empty string evaluates to def
- add bstr_t type:
  constant bounded string with pointer and length.
  bstr_make creates a bstr_t from a string pointer or NULL
  bstr_token creates a bstr_t from a string upto a separator
  bstr_get_nth creates a bstr_t from a the nth element of a string list
  bstr_equal compares bstr_t objects for equality
- use macros for type safe registation of command line options
- combine short, long, argument names and help string
- support command line options with optional arguments
2017-04-16 17:20:49 +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
5d463eb5ad styles: improve consistency
- rename font styles QE_STYLE_xxx to QE_FONT_STYLE_xxx
- rename font family QE_FAMILY_xxx to QE_FONT_FAMILY_xxx
- improve tests/16colors.pl: display bold italics combination
- improve tests/color-spaces.pl: compare true color and palette dumps
- add colortest target in Makefile to produce various color patterns
2017-04-11 06:46:13 +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
a449fe3c23 simplified to_hex() 2017-03-25 18:07:18 +00:00
Charlie Gordon
5e8c4b023d shell: colorize file fragments from compilation and grep
- add `offset` member in `QEColorizeContext` structure
- add `ModeDef *qe_find_mode_filename(const char *filename, int flags);`
- make `combine_static_colorized_line` public
- add public function `shell_colorize_line`:
  detect file fragments with filename followed by `:` without space at bol
  special case clang errors that display the file contents after the line
- special case `shell_colorize_line` for static color combination scheme
2017-01-01 15:40:46 +00:00
Charlie Gordon
be9f03731e basic: use our own version of qsort_r
- add `qe_qsort_r()` because some platforms do not provide `qsort_r()`
  it uses a median of 3 pivot selection and falls back to insert sort
  for small chunks.
- use `qe_qsort_r()` in dired, remove `state` field in `DirEntry`
- use `qe_qsort_r()` in sort-buffer commands
- make buffer sorting algorithm stable
2016-12-25 10:51:14 +00:00
Charlie Gordon
02222297bd simplified buf_write() and buf_putc_utf8() 2016-12-23 09:47:11 +00:00
Charlie Gordon
a4247a878f dired: improve current directory support
- pass EditPane to canonicalize_absolute_path() to make current directory
  context based.
- use shell buffer context based directory for next-error.  Should actually
  use more context such as current position to compute current directory.
- move canonicalize_absolute_path() and is_abs_path() from util.c to qe.c
2016-06-26 08:35:25 +00:00
Charlie Gordon
8bd15ce4aa dired: support file patterns, improve current directory support
- add `is_filepattern` utility function to check for wildcards
- add `get_default_path` public function to retrieve the context specific
  current directory associated with a window.
- explore directories and file patterns in dired window
- compare-files determines parent file from current directory
- accept file patterns for dired listing
2016-06-13 17:12:35 +00:00
Charlie Gordon
f0aa3a4bd8 cosmetics: untabify, remove trailing spaces 2015-08-27 23:03:39 +00:00
Charlie Gordon
a66cf5a68e minibuffer completion: add fuzzy matching
- add extra group argument in functions add_string() and set_string()
- group matches in completion_sort_func()
- add const char *strmem(const char *str, const void *mem, int size);
- add variable fuzzy-search
- add minibuffer-insert command to handle insert triggers
- display variable status after set-variable
- make TAB a regular char in incremental search
- display control chars as ^x in incremental search prompt
2015-08-11 17:45:30 +00:00
Charlie Gordon
671f634161 changed ustrstart() and ustristart() API
* take an `int *` for the match size instead of a `const unsigned int **`
2015-06-19 14:23:55 +00:00
Charlie Gordon
031bfed715 add match_shell_handler function and mode field
* add function match_shell_handler to probe shell #! dispatcher line
* add mode field shell_handlers for generic syntax probe function
* add memfind to find keywords from buf+length
* add shell handlers for ruby, perl and python flavors, lua, haskell, ocaml
* remove perl_mode_probe
* add C++ keywords, include namespace in identifiers
* add cpp_mode_probe to detect C++ header files
* add shell handler for tcc scripts
* remove calc_mode_probe
* modify scoring between shell-script-mode and simpler sharp-mode
2014-06-08 10:56:58 +00:00
Charlie Gordon
e1454348dc allow NULL table in strfind 2014-06-01 18:02:31 +00:00
Charlie Gordon
ebc8f89a82 prevent strict warnings 2014-05-27 22:59:48 +00:00
Charlie Gordon
db53f26499 fix archive and filtering commands
* fix reduce_filename for 7z archives and man pages
* add more man page extensions
* add more nroff head tests
2014-04-25 20:08:17 +00:00
Charlie Gordon
853bf51f24 add qe_stristr utility function 2014-03-24 09:38:15 +00:00
Charlie Gordon
0b998403c3 add haskell-mode
* detect haskell files on extension: *.hs
* fix small things
* add qe_findchar(str, c) to search code point in ascii string
2014-03-07 10:25:59 +00:00
Charlie Gordon
6402058e14 ignore case when matching extensions.
* ignore case in match_extension() used for mode selection
2014-02-07 07:38:30 +00:00
Charlie Gordon
c5f56a0d5b Fix memory leaks and bad references detected by valgrind
* add free_font_cache()
* add css_free_colors()
* add unload_ligatures()
* add --free-all cmd line option to free memory upon exit for valgrind
* tty.c: fix off by 3 size in qe_realloc. Should be typed
* qe.c: fix invalid pointer reference upon destroying transient buffer
2014-01-24 00:46:26 +00:00
Charlie Gordon
e967914b5a improve consistency in new/delete methodology
* use qe_mallocz for all structures
* prevent spurious uses of malloc/free/realloc
* pass pointers to pointers to all deletion functions
* use consistent patterns for list deletions
* add more dependencies in Makefiles
2014-01-23 12:56:22 +00:00
Charlie Gordon
890af446cf simplify colorize_line functions: always pass NUL terminated line
* added ustrstart, ustrstr and ustristr utility functions
* simplified org_mode_colorize
2014-01-20 18:04:00 +00:00
Charlie Gordon
2f98140860 add buf_put_key, buf_put_keys, use buf_t more consistently
* changed keytostr to buf_put_key using buf_t structure
* changed keys_to_str tp buf_put_keys using buf_t structure
* add buf_attach to initialize buf_t with non empty buffer
* simplify qe_list_bindings with inherit argument
2014-01-16 14:24:03 +00:00
Charlie Gordon
ccbf2991cf allow NULL extlist in match_extension 2014-01-02 10:12:59 +00:00
Charlie Gordon
67ecab27b5 changed match_extension utility function
* allow multiple extensions eg: |tar.gz|
2013-12-23 23:39:02 +00:00
Charlie Gordon
c1833a2f53 added make_user_path to compute path relative to user HOME directory 2013-12-03 17:35:06 +00:00
Charlie Gordon
9a684a9c25 patch for OS/X to expand user home dir to /Users/xxx instead of /home/xxx
this is a poor solution, should use a more generic method.
2013-11-28 15:52:38 +00:00
Charlie Gordon
23cd92e91c fixed find-charset to use strxfind, implement strxfind correctly 2008-05-04 15:54:39 +00:00
Charlie Gordon
b82a15d4e4 added extra help functions:
added command apropos(string)
added command show-bindings(cmd_name)
moved describe-bindings to extras.c
added qe_get_prototype(CmdDef *d, char *buf, int size);
added an extra argument to qe_get_variable() to produce value as source
fixed typo on window variable window-height
fixed type mismatch on mode variable mode-name
added var_domain string array
added strquote conversion function with simplistic implementation
added history tags for all commands
2008-04-29 18:55:14 +00:00
Charlie Gordon
7bde58c799 renamed qe_collate -> qe_strcollate, cosmetics 2008-04-22 08:15:04 +00:00
Charlie Gordon
a454cbc152 moved get_basename, get_extension, and get_dirname to cutils.h/c
added wrappers for get_basename_nc and get_basename_offset
added wrappers for get_extension_nc and get_extension_offset
added strip_extension
use these where appropriate
remove duplicate definitions in stand-alone utilities
2008-04-22 08:11:55 +00:00
Charlie Gordon
083d96dc3c remark 2008-04-20 11:51:58 +00:00
Charlie Gordon
58b5872c52 fixed OpenBSD compile issues:
- check OpenBSD as uname output
- no longer use strcpy, strcat, sprintf
- added CONFIG_PTSNAME to disable Unix98 API under BSD
- fixed crash bug in tty.c on empty window
2008-04-15 23:24:03 +00:00
Charlie Gordon
53bf5ef8c2 fixed qe_collate to sort system buffers last 2008-04-15 08:14:07 +00:00
Charlie Gordon
597e4a48a0 renamed extension() to get_extension() for consistency
added safe cast functions s8(): u8* -> char * and const variant cs8()
strip # suffix in reduce_filename()
2008-04-09 16:15:45 +00:00
Charlie Gordon
2d0783cfd9 renames basename to get_basename to avoid conflicts 2008-04-08 06:54:44 +00:00