Commit graph

45 commits

Author SHA1 Message Date
Charlie Gordon
3580b53452 syntax: improve minibuffer and popup handling
- remove static state for minibuffer handling, use mode specific state attached
  to the buffer.
- remove static pointer for the popup last active window.  Use new
  target_window member in EditState.
- remove EditState.minibuf, replaced by WF_MINIBUF flag in EditState.flags
- rename minibuffer commands for consistency
- remove unused global variable debug_flags
- prevent search from minibuffer
- fix toggle-full-screen refresh bug. C-x f is bound to toggle-full-screen
  and could be typed by mistake for C-x C-f, switching to full screen mode
  but with a refresh delay.  This caused confusing behavior interpreted as a
  layout bug.
- make charset_ucs2le, charset_ucs2be, charset_ucs4le, charset_ucs4be local
  in charset.c
- make edit_detach() and edit_attach() local in qe.c
- redraw status and diag messages in edit_display(). This caused display
  bugs in x11 as asynchronous messages were erased by minibuffer window
  refresh.
- display status messages in diag area (bottom right screen corner) if
  minibuffer is active.
- force put_status message update if message starts with !
- force complete_refresh if window was resized or layout was changed
2017-04-17 18:14:15 +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
bd10c24ac0 bufed: use buffer flag instead of buffer mode name 2015-08-30 15:31:28 +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
5396a1850b bufed: improve buffer-list display
- use colors and styles
- abbreviate buffer name if too long
- store buffer pointers as opaque data
2015-08-26 01:07:29 +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
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
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
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
611e44403d prepare mode separation (view / syntax / data)
* add fields in EditBuffer struct
* pass buffer and flags to mode_init functions
* add default_mode_init function to avoid tests
2014-06-01 13:54:58 +00:00
Charlie Gordon
2e5cc16713 improve syntax colorizing modes consistency
* create separate modes for all syntax colorizers
* add colorizing_flags to mode structure for code sharing
* pass ModeDef struct pointer to colorizing function
* remove obsolete window fields
2014-05-30 17:18:12 +00:00
Charlie Gordon
b8004d7072 simplify mode definitions
* assume text mode primitives for MODEF_SYNTAX modes
* initialize mode structures inline instead of cloning text_mode
2014-05-29 18:29:14 +00:00
Charlie Gordon
569401da15 simplify mode init/close
* always regsister callbacks on s->top and s->top_offset
* handle saved_data generically, remove window callback
  this will be replaced with view history mecanism.
2014-05-29 10:26:13 +00:00
Charlie Gordon
f527a58e18 add mode flags to specify different types of modes
* add  mode_flags as extra argument to qe_register_mode
* change all mode registration calls accordingly
2014-05-27 12:05:52 +00:00
Charlie Gordon
b81a8efca1 improve list-mode
* combine static buffer styles with full line highlight.
* fix list_toggle_selection for read-only buffers and non byte based charsets
* pass direction flag to list_toggle_selection for bufed-backward-unmark
* add bufed-unmark-backward on DEL
* bufed-next-line and bufed-previous-line on n, C-n, p and C-p
2014-04-01 07:55:32 +00:00
Charlie Gordon
b2c2c9374e improve c-mode, add mode_flags to handle language mode flavors
* add mode_flags and mode_name in EditState
* pass mode_flags to ColorizeFuncs
* define several CLANG mode flavors for C, C++, Javascript, Java, etc.
* add flavor specific keyword lists for c-mode
* add regex support in c-mode for Javascript flavor
2014-03-24 10:58:09 +00:00
Charlie Gordon
948a67dff4 fix dired bug on first entry
* add missing initialization, prevented display of first file in list
* fix same bug in bufed
2014-03-11 19:36:00 +00:00
Charlie Gordon
93b1fecaf4 Fix inconsistencies in buffer mode handling 2014-03-03 23:21:07 +00:00
Charlie Gordon
9eb5944588 Improve mode selection and mode specific command safety
* add set-auto-mode() to (re)select best mode for buffer
* add set-next-mode() on M-m to cycle appropriate buffer modes
* add set-previous-mode()
* add default_mode and saved_mode in buffers to improve mode switching
* add dired mode probing and store st_mode in buffer to detect directories
* add charset, eol_type and buffer in ModeProbeData
* clean mode selection and window buffer attachment (needs more work)
* compute sorted list of appropriate modes in probe_mode
* convert charset and eol_type in mode_probe
* add signatures in buffer priv_data to perform save casts
* move BufedState to b->priv_data, protect mode specific functions
  add bufed_mode_probe function, cycling through modes comes back to bufed mode
* move DiredState to b->priv_data, protect mode specific functions
  add dired_mode_probe function, cycling through modes comes back to dired mode
* add heading line in dired buffer with directory spec
* protect shell-mode specific functions.
* restart shell in shell() command if exited
* some cosmetics changes (remove useless __unused__, missing messages ...)
2014-02-10 21:21:39 +00:00
Charlie Gordon
02da1bb7a1 add generic styles buffer from shell color mode
* styles_buffer hold static style info for each character in the buffer
* new buffer flags to create styles buffers with 1, 2 or 4 bytes per char
* copy static styles to the kill_ring and pasted them style enabled buffers
* preserve static styles in convert-buffer-file-coding-system
* display style bytes in bufed list
* add commands set-region-color, set-region-style, drop-styles
2014-01-15 19:44:24 +00:00
Charlie Gordon
b3a709013a improve mode selection, cleanup
* pass ModeDef pointer to mode_probe functions
* add extensions field to mode structure
* rename ascii mode to binary mode
* rename mode variables and fields to more specific names
2014-01-04 17:26:30 +00:00
Charlie Gordon
7759a1467a simplified edit_set_mode API, display mode in bufed 2013-12-27 01:54:12 +00:00
Charlie Gordon
a3c02ba3d4 display modified and read-only indicators in buffer list
display encoding and home relative filename in buffer list
2013-12-03 17:41:50 +00:00
Charlie Gordon
85c75fb19b typo 2008-04-25 10:54:16 +00:00
Charlie Gordon
caf6950145 renamed CMD_ and CMDV to CMD2 and CMD3 for consistency 2008-04-25 10:46:58 +00:00
Charlie Gordon
90d65f6cfb added flag BF_UTF8 so set buffer charset to uft-8 at creation time
set utf8 charset for buffers:
  *bufed*, *dired*, *xml-error*, *messages, *errors*, *minibuf*, *Help*
remove BF_SYSTEM bit from buffers *messages*, *error*
added syntax for messages not stored in *messages*: start message with ~
2008-03-30 16:10:15 +00:00
Charlie Gordon
ae082b5dd7 remark 2008-03-28 12:23:00 +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
26319c05a7 cosmetics: reformated command definitions 2008-01-04 23:04:11 +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
Charlie Gordon
a71b9efbb4 renamed do_set_mode -> edit_set_mode
use match_extension in mode probe functions
pass move indicator to do_return, removed do_open_line
renamed do_cmd_set_mode -> do_set_mode for consistency
separated strfind and strcasefind, optimized implementation
published register_input_method
unpublished input_methods
optimized KeyDef structure layout
changed eb_search arguments
used eb_delete_range
comments, remarks
better tests on fread failures
set buffer to read-only upon loading non writable file
do_insert_file tests for failure
  set mark at beginning of inserted block and offset at the end
fixed search for word boundary case
made raw_load_buffer1 return number of bytes read, of -1 on error
2008-01-03 18:31:24 +00:00
Charlie Gordon
4743fa1308 added remove_slash and append_slash path utilities
renamed canonize to canonicalize
added crude support for ~user -> /home/user
added win32 specific stuff in basename
added C-/ as an alias for C-_
some cosmetics, moved code
create files with mode 0644 in raw_save_buffer
untabified, removed redundant spaces
modified code generators to the same effect
2008-01-03 09:51:29 +00:00
Charlie Gordon
090b71f4b4 pass argval to list-buffers command, making all buffers visible 2007-12-27 10:01:32 +00:00
Charlie Gordon
2ba4b76e20 fixed popup bug caused by readonly flag 2007-12-21 12:20:17 +00:00
Charlie Gordon
d286b27756 made more local variables static
fixed bug in cfb32_fill_rectangle
use c99 syntax for new style struct initializers instead of gcc specific
simplified tolower unsigned char hacks
fixed various sparse warnings
2007-12-06 17:43:47 +00:00
Charlie Gordon
6c65411200 added missing headings, cosmetics 2007-12-03 16:10:38 +00:00
Charlie Gordon
494e9f7866 include cflags.mk for extra gcc warnings if present
utf8_encode now returns the number of characters copied,
  simplified code accordingly
made local functions static
tagged unused function arguments
fixed shadowing issues
added support for GCC attributes for unused arguments and format strings
use snprintf() instead of sprintf()
moved scattered declarations to qe.h
removed duplicate declarations in header files
eb_write() payload argument is now const
fixed crash bug: reset trace_buffer upon deletion
improved trace_buffer readability: trace all pseudo tty streams separately
added missing structure initializers
removed buffered string handling from cutils.h
added new buffered string API for statically allocated buffers (should unify)
small improvements in X11 initialization
improved consistency in tty.c (function names...)
  added STDIN and STDOUT streams in QEditScreen to stop using stdin and stdout
  use unlocked stream I/O if available (faster)
  changed and documented terminal setup and exit sequences
  improved charset handling
mode_line functions now return the character count (like snprintf)
2006-12-31 19:34:00 +00:00
Charlie Gordon
7128c65b41 use 20% of width for dired/bufed modes 2006-12-11 23:08:50 +00:00
Charlie Gordon
c52d77ea70 cosmetics only (spacing, untabify) 2005-05-11 15:12:14 +00:00
Charlie Gordon
bcd278f8c4 added do_toggle_control_h() declaration
put message in do_quote(), do_set_mark(),
added find_window() to locate window in a given direction.
added do_previous_window() for window navigation.
do not split popup window in do_split_window().
allow window navigation with C-X n / C-X p /
  C-X up / C-X down / C-X left and C-X right.
2005-05-09 01:29:34 +00:00
Charlie Gordon
a18ce8dcba improved bufed mode:
added BUFED_ALL_VISIBLE flag to include system buffers in list
  display buffer size
  added bufed_clear_modified, bufed_toggle_modified.
  added bufed_toggle_all_visible, navigation keys.
improved dired mode:
  store file details in separate structure
  added sorting options, marking options
2005-05-08 15:08:07 +00:00
Charlie Gordon
3dd0f5660c Initial revision 2004-05-29 10:17:37 +00:00