wcwidth 0.8.1__tar.gz → 0.8.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (148) hide show
  1. {wcwidth-0.8.1 → wcwidth-0.8.2}/PKG-INFO +5 -1
  2. {wcwidth-0.8.1 → wcwidth-0.8.2}/docs/intro.rst +4 -0
  3. {wcwidth-0.8.1 → wcwidth-0.8.2}/pyproject.toml +1 -1
  4. {wcwidth-0.8.1 → wcwidth-0.8.2}/tests/test_core.py +6 -0
  5. {wcwidth-0.8.1 → wcwidth-0.8.2}/tests/test_term_overrides.py +7 -0
  6. {wcwidth-0.8.1 → wcwidth-0.8.2}/wcwidth/__init__.py +1 -1
  7. {wcwidth-0.8.1 → wcwidth-0.8.2}/wcwidth/_wcswidth.py +2 -2
  8. {wcwidth-0.8.1 → wcwidth-0.8.2}/.gitignore +0 -0
  9. {wcwidth-0.8.1 → wcwidth-0.8.2}/.pylintrc +0 -0
  10. {wcwidth-0.8.1 → wcwidth-0.8.2}/LICENSE +0 -0
  11. {wcwidth-0.8.1 → wcwidth-0.8.2}/README.rst +0 -0
  12. {wcwidth-0.8.1 → wcwidth-0.8.2}/bin/show-sequences +0 -0
  13. {wcwidth-0.8.1 → wcwidth-0.8.2}/bin/strip-sequences +0 -0
  14. {wcwidth-0.8.1 → wcwidth-0.8.2}/bin/update-tables.py +0 -0
  15. {wcwidth-0.8.1 → wcwidth-0.8.2}/bin/verify-table-integrity.py +0 -0
  16. {wcwidth-0.8.1 → wcwidth-0.8.2}/bin/wcwidth-browser.py +0 -0
  17. {wcwidth-0.8.1 → wcwidth-0.8.2}/bin/wcwidth-libc-comparator.py +0 -0
  18. {wcwidth-0.8.1 → wcwidth-0.8.2}/code_templates/grapheme_override_per_terminal.py.j2 +0 -0
  19. {wcwidth-0.8.1 → wcwidth-0.8.2}/code_templates/grapheme_override_table.py.j2 +0 -0
  20. {wcwidth-0.8.1 → wcwidth-0.8.2}/code_templates/grapheme_registry.py.j2 +0 -0
  21. {wcwidth-0.8.1 → wcwidth-0.8.2}/code_templates/grapheme_table.py.j2 +0 -0
  22. {wcwidth-0.8.1 → wcwidth-0.8.2}/code_templates/python_table.py.j2 +0 -0
  23. {wcwidth-0.8.1 → wcwidth-0.8.2}/code_templates/table_overrides.py.j2 +0 -0
  24. {wcwidth-0.8.1 → wcwidth-0.8.2}/code_templates/term_programs.py.j2 +0 -0
  25. {wcwidth-0.8.1 → wcwidth-0.8.2}/code_templates/unicode_version.rst.j2 +0 -0
  26. {wcwidth-0.8.1 → wcwidth-0.8.2}/code_templates/unicode_versions.py.j2 +0 -0
  27. {wcwidth-0.8.1 → wcwidth-0.8.2}/docs/api.rst +0 -0
  28. {wcwidth-0.8.1 → wcwidth-0.8.2}/docs/conf.py +0 -0
  29. {wcwidth-0.8.1 → wcwidth-0.8.2}/docs/index.rst +0 -0
  30. {wcwidth-0.8.1 → wcwidth-0.8.2}/docs/requirements.txt +0 -0
  31. {wcwidth-0.8.1 → wcwidth-0.8.2}/docs/specs.rst +0 -0
  32. {wcwidth-0.8.1 → wcwidth-0.8.2}/docs/unicode_version.rst +0 -0
  33. {wcwidth-0.8.1 → wcwidth-0.8.2}/requirements-develop.txt +0 -0
  34. {wcwidth-0.8.1 → wcwidth-0.8.2}/requirements-docs.in +0 -0
  35. {wcwidth-0.8.1 → wcwidth-0.8.2}/requirements-tests38.in +0 -0
  36. {wcwidth-0.8.1 → wcwidth-0.8.2}/requirements-tests38.txt +0 -0
  37. {wcwidth-0.8.1 → wcwidth-0.8.2}/requirements-tests39.in +0 -0
  38. {wcwidth-0.8.1 → wcwidth-0.8.2}/requirements-tests39.txt +0 -0
  39. {wcwidth-0.8.1 → wcwidth-0.8.2}/requirements-update.in +0 -0
  40. {wcwidth-0.8.1 → wcwidth-0.8.2}/requirements-update.txt +0 -0
  41. {wcwidth-0.8.1 → wcwidth-0.8.2}/tests/__init__.py +0 -0
  42. {wcwidth-0.8.1 → wcwidth-0.8.2}/tests/conftest.py +0 -0
  43. {wcwidth-0.8.1 → wcwidth-0.8.2}/tests/test_ambiguous.py +0 -0
  44. {wcwidth-0.8.1 → wcwidth-0.8.2}/tests/test_benchmarks.py +0 -0
  45. {wcwidth-0.8.1 → wcwidth-0.8.2}/tests/test_clip.py +0 -0
  46. {wcwidth-0.8.1 → wcwidth-0.8.2}/tests/test_clip_cjk_emoji.py +0 -0
  47. {wcwidth-0.8.1 → wcwidth-0.8.2}/tests/test_clip_overtyping.py +0 -0
  48. {wcwidth-0.8.1 → wcwidth-0.8.2}/tests/test_emojis.py +0 -0
  49. {wcwidth-0.8.1 → wcwidth-0.8.2}/tests/test_grapheme.py +0 -0
  50. {wcwidth-0.8.1 → wcwidth-0.8.2}/tests/test_hyperlink.py +0 -0
  51. {wcwidth-0.8.1 → wcwidth-0.8.2}/tests/test_justify.py +0 -0
  52. {wcwidth-0.8.1 → wcwidth-0.8.2}/tests/test_sgr_state.py +0 -0
  53. {wcwidth-0.8.1 → wcwidth-0.8.2}/tests/test_text_sizing.py +0 -0
  54. {wcwidth-0.8.1 → wcwidth-0.8.2}/tests/test_textwrap.py +0 -0
  55. {wcwidth-0.8.1 → wcwidth-0.8.2}/tests/test_ucslevel.py +0 -0
  56. {wcwidth-0.8.1 → wcwidth-0.8.2}/tests/test_width.py +0 -0
  57. {wcwidth-0.8.1 → wcwidth-0.8.2}/tox.ini +0 -0
  58. {wcwidth-0.8.1 → wcwidth-0.8.2}/ucs-detect/data/AbsoluteTelnetSSH.yaml +0 -0
  59. {wcwidth-0.8.1 → wcwidth-0.8.2}/ucs-detect/data/_linuxfbdev.yaml +0 -0
  60. {wcwidth-0.8.1 → wcwidth-0.8.2}/ucs-detect/data/_syncterm.yaml +0 -0
  61. {wcwidth-0.8.1 → wcwidth-0.8.2}/ucs-detect/data/alacritty.yaml +0 -0
  62. {wcwidth-0.8.1 → wcwidth-0.8.2}/ucs-detect/data/bobcat.yaml +0 -0
  63. {wcwidth-0.8.1 → wcwidth-0.8.2}/ucs-detect/data/conemu.exe.yaml +0 -0
  64. {wcwidth-0.8.1 → wcwidth-0.8.2}/ucs-detect/data/contour.yaml +0 -0
  65. {wcwidth-0.8.1 → wcwidth-0.8.2}/ucs-detect/data/coolretroterm.yaml +0 -0
  66. {wcwidth-0.8.1 → wcwidth-0.8.2}/ucs-detect/data/emoji-test-latest.txt +0 -0
  67. {wcwidth-0.8.1 → wcwidth-0.8.2}/ucs-detect/data/emoji-variation-sequences-latest.txt +0 -0
  68. {wcwidth-0.8.1 → wcwidth-0.8.2}/ucs-detect/data/emoji-zwj-sequences-latest.txt +0 -0
  69. {wcwidth-0.8.1 → wcwidth-0.8.2}/ucs-detect/data/extraterm.yaml +0 -0
  70. {wcwidth-0.8.1 → wcwidth-0.8.2}/ucs-detect/data/foot.yaml +0 -0
  71. {wcwidth-0.8.1 → wcwidth-0.8.2}/ucs-detect/data/ghostty.yaml +0 -0
  72. {wcwidth-0.8.1 → wcwidth-0.8.2}/ucs-detect/data/gnometerminal.yaml +0 -0
  73. {wcwidth-0.8.1 → wcwidth-0.8.2}/ucs-detect/data/hyper.yaml +0 -0
  74. {wcwidth-0.8.1 → wcwidth-0.8.2}/ucs-detect/data/iterm2.yaml +0 -0
  75. {wcwidth-0.8.1 → wcwidth-0.8.2}/ucs-detect/data/kitty.yaml +0 -0
  76. {wcwidth-0.8.1 → wcwidth-0.8.2}/ucs-detect/data/konsole.yaml +0 -0
  77. {wcwidth-0.8.1 → wcwidth-0.8.2}/ucs-detect/data/libvterm.yaml +0 -0
  78. {wcwidth-0.8.1 → wcwidth-0.8.2}/ucs-detect/data/lxterminal.yaml +0 -0
  79. {wcwidth-0.8.1 → wcwidth-0.8.2}/ucs-detect/data/mintty.yaml +0 -0
  80. {wcwidth-0.8.1 → wcwidth-0.8.2}/ucs-detect/data/mlterm.yaml +0 -0
  81. {wcwidth-0.8.1 → wcwidth-0.8.2}/ucs-detect/data/putty.yaml +0 -0
  82. {wcwidth-0.8.1 → wcwidth-0.8.2}/ucs-detect/data/qterminal.yaml +0 -0
  83. {wcwidth-0.8.1 → wcwidth-0.8.2}/ucs-detect/data/rio.yaml +0 -0
  84. {wcwidth-0.8.1 → wcwidth-0.8.2}/ucs-detect/data/rxvtunicode.yaml +0 -0
  85. {wcwidth-0.8.1 → wcwidth-0.8.2}/ucs-detect/data/screen.yaml +0 -0
  86. {wcwidth-0.8.1 → wcwidth-0.8.2}/ucs-detect/data/securecrt.yaml +0 -0
  87. {wcwidth-0.8.1 → wcwidth-0.8.2}/ucs-detect/data/st.yaml +0 -0
  88. {wcwidth-0.8.1 → wcwidth-0.8.2}/ucs-detect/data/tabby.yaml +0 -0
  89. {wcwidth-0.8.1 → wcwidth-0.8.2}/ucs-detect/data/teraterm.yaml +0 -0
  90. {wcwidth-0.8.1 → wcwidth-0.8.2}/ucs-detect/data/terminalapp.yaml +0 -0
  91. {wcwidth-0.8.1 → wcwidth-0.8.2}/ucs-detect/data/terminalexe.yaml +0 -0
  92. {wcwidth-0.8.1 → wcwidth-0.8.2}/ucs-detect/data/terminator.yaml +0 -0
  93. {wcwidth-0.8.1 → wcwidth-0.8.2}/ucs-detect/data/terminology.yaml +0 -0
  94. {wcwidth-0.8.1 → wcwidth-0.8.2}/ucs-detect/data/tmux.yaml +0 -0
  95. {wcwidth-0.8.1 → wcwidth-0.8.2}/ucs-detect/data/vscodeterminal.yaml +0 -0
  96. {wcwidth-0.8.1 → wcwidth-0.8.2}/ucs-detect/data/warp.yaml +0 -0
  97. {wcwidth-0.8.1 → wcwidth-0.8.2}/ucs-detect/data/westonterminal.yaml +0 -0
  98. {wcwidth-0.8.1 → wcwidth-0.8.2}/ucs-detect/data/wezterm.yaml +0 -0
  99. {wcwidth-0.8.1 → wcwidth-0.8.2}/ucs-detect/data/xfce4terminal.yaml +0 -0
  100. {wcwidth-0.8.1 → wcwidth-0.8.2}/ucs-detect/data/xterm.yaml +0 -0
  101. {wcwidth-0.8.1 → wcwidth-0.8.2}/ucs-detect/data/zellij.yaml +0 -0
  102. {wcwidth-0.8.1 → wcwidth-0.8.2}/ucs-detect/data/zutty.yaml +0 -0
  103. {wcwidth-0.8.1 → wcwidth-0.8.2}/wcwidth/_clip.py +0 -0
  104. {wcwidth-0.8.1 → wcwidth-0.8.2}/wcwidth/_constants.py +0 -0
  105. {wcwidth-0.8.1 → wcwidth-0.8.2}/wcwidth/_wcwidth.py +0 -0
  106. {wcwidth-0.8.1 → wcwidth-0.8.2}/wcwidth/_width.py +0 -0
  107. {wcwidth-0.8.1 → wcwidth-0.8.2}/wcwidth/align.py +0 -0
  108. {wcwidth-0.8.1 → wcwidth-0.8.2}/wcwidth/bisearch.py +0 -0
  109. {wcwidth-0.8.1 → wcwidth-0.8.2}/wcwidth/control_codes.py +0 -0
  110. {wcwidth-0.8.1 → wcwidth-0.8.2}/wcwidth/escape_sequences.py +0 -0
  111. {wcwidth-0.8.1 → wcwidth-0.8.2}/wcwidth/grapheme.py +0 -0
  112. {wcwidth-0.8.1 → wcwidth-0.8.2}/wcwidth/hyperlink.py +0 -0
  113. {wcwidth-0.8.1 → wcwidth-0.8.2}/wcwidth/py.typed +0 -0
  114. {wcwidth-0.8.1 → wcwidth-0.8.2}/wcwidth/sgr_state.py +0 -0
  115. {wcwidth-0.8.1 → wcwidth-0.8.2}/wcwidth/table_ambiguous.py +0 -0
  116. {wcwidth-0.8.1 → wcwidth-0.8.2}/wcwidth/table_grapheme.py +0 -0
  117. {wcwidth-0.8.1 → wcwidth-0.8.2}/wcwidth/table_grapheme_overrides/__init__.py +0 -0
  118. {wcwidth-0.8.1 → wcwidth-0.8.2}/wcwidth/table_grapheme_overrides/_known_27e0693f.py +0 -0
  119. {wcwidth-0.8.1 → wcwidth-0.8.2}/wcwidth/table_grapheme_overrides/_known_3d4826b8.py +0 -0
  120. {wcwidth-0.8.1 → wcwidth-0.8.2}/wcwidth/table_grapheme_overrides/_known_45d92e98.py +0 -0
  121. {wcwidth-0.8.1 → wcwidth-0.8.2}/wcwidth/table_grapheme_overrides/_known_4cdf59ce.py +0 -0
  122. {wcwidth-0.8.1 → wcwidth-0.8.2}/wcwidth/table_grapheme_overrides/_known_50bf0759.py +0 -0
  123. {wcwidth-0.8.1 → wcwidth-0.8.2}/wcwidth/table_grapheme_overrides/_known_529fbb4a.py +0 -0
  124. {wcwidth-0.8.1 → wcwidth-0.8.2}/wcwidth/table_grapheme_overrides/_known_5bfac390.py +0 -0
  125. {wcwidth-0.8.1 → wcwidth-0.8.2}/wcwidth/table_grapheme_overrides/_known_813fee16.py +0 -0
  126. {wcwidth-0.8.1 → wcwidth-0.8.2}/wcwidth/table_grapheme_overrides/_known_8589765c.py +0 -0
  127. {wcwidth-0.8.1 → wcwidth-0.8.2}/wcwidth/table_grapheme_overrides/_known_8f94b404.py +0 -0
  128. {wcwidth-0.8.1 → wcwidth-0.8.2}/wcwidth/table_grapheme_overrides/_known_970dbe10.py +0 -0
  129. {wcwidth-0.8.1 → wcwidth-0.8.2}/wcwidth/table_grapheme_overrides/_known_c0a2cdbf.py +0 -0
  130. {wcwidth-0.8.1 → wcwidth-0.8.2}/wcwidth/table_grapheme_overrides/_known_c2157f7e.py +0 -0
  131. {wcwidth-0.8.1 → wcwidth-0.8.2}/wcwidth/table_grapheme_overrides/_known_c3db41c0.py +0 -0
  132. {wcwidth-0.8.1 → wcwidth-0.8.2}/wcwidth/table_grapheme_overrides/_known_da9ceb0a.py +0 -0
  133. {wcwidth-0.8.1 → wcwidth-0.8.2}/wcwidth/table_grapheme_overrides/_known_e08bd75e.py +0 -0
  134. {wcwidth-0.8.1 → wcwidth-0.8.2}/wcwidth/table_grapheme_overrides/_known_e22030f3.py +0 -0
  135. {wcwidth-0.8.1 → wcwidth-0.8.2}/wcwidth/table_grapheme_overrides/_known_fcc05a0f.py +0 -0
  136. {wcwidth-0.8.1 → wcwidth-0.8.2}/wcwidth/table_grapheme_overrides/_known_fd9d4c44.py +0 -0
  137. {wcwidth-0.8.1 → wcwidth-0.8.2}/wcwidth/table_grapheme_overrides/_registry.py +0 -0
  138. {wcwidth-0.8.1 → wcwidth-0.8.2}/wcwidth/table_mc.py +0 -0
  139. {wcwidth-0.8.1 → wcwidth-0.8.2}/wcwidth/table_overrides.py +0 -0
  140. {wcwidth-0.8.1 → wcwidth-0.8.2}/wcwidth/table_term_programs.py +0 -0
  141. {wcwidth-0.8.1 → wcwidth-0.8.2}/wcwidth/table_vs15.py +0 -0
  142. {wcwidth-0.8.1 → wcwidth-0.8.2}/wcwidth/table_vs16.py +0 -0
  143. {wcwidth-0.8.1 → wcwidth-0.8.2}/wcwidth/table_wide.py +0 -0
  144. {wcwidth-0.8.1 → wcwidth-0.8.2}/wcwidth/table_zero.py +0 -0
  145. {wcwidth-0.8.1 → wcwidth-0.8.2}/wcwidth/text_sizing.py +0 -0
  146. {wcwidth-0.8.1 → wcwidth-0.8.2}/wcwidth/textwrap.py +0 -0
  147. {wcwidth-0.8.1 → wcwidth-0.8.2}/wcwidth/unicode_versions.py +0 -0
  148. {wcwidth-0.8.1 → wcwidth-0.8.2}/wcwidth/wcwidth.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wcwidth
3
- Version: 0.8.1
3
+ Version: 0.8.2
4
4
  Summary: Measures the displayed width of unicode strings in a terminal
5
5
  Project-URL: Homepage, https://github.com/jquast/wcwidth
6
6
  Author-email: Jeff Quast <contact@jeffquast.com>
@@ -685,6 +685,10 @@ languages:
685
685
  History
686
686
  =======
687
687
 
688
+ 0.8.2 *2026-06-29*
689
+ * **Bugfix** Do not raise IndexError when given legacy POSIX ``n`` argument to `wcswidth()`_ or
690
+ `wcstwidth()`_ exceed string length without raising IndexError
691
+
688
692
  0.8.1 *2026-06-08*
689
693
  * **Improved** `wcstwidth()`_ with new ``zeroer``, ``narrow_wider``, and ``narrow_zeroer``
690
694
  Corrections_. `PR #226`_
@@ -654,6 +654,10 @@ languages:
654
654
  History
655
655
  =======
656
656
 
657
+ 0.8.2 *2026-06-29*
658
+ * **Bugfix** Do not raise IndexError when given legacy POSIX ``n`` argument to `wcswidth()`_ or
659
+ `wcstwidth()`_ exceed string length without raising IndexError
660
+
657
661
  0.8.1 *2026-06-08*
658
662
  * **Improved** `wcstwidth()`_ with new ``zeroer``, ``narrow_wider``, and ``narrow_zeroer``
659
663
  Corrections_. `PR #226`_
@@ -4,7 +4,7 @@ requires = [ "hatchling" ]
4
4
 
5
5
  [project]
6
6
  name = "wcwidth"
7
- version = "0.8.1" # don't forget to also update wcwidth/__init__.py:__version__
7
+ version = "0.8.2" # don't forget to also update wcwidth/__init__.py:__version__
8
8
  description = "Measures the displayed width of unicode strings in a terminal"
9
9
  readme = "README.rst"
10
10
  keywords = [
@@ -497,6 +497,12 @@ def test_zwj_at_end_of_string():
497
497
  assert wcwidth.wcswidth('a\u200D') == 1
498
498
 
499
499
 
500
+ def test_wcswidth_n_exceeds_length():
501
+ """Verify wcswidth() with n > len(string) does not raise IndexError."""
502
+ assert wcwidth.wcswidth('hello', n=999) == 5
503
+ assert wcwidth.wcswidth('\u30B3\u30F3', n=999) == 4
504
+
505
+
500
506
  def test_soft_hyphen():
501
507
  # Test SOFT HYPHEN, category 'Cf' usually are zero-width, but most
502
508
  # implementations agree to draw it was '1' cell, visually
@@ -418,6 +418,13 @@ def test_get_term_overrides_narrow_wider_still_empty():
418
418
  assert overrides.narrow_wider == ()
419
419
 
420
420
 
421
+ @pytest.mark.parametrize('func', [wcwidth.wcstwidth, wcwidth.width])
422
+ def test_narrow_wider_width(func):
423
+ """Verify width() & wcstwidth() match result of narrow_wider overrides."""
424
+ assert wcwidth.wcswidth('\u261d') == 1
425
+ assert func('\u261d', term_program='kitty') == 2
426
+
427
+
421
428
  @pytest.mark.parametrize('codepoint', [
422
429
  '\u00ad',
423
430
  '\u0600',
@@ -78,4 +78,4 @@ __all__ = ('wcwidth', 'wcswidth', 'wcstwidth', 'width', 'iter_sequences', 'iter_
78
78
  # Using 'hatchling', it does not seem to provide the pyproject.toml nicety, "dynamic = ['version']"
79
79
  # like flit_core, maybe there is some better way but for now we have to duplicate it in both places
80
80
  # Prefer the installed distribution version when available (helps test environments)
81
- __version__ = '0.8.1' # don't forget to also update pyproject.toml:version
81
+ __version__ = '0.8.2' # don't forget to also update pyproject.toml:version
@@ -98,7 +98,7 @@ def wcswidth(
98
98
 
99
99
  _wcwidth = wcwidth if ambiguous_width == 1 else lambda c: wcwidth(c, 'auto', ambiguous_width)
100
100
 
101
- end = len(pwcs) if n is None else n
101
+ end = len(pwcs) if n is None else min(n, len(pwcs))
102
102
  total_width = 0
103
103
  idx = 0
104
104
 
@@ -262,7 +262,7 @@ def wcstwidth(
262
262
  # Select wcwidth call pattern for best lru_cache performance
263
263
  _wcwidth = wcwidth if ambiguous_width == 1 else lambda c: wcwidth(c, 'auto', ambiguous_width)
264
264
 
265
- end = len(pwcs) if n is None else n
265
+ end = len(pwcs) if n is None else min(n, len(pwcs))
266
266
  total_width = 0
267
267
  idx = 0
268
268
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes