Introduction
Introduction Statistics Contact Development Disclaimer Help
tFix bug - 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 d05c901052dbfd84f4653ac95918871b4d4c8f5b
parent 53f769b1d999f6964bc2431b316cf07a3b8166ec
Author: lumidify <[email protected]>
Date: Sun, 17 Jul 2022 18:25:43 +0200
Fix bug
Diffstat:
M util.c | 6 +++---
M view.c | 1 +
2 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/util.c b/util.c
t@@ -52,9 +52,9 @@ sort_range(size_t *l1, size_t *b1, size_t *l2, size_t *b2) {
int
str_array_equal(char *terminated, char *array, size_t len) {
if (!strncmp(terminated, array, len)) {
- /* 'terminated' and 'array' are equal for the first 'len'
- characters, so this index in 'terminated' must exist */
- return terminated[len] == '\0';
+ /* this is kind of inefficient, but there's no way to know
+ otherwise if strncmp just stopped comparing after a '\0' */
+ return strlen(terminated) == len;
}
return 0;
}
diff --git a/view.c b/view.c
t@@ -701,6 +701,7 @@ line_prev_bigword(
int found_word = 0;
if (char_index > (size_t)nattrs - 1)
char_index = (size_t)nattrs - 1;
+ /* FIXME: use for (size_t i = ...; i-- > 0;) everywhere */
/* this is a bit weird because size_t can't be negative */
for (size_t i = char_index; i > 0; i--) {
if (!found_word && !attrs[i-1].is_white) {
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.