Commit graph

82 commits

Author SHA1 Message Date
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
Charlie Gordon
d4d6f8a0f3 fixed some configure issues for mingw compile under cygwin
added CONFIG_MMAP to control availability of memory mapped files
added CONFIG_DOC to control doc rebuild
use state variables to control file mmapping and loading
default limit of 512MB for loading file
try and load the file upon mmap failure
do not use alloca in CONFIG_WIN32
use CONFIG_WIN32 instead of WIN32
update Makefile to enable win32 build under cygwin (dumps core)
renamed mouse_event to prevent compile warning
patched unix.c util.c win32.c to enable WIN32 compile
fixed kmap.c to load mapping files when mmap fails or is unavailable
2008-04-05 23:04:56 +00:00
Charlie Gordon
f430a35836 fixed defined macros bug: first key was combined with current
no longer use register_bottom_half for current keyboard macro
added QEmacsState::executing_macro to prevent double store of macro keys
accept regular text as self insert in defined macros
2008-03-30 12:02:01 +00:00
Charlie Gordon
1ccf1aec26 added is_directory 2008-03-28 12:21:39 +00:00
Charlie Gordon
6106adfa09 fixed bug in buf_putc_utf8 2008-03-26 20:32:47 +00:00
Charlie Gordon
54b6f9c641 added reduce_filename to compute a stripped filename for mode probing
stripping VCS/backup prefixes and suffixes, fixing case.
added Lex (.l .lex) and .C files to C mode
fixed spurious error message at edit_set_mode_file
restored standard behaviour for extension() : return pointer to last extension
2008-03-26 08:03:55 +00:00
Charlie Gordon
74f5008613 ignore numeric extensions in extension() and match_extension() 2008-03-25 11:05:45 +00:00
Charlie Gordon
9516917f97 added variables.h and variables.c for configurable state and window properties
cleaned up Makefile
renamed ModeDef::mode_line function pointer to get_mode_line
fixed some sparse warnings
use c99 syntax in video.c and image.c
added EditBuffer::offset for buffer parsing
added state variables QEmacsState::it, QEmacsState::ignore_spaces,
   QEmacsState::mmap_threshold
support variables in config file, strings can be delimited with ' and "
2008-01-18 17:03:35 +00:00
Charlie Gordon
28397f424f moved input_methods to QEmacsState
qe_register_binding takes ModeDef* and returns status
cosmetic changes in QEDisplay API
added int dpy_init(QEditScreen *s, QEDisplay *dpy, int w, int h);
  copies *dpy (or dummy_dpy if NULL) to QEditScreen and calls method
simplified dpy_init methods and calls
inlined 5 more methods
moved dummy_dpy to display.c and simplified
simplified to_hex
simplified qe_colors array handling
2008-01-11 11:29:28 +00:00
Charlie Gordon
a5eae3ed92 bumped copyrights, some cosmetics 2008-01-08 16:37:54 +00:00
Charlie Gordon
98939ddcac changed API for completion functions:
- use CompleteState struct
- use complete_test for each potential match with simple prefix comparison
added new smart string compare function qe_collate to sort strings in
  lexicographical order but sort numeric portions in numerical order
use qe_collate in popup lists and dired
removed redundant alias "iso8859-2"
added strequal(a,b) as an alias for !strcmp(a,b)
  this function makes string collation with strcmp more explicit
  this even fixed a spurious bug in do_set_emulation
2008-01-08 03:42:53 +00:00
Charlie Gordon
ae163f897b fixed crash on charset_completion
renamed css_strtolower -> qe_strtolower
use offsetof for SAVED_DATA_SIZE macro (this stuff must go)
cosmetics in css_get_enum
remarks
fixed text-mode colorization bug: because of saved_data stuff,
  must reset colorization function after mode restore.  This saved data
  stuff is bogus and should be rewritten
smaller version of roman numeral converter
fixed alpha converter
smaller implementation of css_counter_str
fixed list_mode name: no longer generates extra mode completion entry
2008-01-07 16:25:22 +00:00
Charlie Gordon
f11cf4a207 eb_scratch takes buffer creation flags
added eb_find_new -> find a buffer by name, create one from flags if not found.
qe_register_cmd_table takes ModeDef* instead of mode name
do_global_set_key -> do_set_key with local/global flag
added local-set-key
reuse *bufed* buffer if one exists
bind increase/decrease-width commands from command definition
cosmetics, comments, remarks
renamed kill buffers from *yank* to *kill-%d*
save QErrorContext in parse_args, load_all_modules:
  improves readability in *messages* buffer
fixed qe_init to fall back from x11 display to terminal session upon failure
2008-01-04 22:24:37 +00:00