Skip to content

Commit e37b2d9

Browse files
committed
refactor: Simpler layout conversion. Window symbol consistency.
1 parent bd6c0c2 commit e37b2d9

File tree

9 files changed

+133
-284
lines changed

9 files changed

+133
-284
lines changed

doc/diffview.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -332,13 +332,10 @@ view.x.layout *diffview-config-view.x.layout*
332332
you prefer to edit conflict markers manually without the
333333
visual noise from diffs.
334334

335-
Window symbols:
336-
• A: LOCAL
337-
338335
┌──────────────┐
339336
│ │
340337
│ │
341-
A
338+
B
342339
│ │
343340
│ │
344341
└──────────────┘

lua/diffview/api/views/diff/diff_view.lua

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -142,21 +142,25 @@ function CDiffView:create_file_entries(files)
142142
oldpath = file_data.oldpath,
143143
status = "U",
144144
kind = "conflicting",
145-
rev_ours = Rev(RevType.STAGE, 2),
146-
rev_main = Rev(RevType.LOCAL),
147-
rev_theirs = Rev(RevType.STAGE, 3),
148-
rev_base = Rev(RevType.STAGE, 1),
145+
revs = {
146+
a = Rev(RevType.STAGE, 2),
147+
b = Rev(RevType.LOCAL),
148+
c = Rev(RevType.STAGE, 3),
149+
d = Rev(RevType.STAGE, 1),
150+
},
149151
}))
150152
else
151-
table.insert(entries[v.kind], FileEntry.for_d2(CDiffView.get_default_diff2(), {
153+
table.insert(entries[v.kind], FileEntry.with_layout(CDiffView.get_default_layout(), {
152154
adapter = self.adapter,
153155
path = file_data.path,
154156
oldpath = file_data.oldpath,
155157
status = file_data.status,
156158
stats = file_data.stats,
157159
kind = v.kind,
158-
rev_a = v.left,
159-
rev_b = v.right,
160+
revs = {
161+
a = v.left,
162+
b = v.right,
163+
},
160164
get_data = self.get_file_data,
161165
--FIXME: left_null, right_null
162166
}))

lua/diffview/debounce.lua

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,11 @@ function M.debounce_trailing(ms, rush_first, fn)
5858
local debounced_fn, args
5959

6060
debounced_fn = wrap(timer, function(...)
61-
if lock then
62-
args = utils.tbl_pack(...)
63-
else
61+
if not lock and rush_first and args == nil then
6462
lock = true
65-
if rush_first then
66-
fn(...)
67-
end
63+
fn(...)
64+
else
65+
args = utils.tbl_pack(...)
6866
end
6967

7068
timer:start(ms, 0, function()

0 commit comments

Comments
 (0)