Introduction
Introduction Statistics Contact Development Disclaimer Help
tMake some things static; add misc comments - ledit - Text editor (WIP)
git clone git://lumidify.org/ledit.git (fast, but not encrypted)
git clone https://lumidify.org/git/ledit.git (encrypted, but very slow)
Log
Files
Refs
README
LICENSE
---
commit 943b164b4033d4e0c1b667bff9c086faf4007e78
parent ae37fbd392114a6d7c301ed5c3bf6473b377d6ef
Author: lumidify <[email protected]>
Date: Thu, 21 Dec 2023 19:45:40 +0100
Make some things static; add misc comments
Diffstat:
M keys_basic.c | 2 +-
M ledit.c | 10 +++++-----
M search.c | 8 ++++++--
M window.c | 5 +++++
4 files changed, 17 insertions(+), 8 deletions(-)
---
diff --git a/keys_basic.c b/keys_basic.c
t@@ -263,7 +263,7 @@ enum key_type {
};
/* note: this is supposed to be global for all views/buffers */
-int paste_buffer_line_based = 0;
+static int paste_buffer_line_based = 0;
static txtbuf *paste_buffer = NULL;
static int last_lines_scrolled = -1;
diff --git a/ledit.c b/ledit.c
t@@ -88,7 +88,7 @@ read_input(void) {
}
/* based partially on OpenBSD's strtonum */
-int
+static int
read_rangeint(long long *ret, int end, long long min, long long max) {
if (test_status.read_cur >= test_status.read_len || test_status.read[t…
return 1;
t@@ -127,7 +127,7 @@ read_rangeint(long long *ret, int end, long long min, long…
return 0;
}
-int
+static int
read_uint(unsigned int *ret, int end) {
long long l;
int err = read_rangeint(&l, end, 0, UINT_MAX);
t@@ -135,7 +135,7 @@ read_uint(unsigned int *ret, int end) {
return err;
}
-int
+static int
read_int(int *ret, int end) {
long long l;
int err = read_rangeint(&l, end, INT_MIN, INT_MAX);
t@@ -143,7 +143,7 @@ read_int(int *ret, int end) {
return err;
}
-int
+static int
read_text(char **text, size_t *text_len) {
if (test_status.read_cur >= test_status.read_len || test_status.read[t…
return 1;
t@@ -181,7 +181,7 @@ read_text(char **text, size_t *text_len) {
return 0;
}
-int
+static int
read_filename(char **text, size_t *text_len) {
if (read_text(text, text_len))
return 1;
diff --git a/search.c b/search.c
t@@ -5,7 +5,9 @@
#include "search.h"
#include "memory.h"
-/* FIXME: make sure only whole utf8 chars are matched */
+/* FIXME: make sure only whole utf8 chars are matched
+ -> actually, isn't this always the case as long as the
+ pattern is valid utf8 because of the structure of utf8? */
static char *last_search = NULL;
static size_t last_search_len = 0;
enum {
t@@ -16,6 +18,8 @@ enum {
void
search_cleanup(void) {
free(last_search);
+ last_search = NULL;
+ last_search_len = 0;
}
void
t@@ -83,7 +87,7 @@ search_forward(ledit_view *view, size_t *line_ret, size_t *b…
}
/* FIXME: this is insanely inefficient */
-/* FIXME: just go backwards char-by-char and compare */
+/* FIXME: just go backwards char-by-char and compare or knuth-morris-pratt */
static search_state
search_backward(ledit_view *view, size_t *line_ret, size_t *byte_ret, size_t *…
*line_ret = view->cur_line;
diff --git a/window.c b/window.c
t@@ -1,3 +1,8 @@
+/* FIXME: replace the bottom bar with generic line entry
+ -> most stuff can be copied from ltk, but I want to think about
+ it a bit more because I don't want to have to maintain two copies
+ of the code, so I want to first turn the necessary parts from ltk
+ into a generic library that can be used here without modifying it */
/* FIXME: check if xim handling still works with multiple windows */
#include <time.h>
#include <math.h>
You are viewing proxied material from lumidify.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.