Skip to content

Commit 01b38dc

Browse files
feat: disable rendering in diff mode
## Details Issue: #169 Was cut as a question however there was no way to accomplish this before. The behavior is made global with no way to disable it for now. I can add one if requested however I don't see that happening as if you are looking at a diff you probably want to see the underlying text and not a rendered approximation. Change is rather small, only adding a check on the `diff` window option when deciding what the next state of the buffer should be. We also need to listen to the `DiffUpdated` event so that rendering is correctly disabled when switching between a diff mode view of the buffer and a standard view.
1 parent 7493db6 commit 01b38dc

File tree

4 files changed

+6
-2
lines changed

4 files changed

+6
-2
lines changed

Diff for: CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
[2424693](https://github.com/MeanderingProgrammer/render-markdown.nvim/commit/2424693c7a4c79641a7ea1e2a838dbc9238d6066)
99
- table min width [f84eeae](https://github.com/MeanderingProgrammer/render-markdown.nvim/commit/f84eeaebac278e26bd2906fd47747631716a5edb)
1010
- new debug API for development [6f87257](https://github.com/MeanderingProgrammer/render-markdown.nvim/commit/6f8725746ecadae0ae5ab3e7a1a445dad6b2e231)
11+
- `render_modes` as a boolean [7493db6](https://github.com/MeanderingProgrammer/render-markdown.nvim/commit/7493db6d3fe3f6679549e6020498f72e97cd9b73)
1112

1213
### Bug Fixes
1314

Diff for: lua/render-markdown/core/ui.lua

+3
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,9 @@ function M.next_state(config, win)
118118
if not state.enabled then
119119
return 'default'
120120
end
121+
if util.get_win(win, 'diff') then
122+
return 'default'
123+
end
121124
if not util.view(win).leftcol == 0 then
122125
return 'default'
123126
end

Diff for: lua/render-markdown/health.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ local state = require('render-markdown.state')
44
local M = {}
55

66
---@private
7-
M.version = '7.0.7'
7+
M.version = '7.0.8'
88

99
function M.check()
1010
M.start('version')

Diff for: lua/render-markdown/manager.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ function M.attach(buf)
5858
end
5959
local config = state.get_config(buf)
6060
local events = { 'BufWinEnter', 'BufLeave', 'CursorHold', 'CursorMoved' }
61-
local change_events = { 'ModeChanged', 'TextChanged' }
61+
local change_events = { 'DiffUpdated', 'ModeChanged', 'TextChanged' }
6262
if config:render('i') then
6363
vim.list_extend(events, { 'CursorHoldI', 'CursorMovedI' })
6464
vim.list_extend(change_events, { 'TextChangedI' })

0 commit comments

Comments
 (0)