aboutsummaryrefslogtreecommitdiff
path: root/text.h
AgeCommit message (Collapse)AuthorFilesLines
2025-11-24text: remove a bunch of unused save functionsRandy Palamar1-18/+2
These functions were only used for testing the text system. One of them was moved to text-test.c to continue to facilitate this. Otherwise these functions are just cluttering up the code and making it hard to modify.
2025-11-24text-io: make TextSave visibleRandy Palamar1-2/+13
Having a failure case on allocing a TextSave is stupid. Ideally there would be no allocations in the file saving path but we have to replace the braindead dirname(3) with an internal implementation.
2025-06-13doc: fix Doxygen comments for text.hMatěj Cepl1-24/+31
2024-09-13support piping a buffer to an external processFlorian Fischer1-0/+6
Currently only Text objects can be piped to external commands. This is tedious if data not available in any file should be passed to an external process (e.g. building options and passing them to vis-menu). This adds the option to pass a buffer to _vis_pipe and provides wrapper functions for the original behavior and the new one.
2022-11-29fix miscellaneous spelling mistakesNick Hanley1-1/+1
2020-12-10fix typos in commentsMoesasji1-7/+7
2020-10-10text: provide public text_iterator_initMarc André Tanner1-0/+1
It can be used to initialize a (stack allocated) Iterator structure, avoiding the copying of the return value as done by text_iterator_get which depending on the implementation might be problematic.
2020-10-10text: mark return value of text_iterator_text as constMarc André Tanner1-1/+1
2020-10-10text: make text_snapshot return whether it succeededMarc André Tanner1-1/+1
Currently this can't fail, but one can imagine implementations which do.
2020-10-10text: mark text_delete_range range argument as constMarc André Tanner1-1/+1
2020-10-10text: mark text_save_write_range range argument as constMarc André Tanner1-1/+1
2020-10-10text: mark text_mmaped argument as constMarc André Tanner1-1/+1
2020-10-10text: mark text_write{,_range} argument as constMarc André Tanner1-2/+2
2020-10-10text: mark text_size argument as constMarc André Tanner1-1/+1
2020-10-10text: mark text_mark_get argument as constMarc André Tanner1-1/+1
2020-10-10text: mark text_iterator_byte_get argument as constMarc André Tanner1-1/+1
2020-10-10text: mark text_bytes_alloc0 argument as constMarc André Tanner1-1/+1
2020-10-10text: mark text_byte(s)_get argument as constMarc André Tanner1-2/+2
2020-10-10text: mark text_iterator_get argument as constMarc André Tanner1-1/+1
2020-10-10text: mark text_state argument as constMarc André Tanner1-1/+1
2020-10-10text: mark text_modified argument as constMarc André Tanner1-1/+1
2020-10-10text: mark text_stat argument as constMarc André Tanner1-1/+1
2020-10-10text: introduce text_iterator_textMarc André Tanner1-0/+1
2020-10-10text: introduce text_iterator_has_{next,prev}Marc André Tanner1-0/+2
Abstract away access to `it->piece` inorder to enable different implementations/backends.
2020-08-29text: provide save function taking a directory descriptorMarc André Tanner1-1/+3
The standard does not specify mkstempat(3). We currently implement it in a non thread safe manner, by temporarily changing the process working directory before invoking mkstemp(3).
2020-08-29text: provide load function taking a directory descriptorMarc André Tanner1-0/+2
2020-08-29text: move misplaced text_save documentation snippetMarc André Tanner1-4/+4
2020-08-01doc: fix a couple of API doc warningsMarc André Tanner1-16/+16
In restructured text double backquotes are used for inline literals.
2020-05-13text: introduce text_save_method, remove text_save_rangeMarc André Tanner1-8/+13
This utility function is analogous to text_load_method and allows the caller to specify how the file should be saved. It is implemented as a wrapper around the lower level text_save_{begin,write,commit} primitives. The unused text_save_range function has been removed. If needed, use the aforementioned lower level functionality.
2018-05-30text: allow to specify how the file content should be loadedMarc André Tanner1-1/+39
2018-05-16text: use mkstemp(3) for temporary file creation in atomic savesMarc André Tanner1-3/+4
Instead of simply appending a tilde to the original file name, we now create an unique temporary file based on the pattern `.filename.vis.XXXXXX`. In case the file does not yet exist, we use 0666 & ~umask as permission, (this should match the previous `open(2)` based behavior).
2017-07-11vis: cleanup register related APIMarc André Tanner1-0/+6
Also expose all register slots through the Lua API.
2017-05-03text: remove text_history_get functionMarc André Tanner1-3/+0
As currently implemented this does not properly integrate with multiple cursor support. The functionality should be provided in a layer higher up. The jumplist and changelist need to be redesigned, for now they are broken.
2017-05-03text: remove text_iterate macroMarc André Tanner1-5/+0
2017-05-03text: remove text_insert_newline functionMarc André Tanner1-2/+0
This is no longer needed because we always insert \n never \r\n.
2017-05-03text: remove count argument from text_{earlier,later}Marc André Tanner1-2/+2
2017-05-03text: add miscellaneous documentation sectionMarc André Tanner1-8/+11
2017-05-03text: rename text_sigbus to text_mmapedMarc André Tanner1-3/+5
Add casts to uintptr_t to avoid unrelated pointer comparisons.
2017-05-03text: convert comments to doxygen formatMarc André Tanner1-84/+293
2017-04-09vis: remove handling of \r\n line endingsMarc André Tanner1-9/+0
Use something like dos2unix(1) and unix2dos(1), if you need to edit such files.
2017-04-09text: drop special handling of \r\n line endingsMarc André Tanner1-6/+0
2017-04-09text: add mem{r,}chr(3) based byte search functionsMarc André Tanner1-0/+2
These are generally implemented efficiently in libc. While memrchr(3) is non-standard, it is a common extension. If it is not available, we use a simple C implementation from musl.
2017-04-08text: introduce text_char_get which converts \r\n to \nMarc André Tanner1-0/+3
2017-02-25text: add iterator accessor function which translates \r\n to \nMarc André Tanner1-0/+3
2016-12-23Apply format string attribute to printf style functionsMarc André Tanner1-2/+2
Not strictly C99 conform, but widely supported and easy enough to NOP for compilers which do not support it. Besides it was already used to mark certain functions as noreturn.
2016-12-23text: make text_vprintf static, it is only used within text.cMarc André Tanner1-1/+0
2016-12-22text: remove Filepos typedefMarc André Tanner1-2/+0
The idea might be good, but it was almost unused.
2016-12-22text: introduce EMARK to denote an invalid markMarc André Tanner1-1/+3
Technically this macro name is in the reserved namespace of errno.h. The same is true for EPOS. Maybe we should rename them at some point, but for now the short names are convenient. Fix #443 Close #444
2016-12-22text: change datatype of Mark to uintptr_tMarc André Tanner1-1/+2
This should avoid undefined pointer comparisons.
2016-12-14text: expose text save method to calling codeMarc André Tanner1-1/+7
There are cases where it is useful to specify how the file should be saved.