tCosmetic changes - sex - libtermbox based text editor
HTML git clone git://z3bra.org/sex
DIR Log
DIR Files
DIR Refs
DIR README
---
DIR commit 9aa344e4aa1683103da76be0df09abd9b6f461c8
DIR parent dcdb608624245c647451aae016c041669f8fe156
HTML Author: z3bra <willyatmailoodotorg>
Date: Sun, 3 Apr 2016 22:54:41 +0200
Cosmetic changes
Rename function for the UI as ui_* instead of tb_*.
Rename struct ln_s to line_s, for consistency sake.
Diffstat:
M sex.c | 29 +++++++++++++++--------------
1 file changed, 15 insertions(+), 14 deletions(-)
---
DIR diff --git a/sex.c b/sex.c
t@@ -15,10 +15,10 @@
#define TAB_WIDTH 8
-struct ln_s {
+struct line_s {
char *p;
size_t len;
- TAILQ_ENTRY(ln_s) entries;
+ TAILQ_ENTRY(line_s) entries;
};
struct file_s {
t@@ -27,12 +27,12 @@ struct file_s {
char *p;
size_t size;
int d;
- struct ln_s *ln;
+ struct line_s *ln;
};
static struct file_s f;
-TAILQ_HEAD(ln_s_head, ln_s) head;
-struct ln_s *cur;
+TAILQ_HEAD(line_s_head, line_s) head;
+struct line_s *cur;
void
cleanup(void)
t@@ -57,7 +57,7 @@ open_file(char *path)
size_t i, last_eol;
int d;
struct stat s;
- struct ln_s *tmp;
+ struct line_s *tmp;
f.path = path;
t@@ -94,7 +94,7 @@ open_file(char *path)
}
ssize_t
-tb_expand_tab(int x, int y, uint8_t tw)
+ui_expand_tab(int x, int y, uint8_t tw)
{
uint8_t i, tabsize = 0;
t@@ -106,7 +106,7 @@ tb_expand_tab(int x, int y, uint8_t tw)
}
void
-tb_print(char *str, int x, int y, int len) {
+ui_print(char *str, int x, int y, int len) {
int n = 0;
while (*str) {
t@@ -114,7 +114,7 @@ tb_print(char *str, int x, int y, int len) {
switch(*str) {
case '\t':
- x += tb_expand_tab(x, y, TAB_WIDTH);
+ x += ui_expand_tab(x, y, TAB_WIDTH);
str++;
break;
default:
t@@ -129,14 +129,15 @@ tb_print(char *str, int x, int y, int len) {
}
void
-tb_redraw(void) {
+ui_redraw(void) {
/* redraw screen */
- struct ln_s *tmp;
+ struct line_s *tmp;
int i = 0;
TAILQ_FOREACH(tmp, &head, entries) {
- tb_print(tmp->p, 0, i++, tmp->len);
+ ui_print(tmp->p, 0, i++, tmp->len);
}
+
tb_present();
}
t@@ -147,7 +148,7 @@ edit(char *path)
struct tb_event ev;
open_file(path);
- tb_redraw();
+ ui_redraw();
while (tb_poll_event(&ev)) {
switch (ev.type) {
t@@ -167,7 +168,7 @@ edit(char *path)
}
if (needs_redraw) {
- tb_redraw();
+ ui_redraw();
needs_redraw = 0;
}
}