riched 0.4.3__tar.gz → 0.4.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.
Files changed (29) hide show
  1. {riched-0.4.3 → riched-0.4.4}/PKG-INFO +8 -9
  2. {riched-0.4.3 → riched-0.4.4}/README.md +7 -8
  3. {riched-0.4.3 → riched-0.4.4}/pyproject.toml +1 -1
  4. {riched-0.4.3 → riched-0.4.4}/src/riched/cli.py +6 -5
  5. {riched-0.4.3 → riched-0.4.4}/tests/runner.py +6 -1
  6. {riched-0.4.3 → riched-0.4.4}/tests/test_cli.py +34 -0
  7. {riched-0.4.3 → riched-0.4.4}/uv.lock +1 -1
  8. {riched-0.4.3 → riched-0.4.4}/.gitignore +0 -0
  9. {riched-0.4.3 → riched-0.4.4}/.python-version +0 -0
  10. {riched-0.4.3 → riched-0.4.4}/AGENTS.md +0 -0
  11. {riched-0.4.3 → riched-0.4.4}/src/riched/__init__.py +0 -0
  12. {riched-0.4.3 → riched-0.4.4}/src/riched/app.py +0 -0
  13. {riched-0.4.3 → riched-0.4.4}/src/riched/bindings.yaml +0 -0
  14. {riched-0.4.3 → riched-0.4.4}/src/riched/editor.py +0 -0
  15. {riched-0.4.3 → riched-0.4.4}/src/riched/keybindings.py +0 -0
  16. {riched-0.4.3 → riched-0.4.4}/src/riched/quick_open.py +0 -0
  17. {riched-0.4.3 → riched-0.4.4}/src/riched/screens.py +0 -0
  18. {riched-0.4.3 → riched-0.4.4}/src/riched/settings.py +0 -0
  19. {riched-0.4.3 → riched-0.4.4}/src/riched/syntax.py +0 -0
  20. {riched-0.4.3 → riched-0.4.4}/tests/__init__.py +0 -0
  21. {riched-0.4.3 → riched-0.4.4}/tests/helpers.py +0 -0
  22. {riched-0.4.3 → riched-0.4.4}/tests/test_command_palette.py +0 -0
  23. {riched-0.4.3 → riched-0.4.4}/tests/test_dirty_buffers.py +0 -0
  24. {riched-0.4.3 → riched-0.4.4}/tests/test_editor_shortcuts.py +0 -0
  25. {riched-0.4.3 → riched-0.4.4}/tests/test_file_io.py +0 -0
  26. {riched-0.4.3 → riched-0.4.4}/tests/test_file_tree.py +0 -0
  27. {riched-0.4.3 → riched-0.4.4}/tests/test_footer.py +0 -0
  28. {riched-0.4.3 → riched-0.4.4}/tests/test_quick_open.py +0 -0
  29. {riched-0.4.3 → riched-0.4.4}/tests/test_syntax.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: riched
3
- Version: 0.4.3
3
+ Version: 0.4.4
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
@@ -81,11 +81,10 @@ Editor shortcuts:
81
81
 
82
82
  ## Limitations
83
83
 
84
- - `riched` does not support multi-cursor editing because Textual `TextArea`
85
- currently models one active cursor/selection.
86
- - Some Command-key shortcuts can conflict with Ghostty or terminal-level
87
- bindings, for example `⌘Enter`, `⌘⇧Enter`, `⌘[`, `⌘]`, `⌘⇧P`, `⌘W`, `⌘Q`...etc
88
- - `riched` will not implement key bindings that require users to modify the
89
- Ghostty terminal configuration, since terminal-specific configuration makes
90
- shortcuts harder to document, test, and support consistently across
91
- environments.
84
+ - [Textual](https://github.com/textualize/textual) textarea limitation:
85
+ - no multi-cursor editing
86
+ - no chord hotkey sequence such as `⌘K ⌘S`
87
+
88
+ - Ghostty conflicts:
89
+ - conflicted Ghostty hotkey. eg. `⌘Enter`, `⌘⇧Enter`, `⌘[`, `⌘]`, `⌘⇧P`, `⌘W`, `⌘Q`...etc
90
+ - won't implement features that require modifying Ghostty default config
@@ -70,11 +70,10 @@ Editor shortcuts:
70
70
 
71
71
  ## Limitations
72
72
 
73
- - `riched` does not support multi-cursor editing because Textual `TextArea`
74
- currently models one active cursor/selection.
75
- - Some Command-key shortcuts can conflict with Ghostty or terminal-level
76
- bindings, for example `⌘Enter`, `⌘⇧Enter`, `⌘[`, `⌘]`, `⌘⇧P`, `⌘W`, `⌘Q`...etc
77
- - `riched` will not implement key bindings that require users to modify the
78
- Ghostty terminal configuration, since terminal-specific configuration makes
79
- shortcuts harder to document, test, and support consistently across
80
- environments.
73
+ - [Textual](https://github.com/textualize/textual) textarea limitation:
74
+ - no multi-cursor editing
75
+ - no chord hotkey sequence such as `⌘K ⌘S`
76
+
77
+ - Ghostty conflicts:
78
+ - conflicted Ghostty hotkey. eg. `⌘Enter`, `⌘⇧Enter`, `⌘[`, `⌘]`, `⌘⇧P`, `⌘W`, `⌘Q`...etc
79
+ - won't implement features that require modifying Ghostty default config
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "riched"
3
- version = "0.4.3"
3
+ version = "0.4.4"
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"
@@ -17,7 +17,11 @@ def main() -> int:
17
17
  action="store_true",
18
18
  help="Show the version and exit",
19
19
  )
20
- parser.add_argument("filename", nargs="?", help="File to open (created on save if missing)")
20
+ parser.add_argument(
21
+ "filename",
22
+ nargs="?",
23
+ help="File or folder to open; defaults to the current folder",
24
+ )
21
25
  args = parser.parse_args()
22
26
 
23
27
  if args.version:
@@ -26,10 +30,7 @@ def main() -> int:
26
30
  print(f"riched {version('riched')}")
27
31
  return 0
28
32
 
29
- if args.filename is None:
30
- parser.error("the following arguments are required: filename")
31
-
32
- path = Path(args.filename).expanduser()
33
+ path = Path.cwd() if args.filename is None else Path(args.filename).expanduser()
33
34
  root = path if path.is_dir() else Path.cwd()
34
35
 
35
36
  class ConfiguredRichedApp(RichedApp):
@@ -11,7 +11,11 @@ from .test_command_palette import (
11
11
  test_ctrl_p_does_not_open_command_palette,
12
12
  test_f1_opens_command_palette,
13
13
  )
14
- from .test_cli import test_version_flag_prints_current_version, test_version_flag_rejects_filename
14
+ from .test_cli import (
15
+ test_no_filename_opens_current_folder,
16
+ test_version_flag_prints_current_version,
17
+ test_version_flag_rejects_filename,
18
+ )
15
19
  from .test_dirty_buffers import (
16
20
  test_close_buffer_dirty_shows_wide_modal_then_cancel,
17
21
  test_close_buffer_dirty_space_discard_enters_no_buffer_state,
@@ -96,6 +100,7 @@ TESTS: list[tuple[str, Callable[[], Awaitable[None]]]] = [
96
100
  ("open missing file", test_open_missing_file),
97
101
  ("open directory starts with no buffer", test_open_directory_starts_with_no_buffer),
98
102
  ("save writes file", test_save_writes_file),
103
+ ("cli: no filename opens current folder", test_no_filename_opens_current_folder),
99
104
  ("cli: version flag prints current version", test_version_flag_prints_current_version),
100
105
  ("cli: version flag rejects filename", test_version_flag_rejects_filename),
101
106
  ("command palette: button hidden", test_command_palette_button_is_hidden),
@@ -2,7 +2,9 @@ from __future__ import annotations
2
2
 
3
3
  import subprocess
4
4
  import sys
5
+ import tempfile
5
6
  from importlib.metadata import version
7
+ from pathlib import Path
6
8
 
7
9
 
8
10
  async def test_version_flag_prints_current_version() -> None:
@@ -38,3 +40,35 @@ async def test_version_flag_rejects_filename() -> None:
38
40
  assert result.returncode == 2, result.stdout
39
41
  assert result.stdout == "", result.stdout
40
42
  assert "riched --version does not take arguments" in result.stderr, result.stderr
43
+
44
+
45
+ async def test_no_filename_opens_current_folder() -> None:
46
+ script = """
47
+ from pathlib import Path
48
+ from riched import cli
49
+
50
+ captured = {}
51
+
52
+ class StubApp:
53
+ def __init__(self, path, root):
54
+ captured["path"] = path
55
+ captured["root"] = root
56
+
57
+ def run(self):
58
+ print(f"{captured['path']}|{captured['root']}")
59
+
60
+ cli.RichedApp = StubApp
61
+ raise SystemExit(cli.main())
62
+ """
63
+ tmp = Path(tempfile.mkdtemp(prefix="riched-cli-"))
64
+ result = subprocess.run(
65
+ [sys.executable, "-c", script],
66
+ check=False,
67
+ capture_output=True,
68
+ text=True,
69
+ cwd=tmp,
70
+ )
71
+ cwd = tmp.resolve()
72
+ assert result.returncode == 0, result.stderr
73
+ assert result.stdout == f"{cwd}|{cwd}\n", result.stdout
74
+ assert result.stderr == "", result.stderr
@@ -131,7 +131,7 @@ wheels = [
131
131
 
132
132
  [[package]]
133
133
  name = "riched"
134
- version = "0.4.3"
134
+ version = "0.4.4"
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