euporie 2.8.8__tar.gz → 2.8.10__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 (176) hide show
  1. {euporie-2.8.8 → euporie-2.8.10}/PKG-INFO +1 -1
  2. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/__init__.py +1 -1
  3. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/config.py +5 -2
  4. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/convert/datum.py +2 -2
  5. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/ft/utils.py +6 -2
  6. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/io.py +0 -8
  7. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/layout/containers.py +33 -4
  8. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/renderer.py +0 -12
  9. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/widgets/cell.py +3 -7
  10. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/widgets/inputs.py +5 -3
  11. {euporie-2.8.8 → euporie-2.8.10}/euporie/preview/tabs/notebook.py +4 -1
  12. {euporie-2.8.8 → euporie-2.8.10}/.gitignore +0 -0
  13. {euporie-2.8.8 → euporie-2.8.10}/LICENSE +0 -0
  14. {euporie-2.8.8 → euporie-2.8.10}/README.rst +0 -0
  15. {euporie-2.8.8 → euporie-2.8.10}/euporie/console/__init__.py +0 -0
  16. {euporie-2.8.8 → euporie-2.8.10}/euporie/console/__main__.py +0 -0
  17. {euporie-2.8.8 → euporie-2.8.10}/euporie/console/_commands.py +0 -0
  18. {euporie-2.8.8 → euporie-2.8.10}/euporie/console/_settings.py +0 -0
  19. {euporie-2.8.8 → euporie-2.8.10}/euporie/console/app.py +2 -2
  20. {euporie-2.8.8 → euporie-2.8.10}/euporie/console/py.typed +0 -0
  21. {euporie-2.8.8 → euporie-2.8.10}/euporie/console/tabs/__init__.py +0 -0
  22. {euporie-2.8.8 → euporie-2.8.10}/euporie/console/tabs/console.py +0 -0
  23. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/__main__.py +0 -0
  24. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/_settings.py +0 -0
  25. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/app/__init__.py +0 -0
  26. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/app/_commands.py +0 -0
  27. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/app/_settings.py +0 -0
  28. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/app/app.py +0 -0
  29. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/app/base.py +0 -0
  30. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/app/current.py +0 -0
  31. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/app/cursor.py +0 -0
  32. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/app/dummy.py +0 -0
  33. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/app/launch.py +0 -0
  34. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/bars/__init__.py +0 -0
  35. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/bars/command.py +0 -0
  36. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/bars/menu.py +0 -0
  37. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/bars/search.py +0 -0
  38. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/bars/status.py +0 -0
  39. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/border.py +0 -0
  40. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/clipboard.py +0 -0
  41. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/comm/__init__.py +0 -0
  42. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/comm/base.py +0 -0
  43. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/comm/ipywidgets.py +0 -0
  44. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/comm/registry.py +0 -0
  45. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/commands.py +0 -0
  46. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/completion.py +0 -0
  47. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/convert/__init__.py +0 -0
  48. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/convert/formats/__init__.py +0 -0
  49. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/convert/formats/ansi.py +0 -0
  50. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/convert/formats/base64.py +0 -0
  51. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/convert/formats/common.py +0 -0
  52. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/convert/formats/ft.py +0 -0
  53. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/convert/formats/html.py +0 -0
  54. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/convert/formats/jpeg.py +0 -0
  55. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/convert/formats/markdown.py +0 -0
  56. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/convert/formats/pdf.py +0 -0
  57. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/convert/formats/pil.py +0 -0
  58. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/convert/formats/png.py +0 -0
  59. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/convert/formats/rich.py +0 -0
  60. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/convert/formats/sixel.py +0 -0
  61. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/convert/formats/svg.py +0 -0
  62. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/convert/mime.py +0 -0
  63. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/convert/registry.py +0 -0
  64. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/convert/utils.py +0 -0
  65. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/data_structures.py +0 -0
  66. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/diagnostics.py +0 -0
  67. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/filters.py +0 -0
  68. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/format.py +0 -0
  69. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/ft/__init__.py +0 -0
  70. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/ft/ansi.py +0 -0
  71. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/ft/html.py +0 -0
  72. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/ft/table.py +0 -0
  73. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/graphics.py +0 -0
  74. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/history.py +0 -0
  75. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/inspection.py +0 -0
  76. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/kernel/__init__.py +0 -0
  77. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/kernel/base.py +0 -0
  78. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/kernel/jupyter.py +0 -0
  79. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/kernel/jupyter_manager.py +0 -0
  80. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/kernel/local.py +0 -0
  81. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/key_binding/__init__.py +0 -0
  82. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/key_binding/bindings/__init__.py +0 -0
  83. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/key_binding/bindings/basic.py +0 -0
  84. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/key_binding/bindings/completion.py +0 -0
  85. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/key_binding/bindings/micro.py +0 -0
  86. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/key_binding/bindings/mouse.py +0 -0
  87. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/key_binding/bindings/page_navigation.py +0 -0
  88. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/key_binding/bindings/terminal.py +0 -0
  89. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/key_binding/bindings/vi.py +0 -0
  90. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/key_binding/key_processor.py +0 -0
  91. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/key_binding/micro_state.py +0 -0
  92. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/key_binding/registry.py +0 -0
  93. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/key_binding/utils.py +0 -0
  94. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/key_binding/vi_state.py +0 -0
  95. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/keys.py +0 -0
  96. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/layout/__init__.py +0 -0
  97. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/layout/cache.py +0 -0
  98. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/layout/controls.py +0 -0
  99. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/layout/decor.py +0 -0
  100. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/layout/mouse.py +0 -0
  101. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/layout/print.py +0 -0
  102. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/layout/screen.py +0 -0
  103. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/layout/scroll.py +0 -0
  104. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/lexers.py +0 -0
  105. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/log.py +0 -0
  106. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/lsp.py +0 -0
  107. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/margins.py +0 -0
  108. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/path.py +0 -0
  109. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/processors.py +0 -0
  110. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/py.typed +0 -0
  111. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/pygments.py +0 -0
  112. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/reference.py +0 -0
  113. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/style.py +0 -0
  114. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/suggest.py +0 -0
  115. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/tabs/__init__.py +0 -0
  116. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/tabs/_commands.py +0 -0
  117. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/tabs/_settings.py +0 -0
  118. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/tabs/base.py +0 -0
  119. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/tabs/kernel.py +0 -0
  120. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/tabs/notebook.py +0 -0
  121. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/utils.py +0 -0
  122. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/validation.py +0 -0
  123. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/widgets/__init__.py +0 -0
  124. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/widgets/_settings.py +0 -0
  125. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/widgets/cell_outputs.py +0 -0
  126. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/widgets/decor.py +0 -0
  127. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/widgets/dialog.py +0 -0
  128. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/widgets/display.py +0 -0
  129. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/widgets/file_browser.py +0 -0
  130. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/widgets/formatted_text_area.py +0 -0
  131. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/widgets/forms.py +0 -0
  132. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/widgets/layout.py +0 -0
  133. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/widgets/logo.py +0 -0
  134. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/widgets/menu.py +0 -0
  135. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/widgets/pager.py +0 -0
  136. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/widgets/palette.py +0 -0
  137. {euporie-2.8.8 → euporie-2.8.10}/euporie/core/widgets/tree.py +0 -0
  138. {euporie-2.8.8 → euporie-2.8.10}/euporie/data/desktop/euporie-console.desktop +0 -0
  139. {euporie-2.8.8 → euporie-2.8.10}/euporie/data/desktop/euporie-notebook.desktop +0 -0
  140. {euporie-2.8.8 → euporie-2.8.10}/euporie/hub/__init__.py +0 -0
  141. {euporie-2.8.8 → euporie-2.8.10}/euporie/hub/__main__.py +0 -0
  142. {euporie-2.8.8 → euporie-2.8.10}/euporie/hub/app.py +0 -0
  143. {euporie-2.8.8 → euporie-2.8.10}/euporie/hub/py.typed +0 -0
  144. {euporie-2.8.8 → euporie-2.8.10}/euporie/notebook/__init__.py +0 -0
  145. {euporie-2.8.8 → euporie-2.8.10}/euporie/notebook/__main__.py +0 -0
  146. {euporie-2.8.8 → euporie-2.8.10}/euporie/notebook/_commands.py +0 -0
  147. {euporie-2.8.8 → euporie-2.8.10}/euporie/notebook/_settings.py +0 -0
  148. {euporie-2.8.8 → euporie-2.8.10}/euporie/notebook/app.py +0 -0
  149. {euporie-2.8.8 → euporie-2.8.10}/euporie/notebook/current.py +0 -0
  150. {euporie-2.8.8 → euporie-2.8.10}/euporie/notebook/enums.py +0 -0
  151. {euporie-2.8.8 → euporie-2.8.10}/euporie/notebook/filters.py +0 -0
  152. {euporie-2.8.8 → euporie-2.8.10}/euporie/notebook/py.typed +0 -0
  153. {euporie-2.8.8 → euporie-2.8.10}/euporie/notebook/tabs/__init__.py +0 -0
  154. {euporie-2.8.8 → euporie-2.8.10}/euporie/notebook/tabs/_commands.py +0 -0
  155. {euporie-2.8.8 → euporie-2.8.10}/euporie/notebook/tabs/_settings.py +0 -0
  156. {euporie-2.8.8 → euporie-2.8.10}/euporie/notebook/tabs/display.py +0 -0
  157. {euporie-2.8.8 → euporie-2.8.10}/euporie/notebook/tabs/edit.py +0 -0
  158. {euporie-2.8.8 → euporie-2.8.10}/euporie/notebook/tabs/json.py +0 -0
  159. {euporie-2.8.8 → euporie-2.8.10}/euporie/notebook/tabs/log.py +0 -0
  160. {euporie-2.8.8 → euporie-2.8.10}/euporie/notebook/tabs/notebook.py +0 -0
  161. {euporie-2.8.8 → euporie-2.8.10}/euporie/notebook/widgets/__init__.py +0 -0
  162. {euporie-2.8.8 → euporie-2.8.10}/euporie/notebook/widgets/_commands.py +0 -0
  163. {euporie-2.8.8 → euporie-2.8.10}/euporie/notebook/widgets/_settings.py +0 -0
  164. {euporie-2.8.8 → euporie-2.8.10}/euporie/notebook/widgets/side_bar.py +0 -0
  165. {euporie-2.8.8 → euporie-2.8.10}/euporie/preview/__init__.py +0 -0
  166. {euporie-2.8.8 → euporie-2.8.10}/euporie/preview/__main__.py +0 -0
  167. {euporie-2.8.8 → euporie-2.8.10}/euporie/preview/_settings.py +0 -0
  168. {euporie-2.8.8 → euporie-2.8.10}/euporie/preview/app.py +0 -0
  169. {euporie-2.8.8 → euporie-2.8.10}/euporie/preview/py.typed +0 -0
  170. {euporie-2.8.8 → euporie-2.8.10}/euporie/preview/tabs/__init__.py +0 -0
  171. {euporie-2.8.8 → euporie-2.8.10}/euporie/web/__init__.py +0 -0
  172. {euporie-2.8.8 → euporie-2.8.10}/euporie/web/tabs/__init__.py +0 -0
  173. {euporie-2.8.8 → euporie-2.8.10}/euporie/web/tabs/web.py +0 -0
  174. {euporie-2.8.8 → euporie-2.8.10}/euporie/web/widgets/__init__.py +0 -0
  175. {euporie-2.8.8 → euporie-2.8.10}/euporie/web/widgets/webview.py +0 -0
  176. {euporie-2.8.8 → euporie-2.8.10}/pyproject.toml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: euporie
3
- Version: 2.8.8
3
+ Version: 2.8.10
4
4
  Summary: Euporie is a suite of terminal applications for interacting with Jupyter kernels
5
5
  Project-URL: Documentation, https://euporie.readthedocs.io/en/latest
6
6
  Project-URL: Issues, https://github.com/joouha/euporie/issues
@@ -1,7 +1,7 @@
1
1
  """This package defines the euporie application and its components."""
2
2
 
3
3
  __app_name__ = "euporie"
4
- __version__ = "2.8.8"
4
+ __version__ = "2.8.10"
5
5
  __logo__ = "⚈"
6
6
  __strapline__ = "Jupyter in the terminal"
7
7
  __author__ = "Josiah Outram Halstead"
@@ -32,8 +32,9 @@ from euporie.core.commands import add_cmd, get_cmd
32
32
 
33
33
  if TYPE_CHECKING:
34
34
  from collections.abc import Iterable, Mapping, Sequence
35
- from typing import IO, Any, Callable, ClassVar, Optional
35
+ from typing import Any, Callable, ClassVar, Optional
36
36
 
37
+ from _typeshed import SupportsWrite
37
38
  from prompt_toolkit.filters.base import FilterOrBool
38
39
 
39
40
  from euporie.core.widgets.menu import MenuItem
@@ -58,7 +59,9 @@ class ArgumentParser(argparse.ArgumentParser):
58
59
  super().__init__(*args, **kwargs)
59
60
  self.config = config
60
61
 
61
- def _print_message(self, message: str, file: IO[str] | None = None) -> None:
62
+ def _print_message(
63
+ self, message: str, file: SupportsWrite[str] | None = None
64
+ ) -> None:
62
65
  from prompt_toolkit.formatted_text.base import FormattedText
63
66
  from prompt_toolkit.lexers.pygments import _token_cache
64
67
  from prompt_toolkit.shortcuts.utils import print_formatted_text
@@ -143,7 +143,7 @@ class Datum(Generic[T], metaclass=_MetaDatum):
143
143
  tuple[str, int | None, int | None, str | None, str | None, bool],
144
144
  asyncio.Event,
145
145
  ] = {}
146
- self._finalizer = finalize(self, self._cleanup_datum_sizes, self.hash)
146
+ self._finalizer: finalize = finalize(self, self._cleanup_datum_sizes, self.hash)
147
147
  self._finalizer.atexit = False
148
148
 
149
149
  def __repr__(self) -> str:
@@ -350,7 +350,7 @@ class Datum(Generic[T], metaclass=_MetaDatum):
350
350
  """Get the dimensions of displayable data in pixels.
351
351
 
352
352
  Foreground and background color are set at this point if they are available, as
353
- data conversion outputs are cached and re-used.
353
+ data conversion outputs are cached and reused.
354
354
 
355
355
  Returns:
356
356
  A tuple of the data's width in terminal columns and its aspect ratio, when
@@ -6,7 +6,6 @@ import re
6
6
  from enum import Enum
7
7
  from typing import TYPE_CHECKING, cast
8
8
 
9
- from prompt_toolkit.formatted_text.base import OneStyleAndTextTuple, StyleAndTextTuples
10
9
  from prompt_toolkit.formatted_text.utils import (
11
10
  fragment_list_to_text,
12
11
  split_lines,
@@ -23,6 +22,11 @@ from euporie.core.data_structures import DiBool, DiInt, DiStr
23
22
  if TYPE_CHECKING:
24
23
  from collections.abc import Iterable
25
24
 
25
+ from prompt_toolkit.formatted_text.base import (
26
+ OneStyleAndTextTuple,
27
+ StyleAndTextTuples,
28
+ )
29
+
26
30
  _ZERO_WIDTH_FRAGMENTS = ("[ZeroWidthEscape]", "[ReverseOverwrite]")
27
31
 
28
32
 
@@ -800,7 +804,7 @@ def apply_reverse_overwrites(ft: StyleAndTextTuples) -> StyleAndTextTuples:
800
804
  """Pate `overwrites` over the end of `transformed_line`."""
801
805
  # Remove the ``[ReverseOverwrite]`` from the overwrite fragments
802
806
  top = cast(
803
- StyleAndTextTuples,
807
+ "StyleAndTextTuples",
804
808
  [(x[0].replace("[ReverseOverwrite]", ""), *x[1:]) for x in overwrites],
805
809
  )
806
810
  top_width = fragment_list_width(top)
@@ -184,14 +184,6 @@ class Vt100_Output(PtkVt100_Output):
184
184
  """Disable SGR-pixel mouse positioning."""
185
185
  self.write_raw("\x1b[?1016l")
186
186
 
187
- def enable_private_sixel_colors(self) -> None:
188
- """Enable private color registers for sixel graphics."""
189
- self.write_raw("\x1b[1070h")
190
-
191
- def disable_private_sixel_colors(self) -> None:
192
- """Disable private color registers for sixel graphics."""
193
- self.write_raw("\x1b[1070l")
194
-
195
187
  def enable_extended_keys(self) -> None:
196
188
  """Request extended keys."""
197
189
  # xterm
@@ -1,4 +1,12 @@
1
- """Overrides for PTK containers which only render visible lines."""
1
+ """Overrides for PTK containers with optimized rendering.
2
+
3
+ This module provides enhanced versions of prompt_toolkit containers that:
4
+ - Only render visible lines rather than the entire content
5
+ - Use cached dimension calculations for better performance
6
+ - Support bounded write positions to clip rendering
7
+ - Share padding window instances for efficiency
8
+ - Apply cursor line styles more efficiently
9
+ """
2
10
 
3
11
  from __future__ import annotations
4
12
 
@@ -56,7 +64,11 @@ log = logging.getLogger(__name__)
56
64
 
57
65
 
58
66
  class DimensionTuple(NamedTuple):
59
- """A hashable representation of a PTK :py:class:`Dimension`."""
67
+ """A hashable representation of a PTK :py:class:`Dimension`.
68
+
69
+ This allows caching dimension calculations by making them hashable.
70
+ Used internally by distribute_dimensions() for performance optimization.
71
+ """
60
72
 
61
73
  min: int
62
74
  max: int
@@ -68,7 +80,18 @@ class DimensionTuple(NamedTuple):
68
80
  def distribute_dimensions(
69
81
  size: int, dimensions: tuple[DimensionTuple, ...]
70
82
  ) -> list[int] | None:
71
- """Return the heights for all rows, or None when there is not enough space."""
83
+ """Return the heights/widths for all rows/columns, or None when there is not enough space.
84
+
85
+ This is a cached version of prompt_toolkit's dimension distribution logic that improves
86
+ performance by memoizing calculations based on the input dimensions.
87
+
88
+ Args:
89
+ size: Total size to distribute
90
+ dimensions: Tuple of DimensionTuple objects specifying min/max/preferred sizes
91
+
92
+ Returns:
93
+ List of distributed sizes or None if not enough space
94
+ """
72
95
  if not dimensions:
73
96
  return []
74
97
 
@@ -118,7 +141,13 @@ def distribute_dimensions(
118
141
 
119
142
  @lru_cache(maxsize=None)
120
143
  class DummyContainer(Container):
121
- """Base class for user interface layout."""
144
+ """A minimal container with fixed dimensions.
145
+
146
+ This is a more efficient version of prompt_toolkit's DummyContainer that:
147
+ - Supports explicit width/height
148
+ - Uses caching for better performance
149
+ - Avoids unnecessary style calculations
150
+ """
122
151
 
123
152
  def __init__(self, width: int = 0, height: int = 0) -> None:
124
153
  """Define width and height if any."""
@@ -291,7 +291,6 @@ class Renderer(PtkRenderer):
291
291
  style, output, full_screen, mouse_support, cpr_not_supported_callback
292
292
  )
293
293
  self._extended_keys_enabled = False
294
- self._private_sixel_colors_enabled = False
295
294
  self._sgr_pixel_enabled = False
296
295
  self.extend_height = to_filter(extend_height)
297
296
  self.extend_width = to_filter(extend_width)
@@ -304,10 +303,6 @@ class Renderer(PtkRenderer):
304
303
  output.disable_extended_keys()
305
304
  self._extended_keys_enabled = False
306
305
 
307
- # Disable private sixel colors before resetting the output
308
- output.disable_private_sixel_colors()
309
- self._private_sixel_colors_enabled = False
310
-
311
306
  # Disable sgr pixel mode
312
307
  output.disable_sgr_pixel()
313
308
  self._sgr_pixel_enabled = False
@@ -370,13 +365,6 @@ class Renderer(PtkRenderer):
370
365
  output.enable_extended_keys()
371
366
  self._extended_keys_enabled = True
372
367
 
373
- # Ensable private sixel graphic color registers
374
- if not self._private_sixel_colors_enabled and isinstance(
375
- self.output, Vt100_Output
376
- ):
377
- self.output.enable_private_sixel_colors()
378
- self._private_sixel_colors_enabled = True
379
-
380
368
  # Create screen and write layout to it.
381
369
  size = output.get_size()
382
370
  screen = Screen()
@@ -171,10 +171,7 @@ class Cell:
171
171
  weak_self.kernel_tab.dirty = True
172
172
  weak_self.on_change()
173
173
  # Re-render markdown cells when edited outside of edit mode
174
- if (
175
- weak_self.cell_type == "markdown"
176
- and not weak_self.kernel_tab.in_edit_mode()
177
- ):
174
+ if weak_self.cell_type == "markdown" and not weak_self.kernel_tab.edit_mode:
178
175
  weak_self.output_area.json = weak_self.output_json
179
176
  weak_self.refresh()
180
177
 
@@ -633,10 +630,9 @@ class Cell:
633
630
 
634
631
  """
635
632
  cp = self.input_box.buffer.cursor_position
636
- self._set_input(value)
637
- self.input_box.text = self.json["source"]
638
633
  cp = max(0, min(cp, len(value)))
639
- self.input_box.buffer.cursor_position = cp
634
+ self._set_input(value)
635
+ self.input_box.buffer.document = Document(value, cp)
640
636
 
641
637
  @property
642
638
  def output_json(self) -> list[dict[str, Any]]:
@@ -360,11 +360,13 @@ class KernelInput(TextArea):
360
360
 
361
361
  def reformat(self) -> None:
362
362
  """Reformat the cell's input."""
363
- text = self.buffer.text
363
+ original_text = new_text = self.buffer.text
364
364
  language = self.language
365
365
  for formatter in self.formatters:
366
- text = formatter._format(text, language)
367
- self.buffer.text = text
366
+ new_text = formatter._format(original_text, language)
367
+ # Do not trigger a text-changed event if the reformatting results in no change
368
+ if new_text != original_text:
369
+ self.buffer.text = new_text
368
370
 
369
371
  async def inspect(self, auto: bool = False) -> None:
370
372
  """Get contextual help for the current cursor position in the current cell."""
@@ -145,7 +145,10 @@ class PreviewNotebook(BaseNotebook):
145
145
  cell = self._cell
146
146
  cell_json = self.json["cells"][self.cell_index]
147
147
  cell.json = cell_json
148
- cell.input = cell_json["source"]
148
+ # Update cell text without trigger any "text-changed" callbacks, which are
149
+ # unncesessary in the preview app
150
+ cell._set_input(cell_json["source"])
151
+ cell.input_box.buffer._set_text(cell_json["source"])
149
152
  cell.output_area.json = cell.output_json
150
153
  return cell
151
154
 
File without changes
File without changes
File without changes
@@ -101,8 +101,6 @@ class ConsoleApp(BaseApp):
101
101
 
102
102
  def load_container(self) -> FloatContainer:
103
103
  """Return a container with all opened tabs."""
104
- self.tabs = [Console(self)]
105
-
106
104
  self.command_bar = CommandBar()
107
105
  self.search_bar = SearchBar()
108
106
  self.pager = Pager()
@@ -115,6 +113,8 @@ class ConsoleApp(BaseApp):
115
113
  self.dialogs["shortcuts"] = ShortcutsDialog(self)
116
114
  self.dialogs["confirm"] = ConfirmDialog(self)
117
115
 
116
+ self.tabs = [Console(self)]
117
+
118
118
  return FloatContainer(
119
119
  DisableMouseOnScroll(
120
120
  HSplit(
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