flexablelib 3.5.3__tar.gz → 3.5.4__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.
- {flexablelib-3.5.3 → flexablelib-3.5.4}/CHANGELOG.md +28 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/PKG-INFO +9 -9
- {flexablelib-3.5.3 → flexablelib-3.5.4}/flexablelib/table.py +3 -1
- {flexablelib-3.5.3 → flexablelib-3.5.4}/flexablelib.egg-info/PKG-INFO +9 -9
- {flexablelib-3.5.3 → flexablelib-3.5.4}/flexablelib.egg-info/SOURCES.txt +1 -0
- flexablelib-3.5.4/flexablelib.egg-info/requires.txt +35 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/package.json +1 -1
- flexablelib-3.5.4/tests/test_v354_fixes.py +219 -0
- flexablelib-3.5.3/flexablelib.egg-info/requires.txt +0 -35
- {flexablelib-3.5.3 → flexablelib-3.5.4}/.coveragerc +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/LICENSE +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/MANIFEST.in +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/README.md +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/examples/admin.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/examples/dashboard.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/examples/keys.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/examples/video/demo.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/examples/video/render.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/examples/video/scenes.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/examples/video/thumbnail.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/flexablelib/__init__.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/flexablelib/_frames.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/flexablelib/_images.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/flexablelib/_legacy/__init__.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/flexablelib/_legacy/screen.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/flexablelib/_legacy/widgets.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/flexablelib/_speedups.c +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/flexablelib/_width_tables.h +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/flexablelib/box_topology.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/flexablelib/cells.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/flexablelib/colors.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/flexablelib/columns.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/flexablelib/fast.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/flexablelib/identifiers.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/flexablelib/layout.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/flexablelib/merges.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/flexablelib/options.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/flexablelib/py.typed +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/flexablelib/readers.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/flexablelib/screen.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/flexablelib/style_compositions.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/flexablelib/table_strings.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/flexablelib/text_width.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/flexablelib/utils.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/flexablelib/widgets.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/flexablelib/writers.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/flexablelib.egg-info/dependency_links.txt +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/flexablelib.egg-info/top_level.txt +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/pytest.ini +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/setup.cfg +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/setup.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/style_examples.md +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tests/conftest.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tests/helpers.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tests/test_align_indicators.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tests/test_box_topology.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tests/test_cells.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tests/test_columns.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tests/test_excel.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tests/test_features.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tests/test_issues.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tests/test_merge_edge_matrix.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tests/test_merge_fill.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tests/test_merges.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tests/test_public_api_edges.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tests/test_readme_examples.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tests/test_stress_matrix.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tests/test_style_line_widths.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tests/test_styles.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tests/test_text_width.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tests/test_two_pass_measurement.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tests/test_upstream_issues.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tests/test_v2021_fixes.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tests/test_v210_rows_copy.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tests/test_v2110_fixes.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tests/test_v211_fixes.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tests/test_v213_features.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tests/test_v214_features.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tests/test_v215_features.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tests/test_v216_features.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tests/test_v217_features.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tests/test_v218_features.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tests/test_v219_coverage.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tests/test_v219_fixes.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tests/test_v220_exports.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tests/test_v221_fixes.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tests/test_v222_fixes.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tests/test_v223_fixes.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tests/test_v224_fixes.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tests/test_v230_none.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tests/test_v231_fixes.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tests/test_v232_merge_ansi.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tests/test_v300_style_names.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tests/test_v310_layout.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tests/test_v320_tui.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tests/test_v330_components.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tests/test_v330_frames.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tests/test_v330_layout.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tests/test_v330_tui.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tests/test_v331_formats.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tests/test_v331_panel_width.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tests/test_v331_readers_bom.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tests/test_v331_readers_edges.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tests/test_v331_tabs.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tests/test_v340_accessibility.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tests/test_v340_core.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tests/test_v340_input.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tests/test_v350_images.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tests/test_v350_images_core.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tests/test_v352_fixes.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tests/test_v353_fixes.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tests/wincon_child.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tools/bench_frames.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tools/bench_images.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tools/benchmark.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tools/gen_ascii_table.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tools/generate_width_tables.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tools/image_demo.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tools/pty_check.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tools/readme_gallery.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tools/stress_matrix.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tools/style_examples.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tools/text_to_png.py +0 -0
- {flexablelib-3.5.3 → flexablelib-3.5.4}/tools/wheel_check.py +0 -0
|
@@ -2,6 +2,34 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [3.5.4] - 2026-11-13
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
- **Kitty keyboard reports with out-of-range code points** (`CSI 97;1;99999999u`,
|
|
9
|
+
a shifted key above U+10FFFF) no longer raise `ValueError` from
|
|
10
|
+
`KeyParser.feed()`: the invalid text or shifted code is ignored and the
|
|
11
|
+
key is reported as usual.
|
|
12
|
+
- **Escape followed by a bracketed paste** in the same read: the paste text
|
|
13
|
+
no longer starts with `\x1b[200~`.
|
|
14
|
+
- **Input split across reads** parses like the whole input: `ESC ESC` waits
|
|
15
|
+
for the next byte, so `ESC ESC [A` read in pieces is still `alt+up`
|
|
16
|
+
(a lone double Escape still gives two `escape` keys after the pause).
|
|
17
|
+
- **`MoneyInput` clicks** put the cursor under the clicked character (the
|
|
18
|
+
currency symbol was counted as text, so the cursor landed one place to
|
|
19
|
+
the right); clicking an empty field and then pressing `ctrl+left` no
|
|
20
|
+
longer raises `IndexError`.
|
|
21
|
+
- **`TextInput`** (and every input built on it) keeps a `cursor_pos` set
|
|
22
|
+
out of range from outside within the text instead of raising on word
|
|
23
|
+
moves.
|
|
24
|
+
- **`CoordinatesInput`** renders at widths 1 and 2 (latitude above
|
|
25
|
+
longitude) instead of raising `ValueError`.
|
|
26
|
+
- **An empty `Table` with `show_index=True`** renders like without the index
|
|
27
|
+
instead of raising `TypeError`.
|
|
28
|
+
|
|
29
|
+
### Changed
|
|
30
|
+
- `Key` and `MouseEvent` keep all their fields through `copy`, `deepcopy`
|
|
31
|
+
and `pickle` (a `MouseEvent` could not be copied at all).
|
|
32
|
+
|
|
5
33
|
## [3.5.3] - 2026-11-12
|
|
6
34
|
|
|
7
35
|
### Fixed
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: flexablelib
|
|
3
|
-
Version: 3.5.
|
|
3
|
+
Version: 3.5.4
|
|
4
4
|
Summary: Fast, dependency-free terminal tables for Python: 54 border styles, ANSI colors, cell merges, decimal alignment, width fitting, and CSV/Markdown/HTML/Excel/LaTeX I/O.
|
|
5
5
|
Home-page: https://github.com/Opus-Perpetuus/flexablelib
|
|
6
6
|
Author: Benjamin Ramirez
|
|
@@ -46,15 +46,15 @@ Requires-Dist: openpyxl>=3.0; extra == "excel"
|
|
|
46
46
|
Provides-Extra: html
|
|
47
47
|
Requires-Dist: lxml>=4.0; extra == "html"
|
|
48
48
|
Provides-Extra: tui
|
|
49
|
-
Requires-Dist: flexablelib-tui==3.5.
|
|
49
|
+
Requires-Dist: flexablelib-tui==3.5.4; extra == "tui"
|
|
50
50
|
Provides-Extra: components
|
|
51
|
-
Requires-Dist: flexablelib-components==3.5.
|
|
51
|
+
Requires-Dist: flexablelib-components==3.5.4; extra == "components"
|
|
52
52
|
Provides-Extra: speed
|
|
53
|
-
Requires-Dist: flexablelib-speedups==3.5.
|
|
53
|
+
Requires-Dist: flexablelib-speedups==3.5.4; extra == "speed"
|
|
54
54
|
Provides-Extra: images
|
|
55
55
|
Requires-Dist: Pillow>=8; extra == "images"
|
|
56
|
-
Requires-Dist: flexablelib-tui==3.5.
|
|
57
|
-
Requires-Dist: flexablelib-components==3.5.
|
|
56
|
+
Requires-Dist: flexablelib-tui==3.5.4; extra == "images"
|
|
57
|
+
Requires-Dist: flexablelib-components==3.5.4; extra == "images"
|
|
58
58
|
Provides-Extra: svg
|
|
59
59
|
Requires-Dist: cairosvg>=2.5; extra == "svg"
|
|
60
60
|
Provides-Extra: all
|
|
@@ -62,9 +62,9 @@ Requires-Dist: pandas>=1.0; extra == "all"
|
|
|
62
62
|
Requires-Dist: openpyxl>=3.0; extra == "all"
|
|
63
63
|
Requires-Dist: lxml>=4.0; extra == "all"
|
|
64
64
|
Requires-Dist: Pillow>=8; extra == "all"
|
|
65
|
-
Requires-Dist: flexablelib-tui==3.5.
|
|
66
|
-
Requires-Dist: flexablelib-components==3.5.
|
|
67
|
-
Requires-Dist: flexablelib-speedups==3.5.
|
|
65
|
+
Requires-Dist: flexablelib-tui==3.5.4; extra == "all"
|
|
66
|
+
Requires-Dist: flexablelib-components==3.5.4; extra == "all"
|
|
67
|
+
Requires-Dist: flexablelib-speedups==3.5.4; extra == "all"
|
|
68
68
|
Dynamic: author
|
|
69
69
|
Dynamic: author-email
|
|
70
70
|
Dynamic: classifier
|
|
@@ -3146,8 +3146,10 @@ class Table(object):
|
|
|
3146
3146
|
self.__semi_processed_columns_with_i
|
|
3147
3147
|
)
|
|
3148
3148
|
|
|
3149
|
+
# A table with no columns has nothing to number: the index column
|
|
3150
|
+
# alone would have no cells, so it is drawn as without the index.
|
|
3149
3151
|
return self.__form_string(
|
|
3150
|
-
table_with_i=self.__show_index
|
|
3152
|
+
table_with_i=self.__show_index and len(self.__columns) != 0
|
|
3151
3153
|
)
|
|
3152
3154
|
|
|
3153
3155
|
def __get_string_table_width(self) -> int:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: flexablelib
|
|
3
|
-
Version: 3.5.
|
|
3
|
+
Version: 3.5.4
|
|
4
4
|
Summary: Fast, dependency-free terminal tables for Python: 54 border styles, ANSI colors, cell merges, decimal alignment, width fitting, and CSV/Markdown/HTML/Excel/LaTeX I/O.
|
|
5
5
|
Home-page: https://github.com/Opus-Perpetuus/flexablelib
|
|
6
6
|
Author: Benjamin Ramirez
|
|
@@ -46,15 +46,15 @@ Requires-Dist: openpyxl>=3.0; extra == "excel"
|
|
|
46
46
|
Provides-Extra: html
|
|
47
47
|
Requires-Dist: lxml>=4.0; extra == "html"
|
|
48
48
|
Provides-Extra: tui
|
|
49
|
-
Requires-Dist: flexablelib-tui==3.5.
|
|
49
|
+
Requires-Dist: flexablelib-tui==3.5.4; extra == "tui"
|
|
50
50
|
Provides-Extra: components
|
|
51
|
-
Requires-Dist: flexablelib-components==3.5.
|
|
51
|
+
Requires-Dist: flexablelib-components==3.5.4; extra == "components"
|
|
52
52
|
Provides-Extra: speed
|
|
53
|
-
Requires-Dist: flexablelib-speedups==3.5.
|
|
53
|
+
Requires-Dist: flexablelib-speedups==3.5.4; extra == "speed"
|
|
54
54
|
Provides-Extra: images
|
|
55
55
|
Requires-Dist: Pillow>=8; extra == "images"
|
|
56
|
-
Requires-Dist: flexablelib-tui==3.5.
|
|
57
|
-
Requires-Dist: flexablelib-components==3.5.
|
|
56
|
+
Requires-Dist: flexablelib-tui==3.5.4; extra == "images"
|
|
57
|
+
Requires-Dist: flexablelib-components==3.5.4; extra == "images"
|
|
58
58
|
Provides-Extra: svg
|
|
59
59
|
Requires-Dist: cairosvg>=2.5; extra == "svg"
|
|
60
60
|
Provides-Extra: all
|
|
@@ -62,9 +62,9 @@ Requires-Dist: pandas>=1.0; extra == "all"
|
|
|
62
62
|
Requires-Dist: openpyxl>=3.0; extra == "all"
|
|
63
63
|
Requires-Dist: lxml>=4.0; extra == "all"
|
|
64
64
|
Requires-Dist: Pillow>=8; extra == "all"
|
|
65
|
-
Requires-Dist: flexablelib-tui==3.5.
|
|
66
|
-
Requires-Dist: flexablelib-components==3.5.
|
|
67
|
-
Requires-Dist: flexablelib-speedups==3.5.
|
|
65
|
+
Requires-Dist: flexablelib-tui==3.5.4; extra == "all"
|
|
66
|
+
Requires-Dist: flexablelib-components==3.5.4; extra == "all"
|
|
67
|
+
Requires-Dist: flexablelib-speedups==3.5.4; extra == "all"
|
|
68
68
|
Dynamic: author
|
|
69
69
|
Dynamic: author-email
|
|
70
70
|
Dynamic: classifier
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
|
|
2
|
+
[all]
|
|
3
|
+
pandas>=1.0
|
|
4
|
+
openpyxl>=3.0
|
|
5
|
+
lxml>=4.0
|
|
6
|
+
Pillow>=8
|
|
7
|
+
flexablelib-tui==3.5.4
|
|
8
|
+
flexablelib-components==3.5.4
|
|
9
|
+
flexablelib-speedups==3.5.4
|
|
10
|
+
|
|
11
|
+
[components]
|
|
12
|
+
flexablelib-components==3.5.4
|
|
13
|
+
|
|
14
|
+
[excel]
|
|
15
|
+
openpyxl>=3.0
|
|
16
|
+
|
|
17
|
+
[html]
|
|
18
|
+
lxml>=4.0
|
|
19
|
+
|
|
20
|
+
[images]
|
|
21
|
+
Pillow>=8
|
|
22
|
+
flexablelib-tui==3.5.4
|
|
23
|
+
flexablelib-components==3.5.4
|
|
24
|
+
|
|
25
|
+
[pandas]
|
|
26
|
+
pandas>=1.0
|
|
27
|
+
|
|
28
|
+
[speed]
|
|
29
|
+
flexablelib-speedups==3.5.4
|
|
30
|
+
|
|
31
|
+
[svg]
|
|
32
|
+
cairosvg>=2.5
|
|
33
|
+
|
|
34
|
+
[tui]
|
|
35
|
+
flexablelib-tui==3.5.4
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
"""3.5.4: the key parser survives out-of-range code points in kitty
|
|
2
|
+
reports, an Escape followed by a bracketed paste keeps the paste intact,
|
|
3
|
+
input split anywhere parses like the whole; a click in a MoneyInput puts
|
|
4
|
+
the cursor under the click; CoordinatesInput renders at widths 1 and 2;
|
|
5
|
+
an empty Table with show_index renders; Key and MouseEvent survive copy
|
|
6
|
+
and pickle."""
|
|
7
|
+
|
|
8
|
+
import copy
|
|
9
|
+
import pickle
|
|
10
|
+
import random
|
|
11
|
+
|
|
12
|
+
import pytest
|
|
13
|
+
|
|
14
|
+
from flexablelib import Table
|
|
15
|
+
from flexablelib.text_width import strip_ansi, visible_width
|
|
16
|
+
|
|
17
|
+
T = pytest.importorskip('flexablelib_tui')
|
|
18
|
+
|
|
19
|
+
from flexablelib_tui.keys import (Key, KeyParser, MouseEvent, # noqa: E402
|
|
20
|
+
parse_keys)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def names(keys):
|
|
24
|
+
return [(str(k), k.char) for k in keys]
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def chunked(data, step):
|
|
28
|
+
parser = KeyParser()
|
|
29
|
+
out = []
|
|
30
|
+
for i in range(0, len(data), step):
|
|
31
|
+
out += parser.feed(data[i:i + step])
|
|
32
|
+
return out + parser.flush()
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def sig(keys):
|
|
36
|
+
return [(str(k), k.char, k.event, k.mouse, k.data) for k in keys]
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class TestKittyOutOfRange:
|
|
40
|
+
def test_text_code_point_too_large_is_ignored(self):
|
|
41
|
+
assert names(parse_keys('\x1b[97;1;99999999u')) == [('a', 'a')]
|
|
42
|
+
|
|
43
|
+
def test_shifted_code_point_too_large_is_ignored(self):
|
|
44
|
+
keys = parse_keys('\x1b[97:9999999999;2u')
|
|
45
|
+
assert len(keys) == 1 and str(keys[0]).lower() == 'a'
|
|
46
|
+
|
|
47
|
+
def test_valid_text_still_used(self):
|
|
48
|
+
assert names(parse_keys('\x1b[97;1;241u')) == [('a', 'ñ')]
|
|
49
|
+
|
|
50
|
+
def test_following_keys_still_parsed(self):
|
|
51
|
+
keys = parse_keys('\x1b[97;1;99999999ub')
|
|
52
|
+
assert [str(k) for k in keys] == ['a', 'b']
|
|
53
|
+
|
|
54
|
+
def test_parser_state_survives(self):
|
|
55
|
+
parser = KeyParser(kitty=True)
|
|
56
|
+
parser.feed('\x1b[97:1114112;2;1114112u')
|
|
57
|
+
assert names(parser.feed('x')) == [('x', 'x')]
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
class TestEscapeThenPaste:
|
|
61
|
+
def test_paste_text_kept(self):
|
|
62
|
+
keys = parse_keys('\x1b\x1b[200~hola\x1b[201~')
|
|
63
|
+
assert names(keys) == [('escape', ''), ('paste', 'hola')]
|
|
64
|
+
|
|
65
|
+
def test_split_feed(self):
|
|
66
|
+
data = '\x1b\x1b[200~hola\x1b[201~'
|
|
67
|
+
for step in range(1, len(data) + 1):
|
|
68
|
+
assert names(chunked(data, step)) == \
|
|
69
|
+
[('escape', ''), ('paste', 'hola')], step
|
|
70
|
+
|
|
71
|
+
def test_paste_then_keys(self):
|
|
72
|
+
keys = parse_keys('\x1b\x1b[200~a b\x1b[201~x')
|
|
73
|
+
assert names(keys) == [('escape', ''), ('paste', 'a b'), ('x', 'x')]
|
|
74
|
+
|
|
75
|
+
def test_alt_arrow_unchanged(self):
|
|
76
|
+
assert [str(k) for k in parse_keys('\x1b\x1b[A')] == ['alt+up']
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
class TestSplitInputMatchesWhole:
|
|
80
|
+
def test_escape_escape_waits_for_more(self):
|
|
81
|
+
parser = KeyParser()
|
|
82
|
+
assert parser.feed('\x1b\x1b') == []
|
|
83
|
+
assert parser.pending
|
|
84
|
+
assert [str(k) for k in parser.feed('[A')] == ['alt+up']
|
|
85
|
+
|
|
86
|
+
def test_escape_escape_then_flush(self):
|
|
87
|
+
parser = KeyParser()
|
|
88
|
+
parser.feed('\x1b\x1b')
|
|
89
|
+
assert [str(k) for k in parser.flush()] == ['escape', 'escape']
|
|
90
|
+
|
|
91
|
+
def test_alt_home_split(self):
|
|
92
|
+
assert [str(k) for k in chunked('\x1b\x1b[~', 1)] == \
|
|
93
|
+
[str(k) for k in parse_keys('\x1b\x1b[~')]
|
|
94
|
+
|
|
95
|
+
def test_random_split_points(self):
|
|
96
|
+
pieces = ['\x1b', '[', 'O', '1', ';', '5', 'A', '~', 'u', '<', 'M',
|
|
97
|
+
'm', '\x1b[200~', '\x1b[201~', 'a', 'ñ', '漢', '\t', ':',
|
|
98
|
+
'9', '$', '^', '?', '\x07', 'P', '\\']
|
|
99
|
+
rnd = random.Random(354)
|
|
100
|
+
for _ in range(3000):
|
|
101
|
+
data = ''.join(rnd.choice(pieces) for _ in range(rnd.randint(1, 14)))
|
|
102
|
+
whole = sig(parse_keys(data))
|
|
103
|
+
step = rnd.randint(1, 4)
|
|
104
|
+
assert sig(chunked(data, step)) == whole, (data, step)
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
class TestKeyCopyPickle:
|
|
108
|
+
EVENT = MouseEvent(0, 3, 4, True, 'drag', ('ctrl',))
|
|
109
|
+
|
|
110
|
+
@pytest.mark.parametrize('clone', [
|
|
111
|
+
copy.copy, copy.deepcopy, lambda o: pickle.loads(pickle.dumps(o))])
|
|
112
|
+
def test_mouse_event(self, clone):
|
|
113
|
+
got = clone(self.EVENT)
|
|
114
|
+
assert got == self.EVENT
|
|
115
|
+
assert (got.action, got.mods) == ('drag', ('ctrl',))
|
|
116
|
+
|
|
117
|
+
@pytest.mark.parametrize('clone', [
|
|
118
|
+
copy.copy, copy.deepcopy, lambda o: pickle.loads(pickle.dumps(o))])
|
|
119
|
+
def test_key(self, clone):
|
|
120
|
+
key = Key('ctrl+a', 'x', mouse=self.EVENT, event='repeat',
|
|
121
|
+
data=('dsr', '0'), raw='\x01')
|
|
122
|
+
got = clone(key)
|
|
123
|
+
assert isinstance(got, Key) and got == 'ctrl+a'
|
|
124
|
+
assert (got.char, got.mouse, got.event, got.data, got.raw) == \
|
|
125
|
+
('x', self.EVENT, 'repeat', ('dsr', '0'), '\x01')
|
|
126
|
+
assert got.mouse.action == 'drag'
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
class TestEmptyTableWithIndex:
|
|
130
|
+
def test_renders_like_without_index(self):
|
|
131
|
+
plain = Table()
|
|
132
|
+
indexed = Table()
|
|
133
|
+
indexed.show_index = True
|
|
134
|
+
assert str(indexed) == str(plain)
|
|
135
|
+
|
|
136
|
+
def test_paginate(self):
|
|
137
|
+
table = Table()
|
|
138
|
+
table.show_index = True
|
|
139
|
+
assert list(table.paginate()) == [str(Table())]
|
|
140
|
+
|
|
141
|
+
def test_headers_only_keep_index(self):
|
|
142
|
+
table = Table(headers=['a', 'b'])
|
|
143
|
+
table.show_index = True
|
|
144
|
+
assert ' i ' in strip_ansi(str(table))
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
C = pytest.importorskip('flexablelib_components')
|
|
148
|
+
|
|
149
|
+
from flexablelib_tui import App # noqa: E402
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
def click(app, x, y):
|
|
153
|
+
app.dispatch(Key('mouse', mouse=MouseEvent(0, x, y, True, 'press')))
|
|
154
|
+
app.dispatch(Key('mouse', mouse=MouseEvent(0, x, y, False, 'release')))
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
class TestMoneyInputClick:
|
|
158
|
+
def setup_method(self):
|
|
159
|
+
self.money = C.MoneyInput(label='Monto', value=1234)
|
|
160
|
+
self.app = App(body=C.Stack([self.money]), mouse=True)
|
|
161
|
+
self.app.run(keys=[], size=(30, 4))
|
|
162
|
+
# '› $1234.00': the marker and a space, then the symbol at x=2.
|
|
163
|
+
assert self.app.origin(self.money) == (0, 0)
|
|
164
|
+
|
|
165
|
+
def test_click_on_digit_puts_cursor_before_it(self):
|
|
166
|
+
click(self.app, 3, 1) # the '1'
|
|
167
|
+
assert self.money.cursor_pos == 0
|
|
168
|
+
click(self.app, 5, 1) # the '3'
|
|
169
|
+
assert self.money.cursor_pos == 2
|
|
170
|
+
|
|
171
|
+
def test_click_on_symbol_goes_to_start(self):
|
|
172
|
+
click(self.app, 2, 1)
|
|
173
|
+
assert self.money.cursor_pos == 0
|
|
174
|
+
|
|
175
|
+
def test_typing_after_click_inserts_there(self):
|
|
176
|
+
click(self.app, 4, 1) # the '2'
|
|
177
|
+
self.app.dispatch(Key('9', '9'))
|
|
178
|
+
assert self.money.text.startswith('192')
|
|
179
|
+
|
|
180
|
+
def test_click_past_end_of_empty_input(self):
|
|
181
|
+
money = C.MoneyInput(label='m')
|
|
182
|
+
app = App(body=C.Stack([money]), mouse=True)
|
|
183
|
+
app.run(keys=[], size=(30, 4))
|
|
184
|
+
click(app, 6, 1)
|
|
185
|
+
assert money.cursor_pos == 0
|
|
186
|
+
for name in ('ctrl+left', 'ctrl+right', 'ctrl+w', 'backspace'):
|
|
187
|
+
app.dispatch(Key(name)) # used to raise IndexError
|
|
188
|
+
app.render(30, 4)
|
|
189
|
+
assert money.text == ''
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
class TestCursorOutOfRange:
|
|
193
|
+
@pytest.mark.parametrize('name', ['ctrl+left', 'ctrl+right', 'ctrl+w',
|
|
194
|
+
'alt+b', 'alt+f', 'backspace', 'left',
|
|
195
|
+
'delete', 'ctrl+k'])
|
|
196
|
+
def test_cursor_set_past_the_text(self, name):
|
|
197
|
+
field = C.TextInput(value='uno dos')
|
|
198
|
+
field.cursor_pos = 50
|
|
199
|
+
field.handle_key(Key(name))
|
|
200
|
+
assert 0 <= field.cursor_pos <= len(field.text)
|
|
201
|
+
|
|
202
|
+
def test_negative_cursor(self):
|
|
203
|
+
field = C.TextInput(value='uno')
|
|
204
|
+
field.cursor_pos = -4
|
|
205
|
+
field.handle_key(Key('x', 'x'))
|
|
206
|
+
assert field.text == 'xuno'
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
class TestCoordinatesNarrow:
|
|
210
|
+
@pytest.mark.parametrize('width', [1, 2, 3, 4, 10])
|
|
211
|
+
def test_renders_within_width(self, width):
|
|
212
|
+
field = C.CoordinatesInput(label='Ubicación', value=(20.5, -103.2))
|
|
213
|
+
lines = field.render(width).split('\n')
|
|
214
|
+
assert all(visible_width(strip_ansi(l)) <= width for l in lines)
|
|
215
|
+
|
|
216
|
+
def test_narrow_stacks_both_fields(self):
|
|
217
|
+
field = C.CoordinatesInput(label='c')
|
|
218
|
+
assert len(field.render(2).split('\n')) > \
|
|
219
|
+
len(field.render(20).split('\n'))
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
[all]
|
|
3
|
-
pandas>=1.0
|
|
4
|
-
openpyxl>=3.0
|
|
5
|
-
lxml>=4.0
|
|
6
|
-
Pillow>=8
|
|
7
|
-
flexablelib-tui==3.5.3
|
|
8
|
-
flexablelib-components==3.5.3
|
|
9
|
-
flexablelib-speedups==3.5.3
|
|
10
|
-
|
|
11
|
-
[components]
|
|
12
|
-
flexablelib-components==3.5.3
|
|
13
|
-
|
|
14
|
-
[excel]
|
|
15
|
-
openpyxl>=3.0
|
|
16
|
-
|
|
17
|
-
[html]
|
|
18
|
-
lxml>=4.0
|
|
19
|
-
|
|
20
|
-
[images]
|
|
21
|
-
Pillow>=8
|
|
22
|
-
flexablelib-tui==3.5.3
|
|
23
|
-
flexablelib-components==3.5.3
|
|
24
|
-
|
|
25
|
-
[pandas]
|
|
26
|
-
pandas>=1.0
|
|
27
|
-
|
|
28
|
-
[speed]
|
|
29
|
-
flexablelib-speedups==3.5.3
|
|
30
|
-
|
|
31
|
-
[svg]
|
|
32
|
-
cairosvg>=2.5
|
|
33
|
-
|
|
34
|
-
[tui]
|
|
35
|
-
flexablelib-tui==3.5.3
|
|
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
|
|
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
|
|
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
|