vis

a vi-like editor based on Plan 9's structural regular expressions

git clone https://9o.is/git/vis.git

commit 62ad464e2c5abc71586023fde75eca9a1ef135bf
parent 5df945188d95649d05bc95364b6789864eb5f279
Author: Richard Burke <rich.g.burke@gmail.com>
Date:   Wed, 17 Feb 2016 23:42:45 +0000

Display NUL bytes correctly

Diffstat:
Mview.c | 2+-
Mview.h | 8++++----
2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/view.c b/view.c @@ -560,7 +560,7 @@ void view_draw(View *view) { continue; } else if (len == 0) { /* NUL byte encountered, store it and continue */ - cell = (Cell){ .data = "\x00", .len = 1, .width = 0 }; + cell = (Cell){ .data = "\x00", .len = 1, .width = 2 }; } else { for (size_t i = 0; i < len; i++) cell.data[i] = cur[i]; diff --git a/view.h b/view.h @@ -17,17 +17,17 @@ typedef struct Cursor Cursor; typedef struct Selection Selection; typedef struct { - int width; /* display width i.e. number of columns ocupied by this character */ + int width; /* display width i.e. number of columns occupied by this character */ size_t len; /* number of bytes the character displayed in this cell uses, for - character which use more than 1 column to display, their lenght - is stored in the leftmost cell wheras all following cells + characters which use more than 1 column to display, their length + is stored in the leftmost cell whereas all following cells occupied by the same character have a length of 0. */ char data[16]; /* utf8 encoded character displayed in this cell (might be more than one Unicode codepoint. might also not be the same as in the underlying text, for example tabs get expanded */ unsigned int attr; bool selected; /* whether this cell is part of a selected region */ - bool cursor; /* whether a cursor is currently locaated on the cell */ + bool cursor; /* whether a cursor is currently located on the cell */ } Cell; typedef struct Line Line;