diff --git a/src/unicode.c b/src/unicode.c index c2d549b..3b1737e 100644 --- a/src/unicode.c +++ b/src/unicode.c @@ -207,41 +207,6 @@ uint32_t *advance_next32(const uint32_t *s, size_t *invis) -uint32_t *advance32(uint32_t *s, const size_t offset) -{ - if (is_empty(s)) { - return new_empty_string32(); - } - if (offset == 0) { - return s; - } - - size_t count = 0; /* the count of visible characters */ - int visible = 1; /* flag indicating whether the previous char was a visible char */ - const uint32_t *last_esc = NULL; /* pointer to the start of the last escape sequence encountered */ - const uint32_t *rest = s; /* pointer to the next character coming up */ - size_t step_invis = 0; /* unused, but required for advance_next32() call */ - - for (ucs4_t c = s[0]; c != char_nul; c = rest[0]) { - if (c == char_esc) { - last_esc = rest; - visible = 0; - } else { - if (count++ == offset) { - if (!visible && last_esc != NULL) { - return (uint32_t *) last_esc; - } - break; - } - visible = 1; - } - rest = advance_next32(rest, &step_invis); - } - return (uint32_t *) rest; /* may point to zero terminator when offset too large */ -} - - - uint32_t *u32_strconv_from_input(const char *src) { return u32_strconv_from_arg(src, encoding); diff --git a/src/unicode.h b/src/unicode.h index 83ed34f..70de1b0 100644 --- a/src/unicode.h +++ b/src/unicode.h @@ -152,20 +152,6 @@ ucs4_t to_utf32(char ascii); uint32_t *advance_next32(const uint32_t *s, size_t *invis); -/** - * Determine a new position in the given string s with the given offset of visible characters. - * If the character right in front of the target character is invisible, then the pointer is moved to the start of - * that invisible sequence. The purpose is to catch any escape sequences which would for example color the character. - * CHECK This is redundant, bxstrings can do this better. - * - * @param s The pointer to the start position. Is assumed to point either at the ESC at the start of an escape - * sequence, or to be positioned outside an escape sequence. - * @param offset the number of visible character positions to advance the pointer - * @return a pointer to the new position in s, or 0 if the end of the string was reached - */ -uint32_t *advance32(uint32_t *s, const size_t offset); - - /** * Convert a string from the input/output encoding (`encoding` in this .h file) to UTF-32 internal representation. * Memory will be allocated for the converted string.