Skip to content

Commit 36f3ae5

Browse files
authored
Merge pull request #7 from batrachianai/mammal-fold
fold unified
2 parents 7dd56a6 + 0b32dd5 commit 36f3ae5

12 files changed

Lines changed: 1359 additions & 112 deletions

examples/tdiff.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@ class DiffApp(App):
1212
BINDINGS = [
1313
("space", "toggle('split')", "Toggle split"),
1414
("a", "toggle('annotations')", "Toggle annotations"),
15+
("w", "toggle('wrap')", "Toggle wrap"),
1516
]
1617

1718
split = var(True)
1819
annotations = var(True)
20+
wrap = var(True)
1921

2022
def __init__(self, original: str, modified: str) -> None:
2123
self.original = original
@@ -28,19 +30,27 @@ def compose(self) -> ComposeResult:
2830

2931
async def on_mount(self) -> None:
3032
try:
31-
diff_view = await DiffView.load(self.original, self.modified)
33+
diff_view = await DiffView.load(
34+
self.original,
35+
self.modified,
36+
split=self.split,
37+
annotations=self.annotations,
38+
wrap=self.wrap,
39+
)
3240
except LoadError as error:
3341
self.notify(str(error), title="Failed to load code", severity="error")
3442
else:
35-
diff_view.data_bind(DiffApp.split, DiffApp.annotations)
43+
diff_view.data_bind(DiffApp.split, DiffApp.annotations, DiffApp.wrap)
3644
await self.query_one("#diff-container").mount(diff_view)
3745

3846

3947
if __name__ == "__main__":
4048
import sys
4149

4250
if len(sys.argv) != 3:
43-
print("Usage python tdiff.py PATH1 PATH2\nTry: python tdiff.py example1.rs example2.rs")
51+
print(
52+
"Usage python tdiff.py PATH1 PATH2\nTry: python tdiff.py example1.rs example2.rs"
53+
)
4454
else:
4555
app = DiffApp(sys.argv[1], sys.argv[2])
4656
app.run()

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "textual-diff-view"
3-
version = "0.1.2"
3+
version = "0.1.3"
44
description = "Beautiful Diff view widget for Textual applications"
55
homepage = "https://github.com/batrachianai/textual-diff-view"
66
repository = "https://github.com/batrachianai/textual-diff-view"

0 commit comments

Comments
 (0)