Commit f5155786 authored by Benno Schulenberg's avatar Benno Schulenberg
Browse files

tweaks: adjust whitespace and comments after the preceding change

No related merge requests found
Showing with 26 additions and 26 deletions
+26 -26
...@@ -378,14 +378,12 @@ size_t move_mbleft(const char *buf, size_t pos) ...@@ -378,14 +378,12 @@ size_t move_mbleft(const char *buf, size_t pos)
if (use_utf8) { if (use_utf8) {
size_t before, char_len = 0; size_t before, char_len = 0;
/* 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 < 4) if (pos < 4)
before = 0; before = 0;
else { else {
const char *ptr = buf + pos; const char *ptr = buf + pos;
/* Probe for a valid starter byte in the preceding four bytes. */
if ((signed char)*(--ptr) > -65) if ((signed char)*(--ptr) > -65)
before = pos - 1; before = pos - 1;
else if ((signed char)*(--ptr) > -65) else if ((signed char)*(--ptr) > -65)
...@@ -398,6 +396,8 @@ size_t move_mbleft(const char *buf, size_t pos) ...@@ -398,6 +396,8 @@ size_t move_mbleft(const char *buf, size_t pos)
before = pos - 1; before = pos - 1;
} }
/* Move forward again until we reach the original character,
* so we know the length of its preceding the character. */
while (before < pos) { while (before < pos) {
char_len = parse_mbchar(buf + before, NULL, NULL); char_len = parse_mbchar(buf + before, NULL, NULL);
before += char_len; before += char_len;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment