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

config.node_types.file.style.fg foreground color isn't applied to files #651

Open
Locorock opened this issue Jul 16, 2023 · 4 comments
Open

Comments

@Locorock
Copy link

Locorock commented Jul 16, 2023

The same can be said for all node_types style properties except directory.
This only applies for files that have no permission for execution.
My LS_COLORS is empty, i'm using fish and wezterm but the results are identical with kitty and sh. I'm using xplr version 0.21.2 from pacman.

this is an example of what seems to be happening:
2023-07-16-233559_944x511_scrot

These are my relevant configurations, i've deleted the rest of the config (except for version) to make sure nothing else could be interfering:

xplr.config.node_types.directory.meta.icon = ""
xplr.config.node_types.directory.style.fg = "Green"
xplr.config.node_types.file.meta.icon = ""
xplr.config.node_types.file.style.fg = "Blue"
xplr.config.node_types.symlink.meta.icon = "§"
-- xplr.config.node_types.mime_essence = {}
xplr.config.node_types.extension.md = { meta = { icon = "" }, style = { fg = "Blue" } }
xplr.config.node_types.extension.rs = { meta = { icon = "" }, style = { fg = "Green"} }
xplr.config.node_types.extension.rasi = { meta = { icon = "" }, style = { fg = "Yellow"} }
-- xplr.config.node_types.special = {}
@sayanarijit
Copy link
Owner

It was fixed in #640, but not released yet.

Try the dev branch.

@sayanarijit
Copy link
Owner

Actually, it might be a separate issue. Will take a closer look later.

@Locorock
Copy link
Author

Locorock commented Jul 17, 2023

Tinkering around on the latest commit i found a way to work around this issue, albeit by ignoring LS_COLORS completely
The issue most certainly lies with the default lua config and how it handles lscolors, since the crate lscolors injects its own defaults

const LS_COLORS_DEFAULT: &str = "rs=0:lc=\x1b[:rc=m:cl=\x1b[K:ex=01;32:sg=30;43:su=37;41:di=01;34:st=37;44:ow=34;42:tw=30;42:ln=01;36:bd=01;33:cd=01;33:do=01;35:pi=33:so=01;35:";

Either way, by editing xplr.fn.builtin.fmt_general_table_row_cols_1 in the builtin init.lua i got the thing to "work"

Edited function
xplr.fn.builtin.fmt_general_table_row_cols_1 = function(m)
  local nl = xplr.util.paint("\\n", { add_modifiers = { "Italic", "Dim" } })
  local r = m.tree .. m.prefix

  -- start of edited part

  local style = m.style
  -- local style = xplr.util.lscolor(m.absolute_path)
  -- style = xplr.util.style_mix({ style, m.style })

  -- end of edited part

  if m.meta.icon == nil then
    r = r .. ""
  else
    r = r .. m.meta.icon .. " "
  end

  local rel = m.relative_path
  if m.is_dir then
    rel = rel .. "/"
  end
  r = r .. xplr.util.paint(xplr.util.shell_escape(rel), style)

  r = r .. m.suffix .. " "

  if m.is_symlink then
    r = r .. "-> "

    if m.is_broken then
      r = r .. "×"
    else
      local symlink_path =
          xplr.util.shorten(m.symlink.absolute_path, { base = m.parent })
      if m.symlink.is_dir then
        symlink_path = symlink_path .. "/"
      end
      r = r .. symlink_path:gsub("\n", nl)
    end
  end

  return r
end

Here's how it looks now:
2023-07-17-173153_941x507_scrot

@abhinavnatarajan
Copy link
Contributor

Possibly related to #705

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants