Commit f6eb832
Refactor: extract shared helpers, deduplicate views (#35)
* Quick-win refactors: extract helpers, fix grammar, use Side enum
- Extract draw_gutter_band helper to deduplicate cairo band drawing
- Extract is_binary helper in file I/O code
- Extract find_window helper replacing inline root/downcast pattern
- Extract git_show helper to deduplicate head_content/stage_content
- Replace is_left:bool with Side enum in chunk_map/diff_state
- Fix "1 changes" grammar bug → "1 change"
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Wire nav buttons to GActions, fix merge toolbar label jitter
- Replace duplicated button connect_clicked handlers with thin
wrappers that delegate to the corresponding GActions (-272 lines)
- Add grab_focus() to action handlers so keyboard focus follows
navigation (clone-first pattern to avoid RefCell double-borrow)
- Set fixed width_chars on chunk/conflict labels in merge toolbar
to prevent layout shift when label text changes
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Extract shared key bindings, chunk map helper, fix viewport indicator
- Extract map_key_to_action + KeyBindings struct to deduplicate ~120
lines of key handler logic between diff_view and merge_view
- Extract create_chunk_map helper to deduplicate chunk map setup
- Simplify scroll redraw wiring with loops
- Fix chunk map viewport indicator using widget foreground color
instead of editor scheme to detect dark/light GTK theme
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Deduplicate dir_window focus handlers and copy actions
- Parameterize focus handlers with (own_view, other_view, is_left) loop
- Parameterize copy actions with (name, src_dir, dst_dir, status) loop
- Replace inline root/downcast patterns with find_window helper
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Split build_new_comparison_tab, extract tab/scroll helpers
- Extract make_closeable_tab_label and display_name helpers
- Extract open_merge_comparison_tab (merge_view.rs) and
open_dir_comparison_tab (dir_window.rs) paralleling open_file_diff_paths
- Simplify build_new_comparison_tab from 332 to ~160 lines
- Move setup_scroll_sync_3way from merge_view.rs to scroll_sync.rs
- Extract sync_hscrolls helper, deduplicating horizontal sync wiring
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Add context menu row targeting test case to TESTING.md
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix clippy warnings, formatting, and missing blank-path guard
- Move DIFF_KEYS and MERGE_KEYS statics to module level (clippy
items_after_statements)
- Add is_blank_path guard in merge view open-externally action
- Run cargo +nightly fmt on files committed without formatting
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix reference cycles in scroll sync and page-removed handler
- sync_hscrolls: capture Adjustments instead of full ScrolledWindows to
avoid holding strong refs to pane widgets in signal closures
- open_dir_comparison_tab: use weak ref for widget in page-removed
handler and disconnect the signal after it fires to prevent handler
accumulation and widget leaks
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Add dbus-run-session to test-release and document required UI test packages
Wrap pytest in dbus-run-session so AT-SPI works in containers.
List all system packages needed to run the UI integration tests.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix collapse-all segfault and disable context menu on missing-side files
- Collapse-all iterated with a pre-computed bound; collapsing rows
removed children and shrank the model, causing out-of-bounds access.
Fixed by iterating in reverse.
- Context menu actions (Delete, Copy, Open Externally, Copy Path) were
available on the pane where a file doesn't exist, leading to wrong-side
operations. Now all per-file actions are disabled on the missing side.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Add collapse/expand all toolbar buttons, canonicalize dir header tooltips
- Add linked collapse-all / expand-all button pair to directory toolbar
- Canonicalize directory paths so pane header tooltips show full absolute paths
- Update TESTING.md with collapse/expand, missing-side context menu test cases
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Add copy-path buttons to directory pane headers
Frameless edit-copy-symbolic button next to each header label copies the
full absolute directory path to the clipboard. Path tracks swaps.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Left-align modification time columns in directory comparison
Bold text on "changed" rows made right-aligned dates shift relative to
non-bold rows. Switch date columns to left-alignment (sizes stay
right-aligned) and widen from 180px to 200px.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Make directory comparison columns resizable
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Show conflict chunks in red on merge view chunk map strips
Pass conflict flags through to chunk map drawing so chunks that overlap
between left and right sides render with band_conflict() color instead
of the regular blue/green.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix Replace All modifying read-only buffers in merge view
Replace All now skips non-editable TextViews, so in 3-way merge it only
replaces in the middle (editable) buffer. Updated TESTING.md to match.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Return focus to active pane when closing find bar
Clone the TextView out of the RefCell before calling grab_focus() to
avoid a borrow conflict — grab_focus() triggers the focus-enter handler
which needs borrow_mut() on the same RefCell.
Also fix Replace All modifying read-only buffers in merge view: now
skips non-editable TextViews.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Add Extra column, Unstage action, and stage-conflict warning to VCS view
- Parse staged/partially-staged state from porcelain XY bytes
- Skip staged detection for conflict entries (XY is conflict type, not
index/worktree status)
- Add "Extra" column showing Staged/Partially staged
- Add "Unstage" context menu action (git restore --staged)
- Stage on conflicted file shows confirmation dialog
- Enable/disable Stage vs Unstage based on file state
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* bump
* fmt
* bump to 0.7.1
* Fix clippy warnings and Copilot review comments
- Add #[must_use] to unstage_file
- Add #[allow(too_many_arguments)] to draw_chunk_map
- Add -- argument terminator in stage_file and unstage_file
- Distinguish fully staged from partially staged for Stage action
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent 36b42f8 commit f6eb832
17 files changed
Lines changed: 1041 additions & 1270 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
194 | 194 | | |
195 | 195 | | |
196 | 196 | | |
197 | | - | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
198 | 214 | | |
199 | 215 | | |
200 | 216 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
| 70 | + | |
| 71 | + | |
71 | 72 | | |
72 | 73 | | |
73 | 74 | | |
| |||
129 | 130 | | |
130 | 131 | | |
131 | 132 | | |
| 133 | + | |
| 134 | + | |
132 | 135 | | |
133 | 136 | | |
134 | 137 | | |
| |||
145 | 148 | | |
146 | 149 | | |
147 | 150 | | |
| 151 | + | |
| 152 | + | |
148 | 153 | | |
149 | 154 | | |
150 | 155 | | |
151 | 156 | | |
152 | 157 | | |
| 158 | + | |
153 | 159 | | |
154 | 160 | | |
155 | | - | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
156 | 164 | | |
157 | 165 | | |
158 | 166 | | |
| |||
181 | 189 | | |
182 | 190 | | |
183 | 191 | | |
| 192 | + | |
184 | 193 | | |
185 | 194 | | |
186 | 195 | | |
| |||
219 | 228 | | |
220 | 229 | | |
221 | 230 | | |
222 | | - | |
| 231 | + | |
223 | 232 | | |
224 | 233 | | |
225 | 234 | | |
| |||
242 | 251 | | |
243 | 252 | | |
244 | 253 | | |
245 | | - | |
| 254 | + | |
246 | 255 | | |
| 256 | + | |
| 257 | + | |
247 | 258 | | |
248 | 259 | | |
249 | 260 | | |
| |||
257 | 268 | | |
258 | 269 | | |
259 | 270 | | |
260 | | - | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
261 | 274 | | |
262 | 275 | | |
263 | 276 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
| 6 | + | |
5 | 7 | | |
6 | 8 | | |
7 | 9 | | |
8 | 10 | | |
9 | 11 | | |
10 | | - | |
| 12 | + | |
| 13 | + | |
11 | 14 | | |
12 | 15 | | |
13 | 16 | | |
14 | 17 | | |
15 | 18 | | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
22 | 34 | | |
23 | 35 | | |
24 | 36 | | |
| |||
30 | 42 | | |
31 | 43 | | |
32 | 44 | | |
33 | | - | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
34 | 50 | | |
35 | 51 | | |
36 | 52 | | |
| |||
44 | 60 | | |
45 | 61 | | |
46 | 62 | | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
194 | 194 | | |
195 | 195 | | |
196 | 196 | | |
197 | | - | |
| 197 | + | |
198 | 198 | | |
199 | | - | |
| 199 | + | |
200 | 200 | | |
201 | 201 | | |
202 | 202 | | |
| |||
206 | 206 | | |
207 | 207 | | |
208 | 208 | | |
209 | | - | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
210 | 213 | | |
211 | 214 | | |
212 | 215 | | |
| |||
241 | 244 | | |
242 | 245 | | |
243 | 246 | | |
| 247 | + | |
244 | 248 | | |
245 | 249 | | |
246 | 250 | | |
247 | 251 | | |
248 | 252 | | |
| 253 | + | |
| 254 | + | |
249 | 255 | | |
250 | 256 | | |
251 | 257 | | |
252 | 258 | | |
253 | 259 | | |
254 | 260 | | |
255 | 261 | | |
| 262 | + | |
256 | 263 | | |
257 | 264 | | |
258 | 265 | | |
| |||
262 | 269 | | |
263 | 270 | | |
264 | 271 | | |
| 272 | + | |
| 273 | + | |
265 | 274 | | |
266 | 275 | | |
267 | 276 | | |
| |||
0 commit comments