diff --git a/.gitignore b/.gitignore index 5c2aa09..22d1dc5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ .DS_Store .pytest_cache __pycache__ +dist venv *.c *.egg-info diff --git a/pyproject.toml b/pyproject.toml index 645b531..44c8e49 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "uwcwidth" -version = "0.9" +version = "0.9.1" authors = [{name = "!ZAJC!"}] readme = "README.md" description = "terminal width of Unicode 16.0+Emoji strings in nanoseconds" @@ -16,10 +16,21 @@ classifiers = [ [project.optional-dependencies] test = ["pytest"] +[project.urls] +"Homepage" = "https://github.com/Z4JC/uwcwidth" + [build-system] requires = ["setuptools", "wheel", "Cython"] build-backend = "setuptools.build_meta" +[tool.setuptools.packages.find] +where = ["."] +include = ["uwcwidth"] +exclude = [] +namespaces = false + + + [tool.pytest.ini_options] testpaths = ["tests"] addopts = ["--import-mode=importlib"] diff --git a/uwcwidth/uwcwidth.pyx b/uwcwidth/uwcwidth.pyx index 16db6fd..71358d7 100644 --- a/uwcwidth/uwcwidth.pyx +++ b/uwcwidth/uwcwidth.pyx @@ -53,8 +53,8 @@ cdef uint8_t _is_emoji_modifier(uint32_t wc_last, uint32_t wc) noexcept: if wc_last < 0x1f385: return (wc_last == 0x261d or wc_last == 0x26f9 or 0x270a <= wc_last <= 0x270d) - cdef unsigned int off = (wc_last - 0x1f385) >> 3 - return _EMBTABLE[off] & (1 << (off & 7)) if off < _LEN_EMBTABLE else 0 + cdef unsigned int off = wc_last - 0x1f385, byte = off >> 3, bit = off & 7 + return _EMBTABLE[byte] & (1 << bit) if byte < _LEN_EMBTABLE else 0 # Derived from Rich Felker's musl wcwidth: changed U+E007F to 0 length