Commit 36b42f8
refactoring + bugfixes (#34)
* Extract shared helpers from diff/merge views and consolidate file watchers
Move duplicated code into common.rs:
- build_find_bar(): find/replace bar + goto-line + 5 GActions (~220 lines x2)
- build_nav_button_group(): prev/next navigation buttons
- build_undo_redo_box(): undo/redo buttons wired to active view
- build_filter_toggles(): blank-line and whitespace toggle buttons
- start_file_watcher(): generic file watcher with on_tick callback
- build_app_window(): shared window builder with notebook and actions
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Split common.rs (4,419 lines) into 12 focused submodules
Convert the monolithic common.rs into a common/ directory module with
dedicated files for each responsibility area: editor, gutter, helpers,
tabs, find_bar, scroll_sync, navigation, toolbar, search, chunk_map,
file_watcher, and tests. Pure code motion with no logic changes.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Refactor FileTab into Diff/Merge enum with PaneInfo
Replace flat FileTab struct with a Diff/Merge enum. Introduce PaneInfo
to hold per-pane (path, buffer, save button) state. Accessor methods
(saveable_panes, is_reloadable) eliminate dummy save buttons and
empty-path guards.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Extract shared editor action helpers (refresh, save-as, save-all)
Move duplicated refresh/save-as/save-all logic from diff_view and
merge_view into shared helpers in common/helpers.rs. Each view still
wires its own actions but calls the shared functions for the actual
save/reload/dialog logic.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Deduplicate dir_window button handlers via action group
Replace ~140 lines of duplicated copy-left/copy-right/delete button
click handlers with one-liner activate_action calls. The action group
definitions (already used for keyboard shortcuts) now serve both
buttons and keys.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix merge Save As stale tab path and remove duplicate action group insert
- Pass middle_tab_path through MergeViewResult so FileTab::Merge shares
the same Rc as the save-as action, keeping close/unsaved dialogs in
sync after Save As.
- Remove duplicate vcs_tab.insert_action_group call in vcs_window.rs.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix merge tab close prompt showing stale path after Save As
Read the live middle_tab_path Rc instead of capturing a static String
from second_path at construction time. The confirm_unsaved_dialog now
shows the current file name after Save As.
The merge watcher intentionally tracks original source paths (not the
Save As target) since the watcher monitors source files being merged,
matching Meld's behavior.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Update TESTING.md with missing test cases
Add 42 test cases for features not previously covered: Save As, Save
All, Open Externally, Refresh, tab navigation (Ctrl+1..9), New
Comparison (Ctrl+N), blank comparison, wrap-around navigation, chunk
map viewport indicator, and keyboard shortcuts dialog.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix error message for non-existent single path argument
`path.is_dir()` returns false for non-existent paths, causing a
misleading "single file argument not supported" error. Add an explicit
existence check before the is_dir/is_file branches.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Support -L/--label flags for directory comparison
Wire labels through build_dir_window → build_dir_tab to override
pane header text. Labels swap correctly with the swap-panes button.
Tooltips still show the actual directory path.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix CLI help: show <LABEL> instead of <LABELS> for -L flag
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Repaint chunk borders when clicking inside a chunk
Cursor tracking updated current_chunk index but never triggered a
redraw, so bold borders only appeared after keyboard navigation or
scrolling. Now queue_draw on filler overlays and gutters when the
current chunk changes. Fixed in both diff and merge views.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Scroll to cursor after toolbar undo/redo
The toolbar undo/redo buttons called buf.undo()/redo() without
scrolling the view, causing the viewport to jump away from the
edit location. Now calls scroll_mark_onscreen after each operation.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Update TESTING.md: vertical scroll is synced by chunk
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix find/replace: cross-pane navigation, Escape, macOS shortcut, undo
- Find next/prev now cycles across panes when no match in current pane
- Escape closes find bar from widget level (not just text views)
- Use Cmd+Shift+H for Find & Replace on macOS (Cmd+H is system Hide)
- Replace All uses delete+insert in a user action group so undo works
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix find next/prev cycling across panes
find_next_match wrapped within the same buffer, so cross-pane search
was never reached. Split into find_next_match_no_wrap with a
skip_current flag: current pane skips the cursor position, other
panes search from start/end without skipping.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Clarify TESTING.md wording for Alt+Left/Right in dir file diff tab
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Update TESTING.md: directory tab shows dir names, not "Directory"
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Show full absolute path in pane header tooltip
Canonicalize file_path so the tooltip always shows the full path
instead of a relative one when launched with relative arguments.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Prevent duplicate file tabs in directory comparison
open_file_diff now checks if a tab with the same rel_path is already
open and switches to it instead of opening a duplicate.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix TESTING.md: tab switching is Alt+1..9, not Ctrl+1..9
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Use native trash command on macOS instead of GIO
GIO's File::trash() silently deletes directories permanently on macOS
instead of moving them to Finder's Trash. Use the native macOS trash
command which works correctly. GIO is still used on Linux.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix merge view chunk highlighting, conflict drawing, and navigation
- Add conflict-aware cursor detection: clicking conflict regions on
left/right panes now highlights the conflict band via fallback to
merged_gutter_chunks when chunk_at_cursor returns None
- Separate conflict drawing from regular chunk drawing: skip conflict
chunks in draw_chunk_backgrounds via is_conflict flags, draw them
with dedicated conflict stroke functions at full alpha
- Add bold border support for conflict regions (current chunk highlight)
- Fix navigation guard: prevent cursor_position_notify from overriding
current_chunk during Alt+Up/Down navigation
- Collapse conflict bands into single navigation targets on side panes
so Alt+Up/Down skips entire conflict band in one step
- Fix chunk map viewport indicators for merge view by redrawing on all
three scroll adjustments
- Focus middle pane on 3-way merge open (CLI and new-comparison tab)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix scroll sync skipping Equal regions in line mapping
map_line_through_chunks advanced past Equal chunks without checking if
the source line fell inside them, causing the mapped position to jump
to the next non-equal chunk boundary. This made the left pane "stick"
in 3-way merge when left and middle had few differences. Now returns
the correct 1:1 mapped position when source line is within an Equal
region.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Track Save As directory changes in file watcher for diff and merge views
FileWatcher now supports dynamically adding watched paths via watch().
Both file_window and merge_view monitor save paths for directory changes
and tell the watcher to pick up new directories after Save As.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Show conflicting files in VCS window and open them in 3-way merge view
Add VcsStatus::Conflict for unmerged files (UU, AA, DD, DU, UD, AU, UA).
Conflict files display with red "Conflict" label in the VCS file list.
Opening a conflict launches a 3-way merge: ours (:2:) on left, working
copy in middle, theirs (:3:) on right.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* bump to 0.7.0
* Fix flaky UI tests by retrying keystrokes and polling for label changes
Centralize xdotool key-sending in conftest.py with a 200ms delay after
focus to let GTK process the event. Add send_keys_until() that retries
keystrokes up to 3 times if the expected label change doesn't appear
within the timeout (default 1s per attempt, 5s max).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* focus left pane on window show
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent 8e6ff6a commit 36b42f8
30 files changed
Lines changed: 5968 additions & 5802 deletions
File tree
- src
- ui
- common
- tests/ui_integration
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 | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
| 36 | + | |
35 | 37 | | |
36 | 38 | | |
37 | 39 | | |
| |||
55 | 57 | | |
56 | 58 | | |
57 | 59 | | |
58 | | - | |
| 60 | + | |
59 | 61 | | |
60 | 62 | | |
61 | 63 | | |
| |||
68 | 70 | | |
69 | 71 | | |
70 | 72 | | |
| 73 | + | |
71 | 74 | | |
72 | 75 | | |
73 | 76 | | |
74 | 77 | | |
75 | 78 | | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
76 | 86 | | |
77 | 87 | | |
78 | 88 | | |
| |||
91 | 101 | | |
92 | 102 | | |
93 | 103 | | |
94 | | - | |
| 104 | + | |
95 | 105 | | |
96 | 106 | | |
97 | 107 | | |
| |||
110 | 120 | | |
111 | 121 | | |
112 | 122 | | |
| 123 | + | |
| 124 | + | |
113 | 125 | | |
114 | 126 | | |
115 | 127 | | |
| |||
143 | 155 | | |
144 | 156 | | |
145 | 157 | | |
146 | | - | |
| 158 | + | |
147 | 159 | | |
148 | 160 | | |
149 | 161 | | |
150 | 162 | | |
151 | 163 | | |
152 | 164 | | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
153 | 171 | | |
154 | 172 | | |
155 | 173 | | |
| |||
196 | 214 | | |
197 | 215 | | |
198 | 216 | | |
199 | | - | |
| 217 | + | |
200 | 218 | | |
201 | 219 | | |
202 | 220 | | |
203 | 221 | | |
204 | 222 | | |
205 | 223 | | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
206 | 234 | | |
207 | 235 | | |
208 | 236 | | |
| |||
242 | 270 | | |
243 | 271 | | |
244 | 272 | | |
| 273 | + | |
| 274 | + | |
245 | 275 | | |
246 | 276 | | |
247 | 277 | | |
| |||
255 | 285 | | |
256 | 286 | | |
257 | 287 | | |
| 288 | + | |
258 | 289 | | |
259 | 290 | | |
260 | 291 | | |
| |||
281 | 312 | | |
282 | 313 | | |
283 | 314 | | |
284 | | - | |
| 315 | + | |
285 | 316 | | |
286 | 317 | | |
287 | 318 | | |
288 | 319 | | |
289 | 320 | | |
290 | 321 | | |
291 | 322 | | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
292 | 329 | | |
293 | 330 | | |
294 | 331 | | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | | - | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
72 | 75 | | |
73 | 76 | | |
74 | 77 | | |
| |||
0 commit comments