Commit graph

131 commits

Author SHA1 Message Date
Charlie Gordon
03bb89b96f shell: set error pointer upon process buffer creation 2017-05-03 07:18:05 +00:00
Charlie Gordon
b50a3f42b1 shell: improve terminal emulation
- emulate alternate screen, snap top of screen in display_hook
- add ShellState.alternate_screen_top
- save and restore cursor
- handle combination marks and wide glyphs in qe_term_get_pos() and
  qe_term_goto_xy()
- erase screen \E[J
- prevent automatic switch to interactive mode in full screen applications
  when moving point to cur_offset. Must use C-o as a toggle.
- notify shell process of window size change with C-l (shell-refresh)
2017-04-26 07:05:42 +00:00
Charlie Gordon
ff1952f5a0 display: improve line wrap handling
- add WRAP_AUTO and WRAP_TERM (for terminal emulator)
  WRAP_AUTO wraps lines if the window is more than 3/4 of the screen width
  if window is narrower, lines are truncated.
  WRAP_TERM does not display the \ wrapping mark to simulate terminal behavior
- add default_wrap member in ModeDef structure
- delegate to view pane for man, ssh and compile commands
2017-04-25 17:41:27 +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
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
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
8ab9a36ad1 shell: move point to the end of buffer in start-shell
- C-x RET RET can be used to go to the shell prompt directly
2017-04-12 07:56:15 +00:00
Charlie Gordon
e333c211fe display: fix some popup issues
- prevent some commands from a popup-window or close it
2017-04-12 07:54:30 +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
4104ab568b display: improve color and style handling
- add support for 256 and true color terminals
- fix color handling for defined styles
- fix bold, italic and underline handling for terminals
- use more explicit symbols for qe-term emulator in shell.c
- shell buffer terminal emulator still uses 16 colors
- display buffer style in C-X =
- bumped version to 0.5.0dev
2017-04-02 01:12:01 +00:00
Charlie Gordon
d3e8e65277 shell: fix colorization of clang note diagnostics 2017-03-31 07:42:44 +00:00
Charlie Gordon
7e27ea3c66 C-x C-m finds the most recently used process buffer 2017-03-25 17:49:39 +00:00
Charlie Gordon
0d630448db shell: handle C-t and M-t at shell prompt 2017-03-18 14:13:33 +00:00
Charlie Gordon
0f4285bfec shell: add support for word case changing commands 2017-03-17 16:28:04 +00:00
Charlie Gordon
60d2653cd0 shell: fix column number parsing for next-error 2017-02-25 19:37: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
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
214d02c67b improve current directory handling for shell mode
- get_default_path() takes buffer and offset instead of window
- mode specific handler returns NULL is current directory cannot be determined
- set EditBuffer->default_mode upon creating buffer_mode_data
- add ShellState->curpath to hold shell buffer current directory
- add shell_get_curpath to parse shell output for current directory
  in shell prompt, check if dir actually exists.
- update shell directory upon enter key.
  should instead keep a list with validity ranges
2016-11-26 11:30:29 +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
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
cde3d64660 shell: improve shell editing
- add shell_exchange_point_and_mark() command
  handled by the process in interactive mode
2016-05-28 16:27:56 +00:00
Charlie Gordon
41cccd9643 shell: improve shell history handling
- add shell_previous_next() function:
  - does previous/next command at shell prompt
  - moves by four lines elsewhere
- bind shell-previous command on M-p
- bind shell-next command on M-n
- flag shell-kill-line, shell-kill-beginning-of-line, shell-yank,
  shell-enter, shell-backward-delete-char, shell-tabulate commands
  as modifying the buffer
2016-05-28 10:34:17 +00:00
Charlie Gordon
64149adc97 shell: improve current directory handling
- add get_default_path mode function
- move dired specific code to dired_get_default_path()
- add shell_get_default_path(), gets directory from prompt on current line
2016-05-27 18:20:30 +00:00
Charlie Gordon
2b55531e13 shell: improve interactive mode switching
- beginning of buffer (M-<) and end-of-buffer (M->) indirect through mode
- switch in and out of interactive mode on beginning- and end-of-buffer
- improve other cursor movement handling in shell buffer.
- add shell-intr(), shell-delete-char(), shell-delete-word(),
  shell-backspace(), shell-kill-line(), shell-yank(), shell-tabulate()...
2016-05-21 16:13:41 +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
f0aa3a4bd8 cosmetics: untabify, remove trailing spaces 2015-08-27 23:03:39 +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
03db9d420a modes: simplified mode setting and saving
- get rid of ModeSavedData structures
- save window data upon buffer change and mode setting
- make generic_mode_close() and generic_mode_init() local
- simplify edit_set_mode() and switch_to_buffer()
- reset w.insert, w.hex_mode, w.hex_nibble, w.unihex_mode, w.wrap
  to mode specific default values upon mode change.
- split do_set_next_mode() command into qe_set_next_mode() lower level
  function with an extra status parameter report new mode.
2015-08-26 22:51:24 +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
1fd5a57bae dired: improve preview-mode
- pass bf_flags for buffer creation from do_find_file() ...
- do not set BF_PREVIEW flag for existing buffers from dired
- exit preview-mode with C-g and RET
- SPC and BSP move by page in preview-mode
- add Preview mode-line indicator
- add preview-mode() command
2015-08-10 19:44:19 +00:00
Charlie Gordon
be02b048b9 shell: accept more error message formats, handle column number 2015-08-10 18:35:13 +00:00
Charlie Gordon
2dad1fed8d clear mode_name in modes derived from text_mode 2014-08-09 17:42:15 +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
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
6cf7cf24f3 fix problems with shell buffers
* create styles for existing buffers passed to new_shell_buffer
* preserve unmodified status for read-only shell output buffers
2014-04-17 17:14:09 +00:00
Charlie Gordon
ee690b2895 add support for web protocols: ftp, http, https
* add wget-mode to retrieve web contents via find-file
* add shell flags for buffer mode change upon download completion
* fix do_electric_filename to keep http:// prefix and such
2014-03-19 19:42:30 +00:00
Charlie Gordon
2841a9dc96 fix tab behaviour
* add eb_insert_spaces(b, offset, count)
* add qe_mode_set_key(m, keystr, cmdname)
* removed duplicated pager_commands, register bindings instead
* use undo to remove spaces inserted by tab if !indent_tabs_mode
* change do_tab to insert indentation with spaces depending on
  indent_tabs_mode and indent_size
2014-03-15 22:52:51 +00:00
Charlie Gordon
325be8d5a6 fix missing close on pseudo tty 2014-03-04 00:36:58 +00:00
Charlie Gordon
bfcb396455 Fix inconsistencies in shell mode
* clear interactive window flag upon mode change
* enable interactive mode upon vertical cursor movement
* add more checks for private data consistency
* free shell data upon process exit in non interactive shell buffers
* added shell-command command on M-!
* make kill_buffer_noconfirm() public to remove buffer safely
2014-03-03 23:35:46 +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
a7853b3dff add support for end of line types
* support 3 types of end of line: Unix, Dos and old style Mac
* detect eol type automatically in detect_charset
* set buffer eol_type together with charset
* transparently convert eol sequence to \n upon reading buffers
  characters in eb_nextc().
* transparently convert \n to eol sequence in eb_encode_uchar()
* handle eol types in convert-file-buffer-coding-system: either preserve
  current value or force it via charset suffix -unix, -doc and -mac
* change read_charset() to accept eol_type suffix
* add eol_type and eol_char to CharsetDecodeState
* change charset methods to take CharsetDecodeState instead of charset pointers
* display eol_type in mode line if not unix
2014-02-05 00:56:48 +00:00
Charlie Gordon
d0c2e1d3e6 replace unicode_to_charset with eb_encode_uchar
* prepare support for eol_type support by making char encoding buffer specific
* fix small bugs and unsafe cases.
* fix bug in eb_goto_pos for EBCDIC charsets
2014-02-04 22:47:31 +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