Commit graph

69 commits

Author SHA1 Message Date
Charlie Gordon
645b9c1aeb cosmetic changes
* report lack of undo information in do_undo and do_redo
* make region command remove region highlight
2014-01-31 14:50:13 +00:00
Charlie Gordon
87a1d39c9f cosmetic changes in buffer API
* make eb_insert return number of bytes inserted
* make eb_printf return number of bytes inserted (was length of utf8 string)
2014-01-31 12:14:13 +00:00
Charlie Gordon
acf421085a fix compilation warnings 2014-01-25 09:21:48 +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
b953aaf811 improve consistency in buffer variables
* change tab-size to tab-width
* make tab-width a buffer variable
* add fill-column buffer variable
* add set-fill-column on C-x f
* add default-tab-width and default-fill-column global variables
* force indent-tabs-mode in makefile mode
* force tab-width to 8 in shell output buffers
2014-01-21 00:01:20 +00:00
Charlie Gordon
c0b4323ef9 merge eb_is_blank_line and eb_is_empty_line, simplify paragraph commands
* simplify eb_is_blank_line
* remove eb_is_empty_linek
* simplify paragraph commands with eb_is_blank_line
2014-01-19 17:25:02 +00:00
Charlie Gordon
571a96441b make new buffers use utf8 charset by default
* added BF_RAW flag for undo and styles buffers
2014-01-16 15:18:44 +00:00
Charlie Gordon
82adc44256 simplify eb_get_strline and fix eb_get_contents
* simplify eb_get_strline using buf_putc_utf8
* fix eb_get_contents for non utf8 buffers
2014-01-16 13:45:04 +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
c258955d08 improve undo system
* use bit 2 in b->save_log to suspend callbacks and logging during transient
  undo phase.
* dispatch callbacks before buffer modification (eb_delete)
* this fixes bugs in the undo system where some offsets were not properly
  updated, color buffer was shifted, cursor would get lost and sometimes
  crash would follow.
* buffer colors are not undone properly
* pass extra int argument to buffer callbacks
* make eb_offset_callback more generic: handle edge effect via extra arg.
  edge effect causes offset to move upon insertion at current value
* add new log variables log_last_char and last_log.
  use these to coalesce consecutive log records and make undo more efficient
* add new command "redo" on C-x C-_ and C-x r
* fix undo glitches in the process buffer, update cursor correctly upon redo
2014-01-14 03:29:36 +00:00
Charlie Gordon
9b4582fd0d fix undo bugs
* use bit 2 in b->save_log to suspend callbacks and logging during transient
  undo phase.
* dispatch callbacks before buffer modification (eb_delete)
* this fixes bugs in the undo system where some offsets were not properly
  updated, color buffer was shifted, cursor would get lost and sometimes
  crash would follow.
* buffer colors are not undone properly
2014-01-13 23:38:15 +00:00
Charlie Gordon
10584b584e extend eb_skip_chars, eb_delete_chars
* accept negative displacement in eb_skip_chars, eb_delete_chars
2014-01-13 10:31:56 +00:00
Charlie Gordon
82157e67bf extend eb_match_xxx APIs to update end offset 2014-01-11 15:07:14 +00:00
Charlie Gordon
592ab5ebc3 add some buffer APIs
* add buffer APIs for matching and inserting text:
  - eb_insert_str
  - eb_match_uchar
  - eb_match_str
  - eb_match_istr
* simplify eb_insert_utf8_buf: no longer accept -1 len
2014-01-11 14:38:30 +00:00
Charlie Gordon
4fcebb6fbc small fixes in buffer APIs
* fix bug in eb_delete_chars
* pass len=-1 for zero terminated strings in eb_insert_utf8_buf
2014-01-10 01:17:14 +00:00
Charlie Gordon
9a58b44917 new character based APIs for buffers
* add eb_skip_chars
* rename eb_delete_nextc to eb_delete_uchar
* deprecate eb_line_pad
* use char based buffer API in orgmode
2014-01-08 16:26:44 +00:00
Charlie Gordon
d7eb78adc7 fix c89 compilation for Haiku 2014-01-07 00:49:14 +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
2dbe907a64 move first_buffer_data_type to QEmacsState 2014-01-04 17:32:42 +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
b9d6113ba3 improve unicode hex display mode
* filter control characters and non BMP1 code points
* new mode specific modeline
* do not space out single width glyphs (not very readable)
* eb_get_char_offset: add validation on offset argument
* eb_get_char_offset: align offset argument on character boundary
2014-01-04 15:54:48 +00:00
Charlie Gordon
9434c3ba7b renamed functions for consistency 2013-12-23 23:26:43 +00:00
Charlie Gordon
b7af4afae6 - fixed potential bug in eb_next_line for offset < 0.
- make it return '\n' and set offset to 0, similar to behavior at EOB
2013-11-30 13:50:12 +00:00
Charlie Gordon
ba06d7883e fixed gcc 4.7 warnings about variables set but unused 2013-11-23 19:11:13 +00:00
Charlie Gordon
9cf6a3cb87 simplified buffer decoding methods: pass ptr in CharsetDecodeState 2008-05-02 17:05:38 +00:00
Charlie Gordon
e493a2e99c fixed many problems with charset encodings
added charset methods for buffer line and position computations
added QECharset fields for char_size and variable_size indicator
use charset's eol_char to count lines in buffers: this should fix EBCDIC support
added support for ucs2 and ucs4 little and big endian encodings
charset's decode_func call no longer be NULL
eb_nextc and eb_prev now require non NULL third parameter
2008-05-02 16:04:09 +00:00
Charlie Gordon
126eaa1bc6 some extra defensive code 2008-04-22 08:17:02 +00:00
Charlie Gordon
04ebeb7606 better separation of function pointers and void*
use CmdFunc typedef for generic command function pointers
no longer use \e for escape use \033 instead
use memcpy trick to prevent gcc warning on dlsym in -pedantic mode
2008-04-20 12:01:34 +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
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
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
dfa56150c6 start buffer names at <1> upon collisions 2008-03-30 11:00:07 +00:00
Charlie Gordon
e483a5bc9c added buffer variable EditBuffer::tab_size
added buffer variable EditBuffer::offset
added more tests for CONFIG_XV
added test on GCC version for forward reference on hex_mode
2008-03-25 10:13:37 +00:00
Charlie Gordon
2681b68040 removed EditBuffer.yank_mark and QEmacsState.mark_yank_region
changed API for GetColorizedLineFunc: offset passed by address,
  updated to start of next line
added check_readonly(EditState *s)
added tentative code for unregistring bindings, cycling modes and charsets
experiment alternate method for region highlighting:
  added EditState.region_style and EditState.curline_style
  added QEmacsState.hilite_region
  added DisplayState.style
  added clear_color to reset style bits in unicode array
  display_char_bidir takes style from DisplayState, code point is bare.
  fixed problem in text_display where line_num was not computed in shell mode
  handle region coloring in text_display (tentative)
display line numbers and hex dump offsets as QE_STYLE_COMMENT
display hex dump as QE_STYLE_FUNCTION
2008-01-09 13:41:40 +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
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
c556f52763 renamed set_buffer_name to eb_set_buffer_name
made log buffer more readable with log structure padding trick
renamed set_filename to eb_set_filename
added CmdSig enum and CmdProto union for signature based command dispatcher
changed CmdDef structure, val is now required to be an integer (24 bits)
intrinsic string argument ('S') is now passed as prompt with S{xxx} syntax
changed set-mode functions and do_define_kbd_macro accordingly
added signature in CMD_ and CMDV macros
renamed do_load to do_find_file
2007-12-27 10:04:09 +00:00
Charlie Gordon
6d3fed85ac cosmetics, comments 2007-12-26 11:09:34 +00:00
Charlie Gordon
f4193d52f2 prevent potential buffer overflow 2007-12-26 09:49:52 +00:00
Charlie Gordon
8142f3a9e3 fixed eb_replace API
added capitalize-word (M-c) and capitalize-region (M-C-c)
fixed eb_changecase and added support for capitalization
simplified do_changecase_word and do_changecase_region
2007-12-21 22:34:31 +00:00
Charlie Gordon
658149e9f8 moved global variables to QEmacsState structure:
- first_mode, first_key, first_cmd,
 - first_completion, first_history
 - trace_buffer, trace_buffer_state,
 - backspace_is_control_h
2007-12-21 12:30:55 +00:00
Charlie Gordon
69b5b1f40e comments 2007-12-20 20:39:18 +00:00
Charlie Gordon
788461233d raw_save_buffer takes range and returns number of bytes written
added eb_write_buffer, returns number of bytes written
renamed save_buffer to eb_save_buffer, returns number of bytes written
added range in buffer_save method in EditBufferDataType
no longer reset undo log upon file saving
renamed do_save to do_save_buffer
added do_write_region (bound to C-X w)
renamed command execute-extended-command to execute-command
renamed command vc-toggle-read-only to toggle-read-only
fixed mark-whole-buffer to set point to start and mark to end of buffer
query-replace accept upper-case Y and N, and . for replace and quit.
shell passes universal argument to do_shell
bind next-error to C-X `
2007-12-20 16:27:21 +00:00
Charlie Gordon
e86feb3b8f added offsetof macro for platforms that do not have it
added eb_clear, eb_scratch, eb_replace, eb_delete_range
added remarks about inconsistentcies
check buffer readonly status in low level buffer primitives
2007-12-20 11:49:54 +00:00
Charlie Gordon
2d70f198fb added sanity tests
append system buffers to list instead of prepending them
2007-12-18 17:59:48 +00:00