nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit f162a6a2ab7c14eef2ad4636a8033e90422c4b3a
parent 5a3de7f117d2b818ca383c2152c4a018b5358cce
Author: Benno Schulenberg <bensberg@justemail.net>
Date:   Tue,  2 May 2017 10:50:43 +0200

chars: valid UTF-8 codes are at most 4 bytes long, so look only that far

This reduces the backwards searching time by a good 20 percent.

Diffstat:
Msrc/chars.c | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/chars.c b/src/chars.c @@ -381,10 +381,10 @@ size_t move_mbleft(const char *buf, size_t pos) /* There is no library function to move backward one multibyte * character. So we just start groping for one at the farthest * possible point. */ - if (pos < MAXCHARLEN) + if (pos < 4) before = 0; else - before = pos - MAXCHARLEN; + before = pos - 4; while (before < pos) { char_len = parse_mbchar(buf + before, NULL, NULL);