Commit graph

79 commits

Author SHA1 Message Date
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
161053d03f dired: update sort order prompt 2017-04-25 17:14:30 +00:00
Charlie Gordon
063801372c file: improve qe_load_file API
- pass flags as bit mask for:
  kill_buffer, load_resource, cwd_relative, split_window
- fix bug with multiple files on command line from different directories
2017-03-15 07:32:48 +00:00
Charlie Gordon
bfe0b5f528 dired: only output previewing message from filelist 2016-12-31 11:29:38 +00:00
Charlie Gordon
94464bd939 dired: add filelist mode
- add `WF_FILELIST` window flag for preview-mode tests
- add `argval` argument to `do_dired()`
- `dired_view_file()` displays message and returns preview pane
- `dired` command with argument selects filelist mode with navigation pane
  bound to C-u C-x C-d
- add `filelist` command
2016-12-31 11:12:16 +00:00
Charlie Gordon
87a151fd95 comments 2016-12-27 12:31:36 +00:00
Charlie Gordon
f41235695f display: some fixes, simplifiations
- add `gutter_width` in `DisplayState` for line number column
- add `int get_glyph_width(QEditScreen *screen,
                           EditState *s, int style_index, int c);`
  and `int get_line_height(QEditScreen *screen,
                           EditState *s, int style_index);`
  to compute font dimensions from style index and window
- compute borders more accurately in `display_window_borders()`
- clip text drawing, use window relative coordinates in `flush_line()`
- fix width computation for diagnostic status display in X11
- use QE_STYLE_DEFAULT and remove redundant e->default_style references
2016-12-27 10:13:46 +00:00
Charlie Gordon
862119faf3 use character width in graphics mode for dired layout 2016-12-25 11:31:16 +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
9c99730239 display: cursor handling
- merge do_center_cursor and do_center_cursor_maybe:
  do_center_cursor takes an `int force` argument
- add set-window-style command to change `e->default_style`
- change argument sign for do_scroll_left_right() for consistency
  scroll window by increments of space_width
  toggle WRAP_LINE, WRAP_WORD and WRAP_TRUNCATE in do_scroll_left_right()
- do not force WRAP_TRUNCATE in dired view pane to avoid problems on files
  with extremely long lines
2016-12-23 13:00:55 +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
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
d5e10dfe77 update copyrights, TODO list 2016-06-09 16:24:10 +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
c6d898dbb1 fix compilation warning 2015-09-16 12:35:43 +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
6d87117bbc dired: set default position in new dired window to first entry 2015-08-30 21:51:49 +00:00
Charlie Gordon
545284f68b dired: code cleanup, better layout control
- refactored dired_sort_list() as dired_update_buffer():
  better detection of formating changes and less useless sorting
- make sort-mode, hflag, nflag... remanent and global for all dired buffers
- fix and simplify handling of current entry in dired popleft window.
- compute and display numbers of hidden files and directories
- total byte count only accounts for visible entries
- control dired-hflag with 'H': human readable sizes
- control dired-nflag with 'N': alpha/numeric/hidden uid/gid columns
- use variable setter function for dired-sort-mode and dired-time-format
2015-08-30 15:30:58 +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
0dd8c31b9e bufed: improve dired display
- use static colors and styles
2015-08-26 01:12:21 +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
e2fa870ad9 dired: fixed bugs, simplified code
- use mode structure as signature
- pass DiredState to internal functions
- no longer refuse to descend into symlink directories
- improve navigation when focus goes to a dired buffer in preview mode
- no longer make dired buffers system buffers to fix bufed behaviour
- make dired-time-format a global variable
2015-08-19 16:49:04 +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
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
b57cbb7802 dired-mode: added dired-toggle-dot-files on . 2015-06-24 12:38:53 +00:00
Charlie Gordon
7806168c2e added variables to control the display of hidden files
* dired-show-dot-files: show files and directories starting with '.', default 1
* dired-ds-store: show .DS_Store files on Mac OS/X, default 0
2015-06-19 14:09:31 +00:00
Charlie Gordon
6b9c9b0c02 changed dired and use BF_PREVIEW flag to improve source code navigation 2015-05-09 22:25:04 +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
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
2ba97a9b71 fix dired behaviour on symlinks 2014-04-25 20:05:32 +00:00
Charlie Gordon
3797c0100e dired: disable display of number of blocks 2014-04-18 20:54:28 +00:00
Charlie Gordon
2ef06f9131 pass QEColorizeContext to ColorizeFunc callbacks
* pass state and state_only as members of QEColorizeContext
* simplify ColorizeFunc, make them more consistent
* use offsets instead of pointers to prepare for further API changes
2014-04-05 15:49:14 +00:00
Charlie Gordon
553256b6b6 improve dired-mode
* use mode specific namespace for colorizer styles
* use enum values instead of preprocessor macros for states and styles
* produce long listing with varying number of columns depending on window width
* rebuild buffer contents on window size change
* select date/time format with new command dired-set-time-format on 't'
* add do_dired_up_down to bind dired-next-line and dired-previous-line
* remove duplicate commands next-line and previous-line
* add do_dired_mark behavior for dired-unmark-backward on DEL
* support non byte oriented charsets
* colorize dired mode
2014-04-02 13:17:38 +00:00
Charlie Gordon
17458b712a dired: fix refresh bug on first item when selecting directory 2014-03-13 08:01:00 +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
9d95ed545d Improve robusness of dired mode 2014-03-03 23:24:09 +00:00
Charlie Gordon
31687cd93b Add NULL pointer checks, avoid crash bugs 2014-03-01 19:24:02 +00:00
Charlie Gordon
5b4b273ca1 Show mode information in dired
* compute and display number of directories, files and total bytes
2014-02-12 07:25:35 +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
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
3796d5d22e add BF_TRANSIENT buffer flag: buffer freed upon window close
* closing a window with a 'transient' buffer frees unless it is viewed in another window
2014-01-13 11:00:43 +00:00
Charlie Gordon
deb6972ca3 better charset handling
* make eb_insert_buffer return the number of bytes inserted
* reset page bits upon charset change
* add eb_delete_nextc: delete one encoded character at offset
* add eb_insert_uchar: insert a unicode character with encoding
* add eb_insert_utf8_buf: insert a utf8 encoded buffer with conversion
* make eb_printf insert utf8 bytes with conversion
* add eb_insert_buffer_convert: copy chars between buffers with charset
  conversion
* handle charset conversion correctly in various places
* insert wide caracters from hex mode
* create most buffers as BF_UTF8 by default
* set kill-buffer charset to that of kill source
* convert charsets when yanking
* handle charsets in search/replace system
2014-01-06 09:40:20 +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
8b592ad49c typo, added argument tag 2008-04-25 10:54:50 +00:00