flexablelib-components 3.7.6__tar.gz → 3.7.8__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 (22) hide show
  1. {flexablelib_components-3.7.6/flexablelib_components.egg-info → flexablelib_components-3.7.8}/PKG-INFO +3 -3
  2. {flexablelib_components-3.7.6 → flexablelib_components-3.7.8}/flexablelib_components/__init__.py +1 -1
  3. {flexablelib_components-3.7.6 → flexablelib_components-3.7.8}/flexablelib_components/data.py +2 -1
  4. {flexablelib_components-3.7.6 → flexablelib_components-3.7.8}/flexablelib_components/inputs.py +8 -2
  5. {flexablelib_components-3.7.6 → flexablelib_components-3.7.8}/flexablelib_components/navigation.py +11 -3
  6. {flexablelib_components-3.7.6 → flexablelib_components-3.7.8/flexablelib_components.egg-info}/PKG-INFO +3 -3
  7. flexablelib_components-3.7.8/flexablelib_components.egg-info/requires.txt +2 -0
  8. flexablelib_components-3.7.6/flexablelib_components.egg-info/requires.txt +0 -2
  9. {flexablelib_components-3.7.6 → flexablelib_components-3.7.8}/LICENSE +0 -0
  10. {flexablelib_components-3.7.6 → flexablelib_components-3.7.8}/MANIFEST.in +0 -0
  11. {flexablelib_components-3.7.6 → flexablelib_components-3.7.8}/README.md +0 -0
  12. {flexablelib_components-3.7.6 → flexablelib_components-3.7.8}/flexablelib_components/base.py +0 -0
  13. {flexablelib_components-3.7.6 → flexablelib_components-3.7.8}/flexablelib_components/dates.py +0 -0
  14. {flexablelib_components-3.7.6 → flexablelib_components-3.7.8}/flexablelib_components/display.py +0 -0
  15. {flexablelib_components-3.7.6 → flexablelib_components-3.7.8}/flexablelib_components/media.py +0 -0
  16. {flexablelib_components-3.7.6 → flexablelib_components-3.7.8}/flexablelib_components/overlays.py +0 -0
  17. {flexablelib_components-3.7.6 → flexablelib_components-3.7.8}/flexablelib_components/py.typed +0 -0
  18. {flexablelib_components-3.7.6 → flexablelib_components-3.7.8}/flexablelib_components.egg-info/SOURCES.txt +0 -0
  19. {flexablelib_components-3.7.6 → flexablelib_components-3.7.8}/flexablelib_components.egg-info/dependency_links.txt +0 -0
  20. {flexablelib_components-3.7.6 → flexablelib_components-3.7.8}/flexablelib_components.egg-info/top_level.txt +0 -0
  21. {flexablelib_components-3.7.6 → flexablelib_components-3.7.8}/setup.cfg +0 -0
  22. {flexablelib_components-3.7.6 → flexablelib_components-3.7.8}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flexablelib-components
3
- Version: 3.7.6
3
+ Version: 3.7.8
4
4
  Summary: Interactive terminal components for flexablelib: inputs, dates, tables, forms, menus, tabs, dialogs and more.
5
5
  Home-page: https://github.com/Opus-Perpetuus/flexablelib
6
6
  Author: Benjamin Ramirez
@@ -17,8 +17,8 @@ Classifier: Topic :: Software Development :: User Interfaces
17
17
  Requires-Python: >=3.8
18
18
  Description-Content-Type: text/markdown
19
19
  License-File: LICENSE
20
- Requires-Dist: flexablelib>=3.7.6
21
- Requires-Dist: flexablelib-tui>=3.7.6
20
+ Requires-Dist: flexablelib>=3.7.8
21
+ Requires-Dist: flexablelib-tui>=3.7.8
22
22
  Dynamic: author
23
23
  Dynamic: author-email
24
24
  Dynamic: classifier
@@ -18,7 +18,7 @@ keys to the focused component) and also renders on its own with
18
18
  ``render(width)``. See docs/COMPONENTS.md.
19
19
  """
20
20
 
21
- __version__ = '3.7.6'
21
+ __version__ = '3.7.8'
22
22
 
23
23
  from .base import Theme, DEFAULT_THEME, Input, Box, Button, frame
24
24
  from .inputs import (TextInput, PasswordInput, NumberInput, ExpressionInput,
@@ -351,7 +351,8 @@ class DataTable(_Themed):
351
351
  elif k in ('end', 'G'):
352
352
  self.cursor_row = max(0, len(view) - 1)
353
353
  elif k == 'right':
354
- self.col_offset = min(len(self.columns) - 1, self.col_offset + 1)
354
+ self.col_offset = max(0, min(len(self.columns) - 1,
355
+ self.col_offset + 1))
355
356
  elif k == 'left':
356
357
  self.col_offset = max(0, self.col_offset - 1)
357
358
  elif len(k) == 1 and k.isdigit() and 0 < int(k) <= len(self.columns):
@@ -265,8 +265,14 @@ class TextInput(Input):
265
265
  cursor_col = sum(widths[:self.cursor_pos])
266
266
  if cursor_col < self.scroll_x:
267
267
  self.scroll_x = cursor_col
268
- if cursor_col >= self.scroll_x + avail:
269
- self.scroll_x = cursor_col - avail + 1
268
+ # The whole cursor cell must fit: a wide character (中, 👍) under
269
+ # the cursor takes two columns, and showing only its first column
270
+ # would leave it out of the view along with the cursor.
271
+ cursor_w = widths[self.cursor_pos] \
272
+ if self.cursor_pos < len(widths) else 1
273
+ cursor_w = max(1, min(cursor_w, avail))
274
+ if cursor_col + cursor_w > self.scroll_x + avail:
275
+ self.scroll_x = cursor_col + cursor_w - avail
270
276
  # Never scrolled further than the text needs: once the field is
271
277
  # wide enough again (a resize, a shorter value), it shows from the
272
278
  # start instead of keeping only the tail it showed when narrow.
@@ -6,7 +6,8 @@ the application shell that wires them together.
6
6
  """
7
7
 
8
8
  from flexablelib import _frames as _fx
9
- from flexablelib.layout import _accepts_height, _natural_width, _render_child
9
+ from flexablelib.layout import (_accepts_height, _natural_width, _one_line,
10
+ _render_child)
10
11
 
11
12
  from flexablelib_tui import Key
12
13
 
@@ -90,6 +91,8 @@ class Tabs(_Themed):
90
91
  k = str(key)
91
92
  if k in ('left', 'right'):
92
93
  n = len(self.tabs)
94
+ if not n:
95
+ return False
93
96
  return self.select((self.index + (1 if k == 'right' else -1)) % n)
94
97
  if len(k) == 1 and k.isdigit() and 0 < int(k) <= len(self.tabs):
95
98
  return self.select(int(k) - 1)
@@ -1752,8 +1755,13 @@ class GridView(_Themed):
1752
1755
 
1753
1756
  def draw(self, width, height):
1754
1757
  out = []
1755
- if self.title:
1756
- out.append(self.paint(self.title, 'bold'))
1758
+ if self.title and (height is None or height > 1):
1759
+ # One line no wider than the grid: a newline or a long title
1760
+ # would push the stack past its height or width.
1761
+ title = _one_line(self.title)
1762
+ if _fx.visible_width(title) > width:
1763
+ title = _fx.truncate(title, max(1, width), '\u2026')
1764
+ out.append(self.paint(title, 'bold'))
1757
1765
  room = None if height is None else max(1, height - len(out))
1758
1766
  grid = self.grid()
1759
1767
  text = grid.render(width=width, height=room) if room else \
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flexablelib-components
3
- Version: 3.7.6
3
+ Version: 3.7.8
4
4
  Summary: Interactive terminal components for flexablelib: inputs, dates, tables, forms, menus, tabs, dialogs and more.
5
5
  Home-page: https://github.com/Opus-Perpetuus/flexablelib
6
6
  Author: Benjamin Ramirez
@@ -17,8 +17,8 @@ Classifier: Topic :: Software Development :: User Interfaces
17
17
  Requires-Python: >=3.8
18
18
  Description-Content-Type: text/markdown
19
19
  License-File: LICENSE
20
- Requires-Dist: flexablelib>=3.7.6
21
- Requires-Dist: flexablelib-tui>=3.7.6
20
+ Requires-Dist: flexablelib>=3.7.8
21
+ Requires-Dist: flexablelib-tui>=3.7.8
22
22
  Dynamic: author
23
23
  Dynamic: author-email
24
24
  Dynamic: classifier
@@ -0,0 +1,2 @@
1
+ flexablelib>=3.7.8
2
+ flexablelib-tui>=3.7.8
@@ -1,2 +0,0 @@
1
- flexablelib>=3.7.6
2
- flexablelib-tui>=3.7.6