Skip to content

Commit

Permalink
0.9.1 bugfix release: correct _EMBTABLE reads
Browse files Browse the repository at this point in the history
  • Loading branch information
Z4JC committed Sep 3, 2024
1 parent c270f0c commit b6ab21a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.DS_Store
.pytest_cache
__pycache__
dist
venv
*.c
*.egg-info
Expand Down
13 changes: 12 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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"]
4 changes: 2 additions & 2 deletions uwcwidth/uwcwidth.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b6ab21a

Please sign in to comment.