m00qek / baleia.nvim

Colorize text with ANSI escape sequences (8, 16, 256 or TrueColor)
127 stars 4 forks source link

Doesn't work in read-only buffers, even with strip_ansi_codes = false #12

Closed SevereOverfl0w closed 1 year ago

SevereOverfl0w commented 1 year ago

I have:

  let s:baleia = luaeval("require('baleia').setup({ strip_ansi_codes = false, log = 'DEBUG' })")
  command! BaleiaColorize call s:baleia.once(bufnr('%'))
  command! BaleiaLogs call s:baleia.logger.show()

But in read-only buffers (e.g. quickfix / fireplace's :Last command) colors aren't highlighted, just ignored:

ERROR vim.api.nvim_buf_set_text
    | {
    |   params = {
    |     buffer = 16,
    |     end_col = 53,
    |     end_row = 14,
    |     lines = { "... removed ..." },
    |     start_col = 0,
    |     start_row = 0
    |   },
    |   result = "Buffer is not 'modifiable'"
    | }

some highlighting seems to take place, but it doesn't colour the text it's supposed to.

m00qek commented 1 year ago

Hey I've fixed the buggy strip_ansi_codes = false behavior but if you are trying to colorize the quickfix I believe using BufReadPost is easier