Skip to content

Commit

Permalink
fix typos in comments
Browse files Browse the repository at this point in the history
  • Loading branch information
moesasji committed Dec 10, 2020
1 parent 247b799 commit 8000440
Show file tree
Hide file tree
Showing 15 changed files with 76 additions and 76 deletions.
2 changes: 1 addition & 1 deletion array.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ bool array_truncate(Array*, size_t length);
* Change length.
* @rst
* .. note:: Has to be less or equal than the capacity.
* Newly accesible elements preserve their previous values.
* Newly accessible elements preserve their previous values.
* @endrst
*/
bool array_resize(Array*, size_t length);
Expand Down
6 changes: 3 additions & 3 deletions buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ bool buffer_insert(Buffer*, size_t pos, const void *data, size_t len);
bool buffer_insert0(Buffer*, size_t pos, const char *data);
/** Append further content to the end. */
bool buffer_append(Buffer*, const void *data, size_t len);
/** Append NUl-terminated data. */
/** Append NUL-terminated data. */
bool buffer_append0(Buffer*, const char *data);
/** Insert ``len`` bytes of ``data`` at the begin. */
/** Insert ``len`` bytes of ``data`` at the start. */
bool buffer_prepend(Buffer*, const void *data, size_t len);
/** Insert NUL-terminated data at the begin. */
/** Insert NUL-terminated data at the start. */
bool buffer_prepend0(Buffer*, const char *data);
/** Set formatted buffer content, ensures NUL termination on success. */
bool buffer_printf(Buffer*, const char *fmt, ...) __attribute__((format(printf, 2, 3)));
Expand Down
4 changes: 2 additions & 2 deletions sam.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ static bool cmd_user(Vis*, Win*, Command*, const char *argv[], Selection*, Filer

static const CommandDef cmds[] = {
// name help
// flags, default command, implemenation
// flags, default command, implementation
{
"a", VIS_HELP("Append text after range")
CMD_TEXT, NULL, cmd_append
Expand Down Expand Up @@ -278,7 +278,7 @@ typedef struct {
const char *names[3]; /* name and optional alias */
enum VisOption flags; /* option type, etc. */
VIS_HELP_DECL(const char *help;) /* short, one line help text */
VisOptionFunction *func; /* option handler, NULL for bulitins */
VisOptionFunction *func; /* option handler, NULL for builtins */
void *context; /* context passed to option handler function */
} OptionDef;

Expand Down
4 changes: 2 additions & 2 deletions text-io.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ struct TextSave { /* used to hold context between text_save_{be
#define BLOCK_SIZE (1 << 20)
#endif
/* Files smaller than this value are copied on load, larger ones are mmap(2)-ed
* directely. Hence the former can be truncated, while doing so on the latter
* directly. Hence the former can be truncated, while doing so on the latter
* results in havoc. */
#define BLOCK_MMAP_SIZE (1 << 26)

Expand Down Expand Up @@ -261,7 +261,7 @@ static int mkstempat(int dirfd, char *template) {
* - file ownership can not be preserved
* - file group can not be preserved
* - directory permissions do not allow creation of a new file
* - POSXI ACL can not be preserved (if enabled)
* - POSIX ACL can not be preserved (if enabled)
* - SELinux security context can not be preserved (if enabled)
*/
static bool text_save_begin_atomic(TextSave *ctx) {
Expand Down
14 changes: 7 additions & 7 deletions text-motions.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#ifndef TEXT_MOTIONS_H
#define TEXT_MOTIONS_H

/* these function all take a position in bytes from the start of the file,
* perform a certain movement and return the new postion. if the movement
/* these functions all take a position in bytes from the start of the file,
* perform a certain movement and return the new postion. If the movement
* is not possible the original position is returned unchanged. */

#include <stddef.h>
Expand All @@ -20,7 +20,7 @@ size_t text_codepoint_next(Text*, size_t pos);
size_t text_codepoint_prev(Text*, size_t pos);

/* find the given substring either in forward or backward direction.
* does not wrap around at file start / end. if no match is found return
* does not wrap around at file start / end. If no match is found return
* original position */
size_t text_find_next(Text*, size_t pos, const char *s);
size_t text_find_prev(Text*, size_t pos, const char *s);
Expand Down Expand Up @@ -69,7 +69,7 @@ size_t text_range_line_prev(Text*, Filerange*, size_t pos);
/*
* A longword consists of a sequence of non-blank characters, separated with
* white space. TODO?: An empty line is also considered to be a word.
* This is equivalant to a WORD in vim terminology.
* This is equivalent to a WORD in vim terminology.
*/
size_t text_longword_end_next(Text*, size_t pos);
size_t text_longword_end_prev(Text*, size_t pos);
Expand All @@ -79,7 +79,7 @@ size_t text_longword_start_prev(Text*, size_t pos);
* A word consists of a sequence of letters, digits and underscores, or a
* sequence of other non-blank characters, separated with white space.
* TODO?: An empty line is also considered to be a word.
* This is equivalant to a word (lowercase) in vim terminology.
* This is equivalent to a word (lowercase) in vim terminology.
*/
size_t text_word_end_next(Text*, size_t pos);
size_t text_word_end_prev(Text*, size_t pos);
Expand Down Expand Up @@ -116,13 +116,13 @@ size_t text_block_start(Text*, size_t pos);
size_t text_block_end(Text*, size_t pos);
size_t text_parenthesis_start(Text*, size_t pos);
size_t text_parenthesis_end(Text*, size_t pos);
/* search coresponding '(', ')', '{', '}', '[', ']', '>', '<', '"', ''' */
/* search corresponding '(', ')', '{', '}', '[', ']', '>', '<', '"', ''' */
size_t text_bracket_match(Text*, size_t pos, const Filerange *limits);
/* same as above but explicitly specify symbols to match */
size_t text_bracket_match_symbol(Text*, size_t pos, const char *symbols, const Filerange *limits);

/* search the given regex pattern in either forward or backward direction,
* starting from pos. does wrap around if no match was found. */
* starting from pos. Does wrap around if no match was found. */
size_t text_search_forward(Text *txt, size_t pos, Regex *regex);
size_t text_search_backward(Text *txt, size_t pos, Regex *regex);

Expand Down
12 changes: 6 additions & 6 deletions text-objects.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#ifndef TEXT_OBJECTS_H
#define TEXT_OBJECTS_H

/* these functions all take a file position. if this position is part of the
* respective text-object, a corresponding range is returned. if there is no
/* these functions all take a file position. If this position is part of the
* respective text-object, a corresponding range is returned. If there is no
* such text-object at the given location, an empty range is returned.
*/

Expand All @@ -13,13 +13,13 @@
Filerange text_object_entire(Text*, size_t pos);
/* word which happens to be at pos without any neighbouring white spaces */
Filerange text_object_word(Text*, size_t pos);
/* includes trailing white spaces. if at pos happens to be a white space
/* includes trailing white spaces. If at pos happens to be a white space
* include all neighbouring leading white spaces and the following word. */
Filerange text_object_word_outer(Text*, size_t pos);
/* find next occurance of `word' (as word not substring) in forward/backward direction */
/* find next occurence of `word' (as word not substring) in forward/backward direction */
Filerange text_object_word_find_next(Text*, size_t pos, const char *word);
Filerange text_object_word_find_prev(Text*, size_t pos, const char *word);
/* find next occurance of a literal string (not regex) in forward/backward direction */
/* find next occurence of a literal string (not regex) in forward/backward direction */
Filerange text_object_find_next(Text *txt, size_t pos, const char *search);
Filerange text_object_find_prev(Text *txt, size_t pos, const char *search);
/* same semantics as above but for a longword (i.e. delimited by white spaces) */
Expand All @@ -44,7 +44,7 @@ Filerange text_object_backtick(Text*, size_t pos);
/* match a search term in either forward or backward direction */
Filerange text_object_search_forward(Text*, size_t pos, Regex*);
Filerange text_object_search_backward(Text*, size_t pos, Regex*);
/* match all lines with same indendation level than the current one */
/* match all lines with same indentation level as the current one */
Filerange text_object_indentation(Text*, size_t pos);

/* extend a range to cover whole lines */
Expand Down
34 changes: 17 additions & 17 deletions text.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* All active pieces chained together form the whole content of the document.
* At the beginning there exists only one piece, spanning the whole document.
* Upon insertion/deletion new pieces will be created to represent the changes.
* Generally pieces are never destroyed, but kept around to peform undo/redo
* Generally pieces are never destroyed, but kept around to perform undo/redo
* operations.
*/
struct Piece {
Expand Down Expand Up @@ -123,7 +123,7 @@ static void lineno_cache_invalidate(LineCache *cache);
static size_t lines_skip_forward(Text *txt, size_t pos, size_t lines, size_t *lines_skiped);
static size_t lines_count(Text *txt, size_t pos, size_t len);

/* stores the given data in a block, allocates a new one if necessary. returns
/* stores the given data in a block, allocates a new one if necessary. Returns
* a pointer to the storage location or NULL if allocation failed. */
static const char *block_store(Text *txt, const char *data, size_t len) {
Block *blk = array_get_ptr(&txt->blocks, array_length(&txt->blocks)-1);
Expand Down Expand Up @@ -167,8 +167,8 @@ static bool cache_contains(Text *txt, Piece *p) {
return found && p->data + p->len == blk->data + blk->len;
}

/* try to insert a chunk of data at a given piece offset. the insertion is only
* performed if the piece is the most recenetly changed one. the legnth of the
/* try to insert a chunk of data at a given piece offset. The insertion is only
* performed if the piece is the most recently changed one. The length of the
* piece, the span containing it and the whole text is adjusted accordingly */
static bool cache_insert(Text *txt, Piece *p, size_t off, const char *data, size_t len) {
if (!cache_contains(txt, p))
Expand All @@ -183,9 +183,9 @@ static bool cache_insert(Text *txt, Piece *p, size_t off, const char *data, size
return true;
}

/* try to delete a chunk of data at a given piece offset. the deletion is only
* performed if the piece is the most recenetly changed one and the whole
* affected range lies within it. the legnth of the piece, the span containing it
/* try to delete a chunk of data at a given piece offset. The deletion is only
* performed if the piece is the most recently changed one and the whole
* affected range lies within it. The length of the piece, the span containing it
* and the whole text is adjusted accordingly */
static bool cache_delete(Text *txt, Piece *p, size_t off, size_t len) {
if (!cache_contains(txt, p))
Expand Down Expand Up @@ -316,9 +316,9 @@ static void piece_init(Piece *p, Piece *prev, Piece *next, const char *data, siz
p->len = len;
}

/* returns the piece holding the text at byte offset pos. if pos happens to
* be at a piece boundry i.e. the first byte of a piece then the previous piece
* to the left is returned with an offset of piece->len. this is convenient for
/* returns the piece holding the text at byte offset pos. If pos happens to
* be at a piece boundary i.e. the first byte of a piece then the previous piece
* to the left is returned with an offset of piece->len. This is convenient for
* modifications to the piece chain where both pieces (the returned one and the
* one following it) are needed, but unsuitable as a public interface.
*
Expand All @@ -335,8 +335,8 @@ static Location piece_get_intern(Text *txt, size_t pos) {
return (Location){ 0 };
}

/* similiar to piece_get_intern but usable as a public API. returns the piece
* holding the text at byte offset pos. never returns a sentinel piece.
/* similiar to piece_get_intern but usable as a public API. Returns the piece
* holding the text at byte offset pos. Never returns a sentinel piece.
* it pos is the end of file (== text_size()) and the file is not empty then
* the last piece holding data is returned.
*/
Expand Down Expand Up @@ -447,8 +447,8 @@ bool text_insert(Text *txt, size_t pos, const char *data, size_t len) {
span_init(&c->new, new, new);
span_init(&c->old, NULL, NULL);
} else {
/* insert into middle of an existing piece, therfore split the old
* piece. that is we have 3 new pieces one containing the content
/* insert into middle of an existing piece, therefore split the old
* piece. That is we have 3 new pieces one containing the content
* before the insertion point then one holding the newly inserted
* text and one holding the content after the insertion point.
*/
Expand Down Expand Up @@ -644,7 +644,7 @@ Block *text_block_mmaped(Text *txt) {
}

/* A delete operation can either start/stop midway through a piece or at
* a boundry. In the former case a new piece is created to represent the
* a boundary. In the former case a new piece is created to represent the
* remaining text before/after the modification point.
*
* /-+ --> +---------+ --> +-----+ --> +-----+ --> +-\
Expand Down Expand Up @@ -683,7 +683,7 @@ bool text_delete(Text *txt, size_t pos, size_t len) {
size_t cur; /* how much has already been deleted */

if (off == p->len) {
/* deletion starts at a piece boundry */
/* deletion starts at a piece boundary */
cur = 0;
before = p;
start = p->next;
Expand All @@ -704,7 +704,7 @@ bool text_delete(Text *txt, size_t pos, size_t len) {
}

if (cur == len) {
/* deletion stops at a piece boundry */
/* deletion stops at a piece boundary */
end = p;
after = p->next;
} else {
Expand Down
14 changes: 7 additions & 7 deletions text.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ enum TextLoadMethod {
*/
TEXT_LOAD_READ,
/**
* Memory map the the file from disk. Use file system / virtual memory
* Memory map the file from disk. Use file system / virtual memory
* subsystem as a caching layer.
* @rst
* .. note:: Load time is (almost) independent of the file size.
* .. warning:: Inplace modifications of the underlying file
* will be reflected in the current text content.
* In particular, truncatenation will raise ``SIGBUS``
* In particular, truncation will raise ``SIGBUS``
* and result in data loss.
* @endrst
*/
Expand Down Expand Up @@ -111,7 +111,7 @@ Text *text_loadat(int dirfd, const char *filename);
*/
Text *text_load_method(const char *filename, enum TextLoadMethod);
Text *text_loadat_method(int dirfd, const char *filename, enum TextLoadMethod);
/** Release all ressources associated with this text instance. */
/** Release all resources associated with this text instance. */
void text_free(Text*);
/**
* @}
Expand Down Expand Up @@ -164,7 +164,7 @@ bool text_appendf(Text*, const char *format, ...) __attribute__((format(printf,
* @{
*/
/**
* Create a text snapshot, that is a vertice in the history graph.
* Create a text snapshot, that is a vertex in the history graph.
*/
bool text_snapshot(Text*);
/**
Expand Down Expand Up @@ -237,7 +237,7 @@ size_t text_bytes_get(const Text*, size_t pos, size_t len, char *buf);
* Fetch text range into newly allocate memory region.
* @param pos The absolute starting position.
* @param len The length in bytes.
* @return A contigious NUL terminated buffer holding the requested range, or
* @return A contiguous NUL terminated buffer holding the requested range, or
* ``NULL`` in error case.
* @rst
* .. warning:: The returned pointer must be freed by the caller.
Expand Down Expand Up @@ -329,7 +329,7 @@ enum TextSaveMethod {
* - File ownership can not be preserved.
* - File group can not be preserved.
* - Directory permissions do not allow creation of a new file.
* - POSXI ACL can not be preserved (if enabled).
* - POSIX ACL can not be preserved (if enabled).
* - SELinux security context can not be preserved (if enabled).
* @endrst
*/
Expand Down Expand Up @@ -362,7 +362,7 @@ bool text_saveat_method(Text*, int dirfd, const char *filename, enum TextSaveMet
* Setup a sequence of write operations.
*
* The returned ``TextSave`` pointer can be used to write multiple, possibly
* non-contigious, file ranges.
* non-contiguous, file ranges.
* @rst
* .. warning:: For every call to ``text_save_begin`` there must be exactly
* one matching call to either ``text_save_commit`` or
Expand Down
2 changes: 1 addition & 1 deletion ui.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

/* enable large file optimization for files larger than: */
#define UI_LARGE_FILE_SIZE (1 << 25)
/* enable large file optimization fo files containing lines longer than: */
/* enable large file optimization for files containing lines longer than: */
#define UI_LARGE_FILE_LINE_SIZE (1 << 16)

typedef struct Ui Ui;
Expand Down
2 changes: 1 addition & 1 deletion view.c
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ void view_draw(View *view) {
cell = (Cell){ .data = "\xEF\xBF\xBD", .len = len, .width = 1 };
} else if (len == (size_t)-2) {
/* not enough bytes available to convert to a
* wide character. advance file position and read
* wide character. Advance file position and read
* another junk into buffer.
*/
rem = text_bytes_get(view->text, pos+prev_cell.len, size, text);
Expand Down
10 changes: 5 additions & 5 deletions view.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ Filerange view_viewport_get(View*);
* @param pos The position to query.
* @param line Will be updated with screen line on which ``pos`` resides.
* @param row Will be updaded with zero based window row on which ``pos`` resides.
* @param col Will be updated with zero based window column which ``pos`` resides.
* @param col Will be updated with zero based window column on which ``pos`` resides.
* @return Whether ``pos`` is visible. If not, the pointer arguments are left unmodified.
*/
bool view_coord_get(View*, size_t pos, Line **line, int *row, int *col);
/** Get position at the start ot the ``n``-th window line, counting from 1. */
/** Get position at the start of the ``n``-th window line, counting from 1. */
size_t view_screenline_goto(View*, int n);
/** Get first screen line. */
Line *view_lines_first(View*);
Expand Down Expand Up @@ -122,7 +122,7 @@ Selection *view_selections_new_force(View*, size_t pos);
/**
* Dispose an existing selection.
* @rst
* .. warning:: Not applicaple for the last existing selection.
* .. warning:: Not applicable for the last existing selection.
* @endrst
*/
bool view_selections_dispose(Selection*);
Expand All @@ -138,7 +138,7 @@ bool view_selections_dispose_force(Selection*);
* Query state of primary selection.
*
* If the primary selection was marked for destruction, return it and
* clear descruction flag.
* clear destruction flag.
*/
Selection *view_selection_disposed(View*);
/** Dispose all but the primary selection. */
Expand Down Expand Up @@ -324,7 +324,7 @@ size_t view_screenline_end(Selection*);
*/
/**
* Move primary selection cursor to the given position.
* Makes sure that position is visisble.
* Makes sure that position is visible.
* @rst
* .. note:: If position was not visible before, we attempt to show
* surrounding context. The viewport will be adjusted such
Expand Down
Loading

0 comments on commit 8000440

Please sign in to comment.