Skip to content

Commit 207d12c

Browse files
fix(files): Reload file after remote edit
1 parent db9a4ed commit 207d12c

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

lua/orgmode/files/init.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,9 @@ function OrgFiles:update_file(filename, action)
306306

307307
return Promise.resolve(action(file)):next(function(result)
308308
edit_file.close()
309-
return result
309+
return file:reload():next(function()
310+
return result
311+
end)
310312
end)
311313
end
312314

tests/plenary/ui/clock_spec.lua

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ describe('Clock', function()
1717
table.insert(files, first_file.filename)
1818
vim.fn.cursor(3, 1)
1919
vim.cmd([[norm ,oxi]])
20-
vim.wait(0)
20+
vim.wait(100)
2121
local now = Date.now({ active = false }):to_wrapped_string()
2222
assert.are.same(' :LOGBOOK:', vim.fn.getline(5))
2323
assert.are.same(string.format(' CLOCK: %s', now), vim.fn.getline(6))
@@ -51,7 +51,7 @@ describe('Clock', function()
5151

5252
vim.fn.cursor(3, 1)
5353
vim.cmd([[norm ,oxi]])
54-
vim.wait(0) -- wait for promise to fulfill
54+
vim.wait(100) -- wait for promise to fulfill
5555
local now = Date.now({ active = false }):to_wrapped_string()
5656
assert.are.same(' :LOGBOOK:', vim.fn.getline(8))
5757
assert.are.same(string.format(' CLOCK: %s', now), vim.fn.getline(9))
@@ -61,7 +61,7 @@ describe('Clock', function()
6161
vim.fn.cursor(11, 1)
6262
local new_now = Date.now({ active = false }):to_wrapped_string()
6363
vim.cmd([[norm ,oxi]])
64-
vim.wait(0) -- wait for promise to fulfill
64+
vim.wait(100) -- wait for promise to fulfill
6565
-- First clocked out
6666
assert.are.same(' :LOGBOOK:', vim.fn.getline(8))
6767
assert.are.same(string.format(' CLOCK: %s--%s => 0:00', now, new_now), vim.fn.getline(9))
@@ -86,7 +86,7 @@ describe('Clock', function()
8686
table.insert(files, third_file.filename)
8787
vim.fn.cursor(3, 1)
8888
vim.cmd([[norm ,oxi]])
89-
vim.wait(0) -- wait for promise to fulfill
89+
vim.wait(100) -- wait for promise to fulfill
9090
local now = Date.now({ active = false }):to_wrapped_string()
9191
assert.are.same(' :LOGBOOK:', vim.fn.getline(5))
9292
assert.are.same(string.format(' CLOCK: %s', now), vim.fn.getline(6))
@@ -115,7 +115,7 @@ describe('Clock', function()
115115
local old_clock_line = vim.fn.getline(6)
116116
vim.fn.cursor(3, 1)
117117
vim.cmd([[norm ,oxi]])
118-
vim.wait(0) -- wait for promise to fulfill
118+
vim.wait(100) -- wait for promise to fulfill
119119
local now = Date.now({ active = false }):to_wrapped_string()
120120
assert.are.same(' :LOGBOOK:', vim.fn.getline(5))
121121
assert.are.same(string.format(' CLOCK: %s', now), vim.fn.getline(6))
@@ -138,7 +138,7 @@ describe('Clock', function()
138138
})
139139
vim.fn.cursor(3, 1)
140140
vim.cmd([[norm ,oxi]])
141-
vim.wait(0) -- wait for promise to fulfill
141+
vim.wait(100) -- wait for promise to fulfill
142142
local now = Date.now({ active = false }):to_wrapped_string()
143143
assert.are.same(' :LOGBOOK:', vim.fn.getline(5))
144144
assert.are.same(string.format(' CLOCK: %s', now), vim.fn.getline(6))

0 commit comments

Comments
 (0)