From 2e9ccabcbdee01371b78595d6c7ed56d79bd5079 Mon Sep 17 00:00:00 2001 From: gunboy001 Date: Thu, 21 Nov 2019 23:01:19 +0100 Subject: [PATCH] cleanup --- Sconstruct => Sconstruct.py | 0 src/ste.c | 12 +++++------- 2 files changed, 5 insertions(+), 7 deletions(-) rename Sconstruct => Sconstruct.py (100%) diff --git a/Sconstruct b/Sconstruct.py similarity index 100% rename from Sconstruct rename to Sconstruct.py diff --git a/src/ste.c b/src/ste.c index 7aa7c56..de0578d 100644 --- a/src/ste.c +++ b/src/ste.c @@ -93,9 +93,6 @@ int main (int argc, char *argv[]) /* Set the statusbar left (static) message */ snprintf(t.statusbar, STAT_SIZE, "%s %d lines %dx%d", argv[1], rows.rownum, t.dim.y, t.dim.x); - /* remember the initial row number */ -// int irow = decimalSize(rows.rownum); - /* Main event loop */ int c; while (1) { @@ -154,7 +151,6 @@ int main (int argc, char *argv[]) t.cur.x++; break; } - //if (decimalSize(rows.rownum) - irow) updateInfo(); } /* If by chance i find myself here be sure @@ -441,7 +437,6 @@ void curUpdateRender () t.cur.r_y = 0; } - // x static int i, c; for (c = i = 0, t.cur.r_x = 0; i < t.cur.x; i++) { c = rows.rw[t.cur.y].chars[i]; @@ -544,17 +539,20 @@ int isStart (int c) { return (isUtf(c) && !isCont(c) ? 1 : 0); } -int editorFind (const char* needle, int* y, int* x) +int editorFind (const char* needle, int *y, int *x) { + /* Create a pointer to store the location of the match */ char *res = NULL; - int i, c; + static int i, c; + /* Search trough all the buffer */ for (i = *y + 1; i < rows.rownum; i++) { res = strstr(rows.rw[i].chars, needle); if (res != NULL) break; } if (res == NULL) return 0; + /* If something wa found convert from pointer to yx coodinates */ *y = c = i; for (i = 0; i <= rows.rw[c].size; i++) if (&rows.rw[c].chars[i] == res) break;