Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: conceal/render without actually entering a buffer #210

Closed
2 tasks done
petobens opened this issue Oct 19, 2024 · 4 comments
Closed
2 tasks done

bug: conceal/render without actually entering a buffer #210

petobens opened this issue Oct 19, 2024 · 4 comments
Labels
not a bug Not a bug in this plugin

Comments

@petobens
Copy link

petobens commented Oct 19, 2024

Neovim version (nvim -v)

NVIM v0.11.0-dev-774+g3b54adc6c6

Neovim distribution

N/A

Operating system

Arch

Terminal emulator / GUI

Kitty

Describe the bug

If a buffer is loaded but the cursor is not inside the window the rendering doesn't actually happen. For instance in the GIF below I switch between different ChatGPT sessions and unless I actually get into the output window/buffer there is no rendering.

Similary I was wondering whether it was possible to have rendering in telescope preview buffer.

Peek 2024-10-19 11-26

Expected behavior

Have rendering when the buffer/window is shown. Dunnno if this is problem with ChatGPT and telecope plugins per se.

Healthcheck output

render-markdown:                     require("render-markdown.health").check()

render-markdown.nvim [version] ~
- OK plugin 7.4.5
- OK neovim >= 0.10

render-markdown.nvim [configuration] ~
- OK valid

render-markdown.nvim [nvim-treesitter] ~
- OK installed
- OK markdown: parser installed
- OK markdown: highlight enabled
- OK markdown_inline: parser installed
- OK markdown_inline: highlight enabled

render-markdown.nvim [executables] ~
- OK none to check

render-markdown.nvim [conflicts] ~
- OK headlines: not installed
- OK obsidian: not installed

Plugin configuration

require('render-markdown').setup({
    enabled = true,
    file_types = { 'markdown', 'chatgpt', 'chatgpt-input' },
    render_modes = true,
    win_options = {
        conceallevel = { rendered = 2 },
        concealcursor = { rendered = 'nc' },
    },
    anti_conceal = {
        -- Preserve glyphs in normal mode but make them "anti_conceal" in insert mode to
        -- replicate concealcursor behaviour
        ignore = {
            bullet = { 'n' },
            callout = { 'n' },
            check_icon = { 'n' },
            check_scope = { 'n' },
            code_language = { 'n' },
            dash = { 'n' },
            head_icon = { 'n' },
            link = { 'n' },
            quote = { 'n' },
            table_border = { 'n' },
        },
    },
    dash = {
        width = 80,
    },
    heading = {
        sign = false,
        icons = { '󰪥', '󰺕', '', '', '', '' },
        position = 'inline',
    },
    bullet = {
        icons = { '', '', '', '-', '-' },
    },
    checkbox = {
        unchecked = { icon = '' },
        checked = { icon = '', scope_highlight = '@markup.strikethrough' },
        custom = {
            doing = {
                raw = '[_]',
                rendered = '󰄮',
                highlight = 'RenderMarkdownDoing',
            },
            wontdo = {
                raw = '[~]',
                rendered = '󰅗',
                highlight = 'RenderMarkdownWontdo',
            },
        },
    },
    code = {
        sign = false,
        width = 'block',
        border = 'thick',
        min_width = 80,
        highlight_language = 'LineNr',
        language_name = false,
    },
    quote = { icon = '' },
    pipe_table = { cell = 'raw' },
    link = {
        wiki = { icon = '󱗖 ', highlight = 'RenderMarkdownWikiLink' },
    },
    latex = { enabled = false },
})

Plugin error log

-

Confirmations

  • I have updated this plugin to the latest version using my plugin manager
  • I have provided the text contained in all screenshots as raw text in this issue. This means if there is a screenshot below it is the copy pasted contents of the file in the screenshot. I understand that my issue will be closed if I have not.

Additional information

No response

@petobens petobens added the bug Something isn't working label Oct 19, 2024
@MeanderingProgrammer
Copy link
Owner

For instance in the GIF below I switch between different ChatGPT sessions and unless I actually get into the output window/buffer there is no rendering.

Are you able to re-create this using some standard commands to reproduce it? I don't exactly want to figure something out specific to a plugin. But if it only occurs in the ChatGPT preview window I can take a look at some point.

Similary I was wondering whether it was possible to have rendering in telescope preview buffer.

Telescope buffers are a special case that there is no way to get working. Some more details on that here: https://github.com/MeanderingProgrammer/render-markdown.nvim/blob/main/doc/limitations.md#does-not-run-in-telescope-preview

MeanderingProgrammer added a commit that referenced this issue Oct 20, 2024
## Details

Issue: #210

Sometimes the buffers associated with windows are switched from another
window. An example of this is the ChatGPT plugin in the issue above
where selecting a session changes the contents of the window, but from
the sessions window.

To get around this rather than always using the current window assuming
events are triggered directly where rendering is needed use the complete
list of windows associated with a buffer and only use the current window
if it is contained in that list.

This is part of the fix to enable this, another requires the plugin to
trigger the TextChanged event so we can update what's rendered.
@MeanderingProgrammer
Copy link
Owner

To fix the ChatGPT issue I needed to make a change on my side which was merged here: 5137b5e.

However there is another change needed from the ChatGPT plugin, just some way for me to know that the preview buffer contents have been changed so I opened a PR for that here: jackMort/ChatGPT.nvim#474.

@petobens
Copy link
Author

This so good. Thanks :)

@MeanderingProgrammer
Copy link
Owner

Closing, any followup will be in the ChatGPT.nvim PR.

@MeanderingProgrammer MeanderingProgrammer added not a bug Not a bug in this plugin and removed bug Something isn't working labels Feb 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
not a bug Not a bug in this plugin
Projects
None yet
Development

No branches or pull requests

2 participants