riched 0.4.2__tar.gz → 0.4.3__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 (29) hide show
  1. {riched-0.4.2 → riched-0.4.3}/AGENTS.md +2 -0
  2. {riched-0.4.2 → riched-0.4.3}/PKG-INFO +1 -1
  3. {riched-0.4.2 → riched-0.4.3}/pyproject.toml +1 -1
  4. {riched-0.4.2 → riched-0.4.3}/src/riched/app.py +2 -3
  5. {riched-0.4.2 → riched-0.4.3}/tests/runner.py +10 -0
  6. {riched-0.4.2 → riched-0.4.3}/tests/test_editor_shortcuts.py +30 -0
  7. {riched-0.4.2 → riched-0.4.3}/uv.lock +1 -1
  8. {riched-0.4.2 → riched-0.4.3}/.gitignore +0 -0
  9. {riched-0.4.2 → riched-0.4.3}/.python-version +0 -0
  10. {riched-0.4.2 → riched-0.4.3}/README.md +0 -0
  11. {riched-0.4.2 → riched-0.4.3}/src/riched/__init__.py +0 -0
  12. {riched-0.4.2 → riched-0.4.3}/src/riched/bindings.yaml +0 -0
  13. {riched-0.4.2 → riched-0.4.3}/src/riched/cli.py +0 -0
  14. {riched-0.4.2 → riched-0.4.3}/src/riched/editor.py +0 -0
  15. {riched-0.4.2 → riched-0.4.3}/src/riched/keybindings.py +0 -0
  16. {riched-0.4.2 → riched-0.4.3}/src/riched/quick_open.py +0 -0
  17. {riched-0.4.2 → riched-0.4.3}/src/riched/screens.py +0 -0
  18. {riched-0.4.2 → riched-0.4.3}/src/riched/settings.py +0 -0
  19. {riched-0.4.2 → riched-0.4.3}/src/riched/syntax.py +0 -0
  20. {riched-0.4.2 → riched-0.4.3}/tests/__init__.py +0 -0
  21. {riched-0.4.2 → riched-0.4.3}/tests/helpers.py +0 -0
  22. {riched-0.4.2 → riched-0.4.3}/tests/test_cli.py +0 -0
  23. {riched-0.4.2 → riched-0.4.3}/tests/test_command_palette.py +0 -0
  24. {riched-0.4.2 → riched-0.4.3}/tests/test_dirty_buffers.py +0 -0
  25. {riched-0.4.2 → riched-0.4.3}/tests/test_file_io.py +0 -0
  26. {riched-0.4.2 → riched-0.4.3}/tests/test_file_tree.py +0 -0
  27. {riched-0.4.2 → riched-0.4.3}/tests/test_footer.py +0 -0
  28. {riched-0.4.2 → riched-0.4.3}/tests/test_quick_open.py +0 -0
  29. {riched-0.4.2 → riched-0.4.3}/tests/test_syntax.py +0 -0
@@ -19,6 +19,8 @@ Use Python 3.12-compatible code with type hints, `from __future__ import annotat
19
19
 
20
20
  Keep key bindings in `src/riched/bindings.yaml`, not hardcoded in Python. The F1 hotkey popup is generated from this YAML and displays one user-facing key per binding, preferring `cmd` aliases over `super`.
21
21
 
22
+ When changing app-level key bindings, test both file-open and no-buffer/directory-start states. For Command-key regressions, verify both Textual names (`cmd+...` and terminal-normalized `super+...`) because Pilot can pass for synthetic keys while a real terminal path or missing app state still breaks. Do not patch Command-key behavior by adding Python-side hardcoded fallbacks; add aliases to `bindings.yaml` and e2e coverage instead.
23
+
22
24
  ## Testing Guidelines
23
25
 
24
26
  Only add end-to-end tests in `tests/`; do not create unit tests. Tests use Textual's Pilot harness and should be named `test_<behavior>`. Keep each test focused on user-visible behavior such as file open/save, dirty prompts, file tree switching, quick-open search/indexing, or syntax highlighting. Use temporary files as existing tests do.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: riched
3
- Version: 0.4.2
3
+ Version: 0.4.3
4
4
  Summary: A Rich library powered editor(hence the name riched) that implements VS Code keybindings in TUI
5
5
  Project-URL: Repository, https://github.com/hoishing/riched
6
6
  Requires-Python: >=3.12
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "riched"
3
- version = "0.4.2"
3
+ version = "0.4.3"
4
4
  description = "A Rich library powered editor(hence the name riched) that implements VS Code keybindings in TUI"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.12"
@@ -545,10 +545,9 @@ class RichedApp(App):
545
545
  def action_toggle_file_tree(self) -> None:
546
546
  editor = self._editor_or_none()
547
547
  if self._is_file_tree_visible():
548
- if editor is None:
549
- return
550
548
  self._hide_file_tree()
551
- editor.focus()
549
+ if editor is not None:
550
+ editor.focus()
552
551
  return
553
552
  self._show_file_tree()
554
553
 
@@ -32,6 +32,7 @@ from .test_editor_shortcuts import (
32
32
  test_cmd_backspace_deletes_selection,
33
33
  test_cmd_backspace_deletes_to_line_start,
34
34
  test_cmd_b_toggles_file_tree,
35
+ test_cmd_b_toggles_file_tree_without_open_buffer,
35
36
  test_cmd_l_repeats_expand_line_selection,
36
37
  test_cmd_l_selects_current_line_with_newline,
37
38
  test_cmd_l_selects_final_line_without_newline,
@@ -56,6 +57,7 @@ from .test_editor_shortcuts import (
56
57
  test_parser_order_super_shift_line_selection_aliases,
57
58
  test_super_l_selects_current_line_alias,
58
59
  test_super_b_toggles_file_tree_alias,
60
+ test_super_b_toggles_file_tree_without_open_buffer,
59
61
  test_super_shift_k_deletes_current_line_alias,
60
62
  test_super_shift_line_selection_aliases,
61
63
  test_undo_multiline_insert_that_removes_scrollbar,
@@ -183,7 +185,15 @@ TESTS: list[tuple[str, Callable[[], Awaitable[None]]]] = [
183
185
  ),
184
186
  ("editor: alt+z toggles word wrap", test_alt_z_toggles_word_wrap),
185
187
  ("app: cmd+b toggles file tree", test_cmd_b_toggles_file_tree),
188
+ (
189
+ "app: cmd+b toggles file tree without open buffer",
190
+ test_cmd_b_toggles_file_tree_without_open_buffer,
191
+ ),
186
192
  ("app: super+b toggles file tree alias", test_super_b_toggles_file_tree_alias),
193
+ (
194
+ "app: super+b toggles file tree without open buffer",
195
+ test_super_b_toggles_file_tree_without_open_buffer,
196
+ ),
187
197
  (
188
198
  "editor: undo multiline insert that removes scrollbar",
189
199
  test_undo_multiline_insert_that_removes_scrollbar,
@@ -201,6 +201,21 @@ async def test_cmd_b_toggles_file_tree() -> None:
201
201
  assert tree.styles.display == "block"
202
202
 
203
203
 
204
+ async def test_cmd_b_toggles_file_tree_without_open_buffer() -> None:
205
+ tmp, _ = _fresh_env()
206
+ app = _make_app(tmp, root=tmp)
207
+ async with app.run_test() as pilot:
208
+ await pilot.pause()
209
+ tree = app.query_one("#file-tree", DirectoryTree)
210
+ assert tree.styles.display == "block"
211
+ await pilot.press("cmd+b")
212
+ await pilot.pause()
213
+ assert tree.styles.display == "none"
214
+ await pilot.press("cmd+b")
215
+ await pilot.pause()
216
+ assert tree.styles.display == "block"
217
+
218
+
204
219
  async def test_super_b_toggles_file_tree_alias() -> None:
205
220
  tmp, _ = _fresh_env()
206
221
  f = tmp / "tree.txt"
@@ -217,6 +232,21 @@ async def test_super_b_toggles_file_tree_alias() -> None:
217
232
  assert tree.styles.display == "block"
218
233
 
219
234
 
235
+ async def test_super_b_toggles_file_tree_without_open_buffer() -> None:
236
+ tmp, _ = _fresh_env()
237
+ app = _make_app(tmp, root=tmp)
238
+ async with app.run_test() as pilot:
239
+ await pilot.pause()
240
+ tree = app.query_one("#file-tree", DirectoryTree)
241
+ assert tree.styles.display == "block"
242
+ await pilot.press("super+b")
243
+ await pilot.pause()
244
+ assert tree.styles.display == "none"
245
+ await pilot.press("super+b")
246
+ await pilot.pause()
247
+ assert tree.styles.display == "block"
248
+
249
+
220
250
  async def test_undo_multiline_insert_that_removes_scrollbar() -> None:
221
251
  tmp, _ = _fresh_env()
222
252
  f = tmp / "undo.txt"
@@ -131,7 +131,7 @@ wheels = [
131
131
 
132
132
  [[package]]
133
133
  name = "riched"
134
- version = "0.4.2"
134
+ version = "0.4.3"
135
135
  source = { editable = "." }
136
136
  dependencies = [
137
137
  { name = "pyyaml" },
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