clifm icon indicating copy to clipboard operation
clifm copied to clipboard

Ueberzug does not display in the correct preview window when using fzfnav

Open kjk11 opened this issue 2 years ago • 12 comments

Hello,

I tried the fzfnav plugin last night, pretty much using the out-of-the-box configuration. I set PDF="pdftoppm" and IMG="ueberzug" and put the preview cache directory to default. The pdf preview works but it is displayed on the left side of the screen, covering the entire fzf UI from view. Is this the desired default behaviour or am I missing something? I checked the fzfnav script to see if there is any obvious way to change this, if so it would be good to add something to the documentation. I am running the latest AUR build.

Thank you in advance for any help

kjk11 avatar Jan 05 '22 11:01 kjk11

Hi @kjk11. Thanks for reporting this. I'll try to reproduce the issue and fix it as soon as possible. I'll let you know.

leo-arch avatar Jan 05 '22 12:01 leo-arch

Are you using clifm or clifm-git?

leo-arch avatar Jan 05 '22 13:01 leo-arch

Thank you for the swift response, I am using clifm from the AUR, re-compiled earlier today. System is mainline arch, up to date.

kjk11 avatar Jan 05 '22 13:01 kjk11

What terminal emulator are you using?

leo-arch avatar Jan 05 '22 18:01 leo-arch

I am usually using st, but the issue persists if I use a different emulator e.g. mlterm.

kjk11 avatar Jan 05 '22 21:01 kjk11

This is a screenshot for reference. On the left you would normally see the list of files in the current directory but this is obscured by the pdf preview, which should have appeared in the window on the right. screenshot

kjk11 avatar Jan 05 '22 21:01 kjk11

It seems to be a problem with ueberzug's screen coordinates. These coordinates are calculated by the calculate_position function (variables X and Y), in BFG.sh.

The meaning of the variables in this function is: TERM_LINES and TERM_COLS hold the number of lines and columns of the terminal window respectively, while LINES and COLUMNS refer rather to the preview window's size.

I'm still unable to reproduce the issue. In the meanwhile, you can play around with these values and report if you find something useful. If you could report the values used by this function (TERM_COLS, TERM_LINES, COLUMNS and LINES), plus the result values (X and Y), that would be useful.

You can also try replacing X (columns) and Y (lines) by some fixed values, for instance 40 and 6 respectively (this works for my terminal, whose size is 23 (lines) and 75 (columns)) .

leo-arch avatar Jan 05 '22 22:01 leo-arch

Btw, have you tried the latest development build (clifm-git): there have been a few changes in the fzfnav plugin, so maybe....

leo-arch avatar Jan 05 '22 23:01 leo-arch

I have now switched to clifm-git, however it has not changed the position of the preview much. The variable values obtained by the function are: TERM_LINES=36 and TERM_COLS=117 If I modify these values to, say TERM_LINES=20 and TERM_COLS=180, the position is roughly correct (but the preview is still much larger than the little preview rectangle on the right).

kjk11 avatar Jan 06 '22 00:01 kjk11

Try modifying WIDTH and HEIGHT values in BGH.sh. Those are fixed values, and maybe they're the source of your issue.

leo-arch avatar Jan 06 '22 00:01 leo-arch

WIDTH and HEIGHT do not affect the position of the preview (as one might expect). If I decrease them, the size of the image decreases but only up to a certain point. With both set to zero, most previews are still large than the box on the right, which does not bother me. So right now setting the values for TERM_LINES and TERM_COLS manually works as a fix as long as the window is not resized and I do not use a different screen.

kjk11 avatar Jan 06 '22 00:01 kjk11

Far from ideal, of course, but at least it works. If I were you, I'd try modifying the values of LINES and COLUMNS, since they express the size of the PREVIEW window. Remember that TERM_LINES and TERM_COLS refer to size of the terminal window: this latter values should be those you get querying your terminal size from the command line: echo "$LINES $COLUMNS" or stty size. Then, LINES and COLUMNS should be quite smaller. In my case:

  • TERM_LINES: 23
  • TERM_COLS: 75
  • LINES: 15
  • COLUMNS: 33
  • X: 40
  • Y: 7

This is only to give you an idea of the right proportion.

I'll keep working on this. I just need to reproduce the issue: tried on several boxes, and still nothing.

leo-arch avatar Jan 06 '22 04:01 leo-arch

Hi @kjk11. The issue was never reproduced, but the new view command (a completely new file preview implementation, and thereby still experimental) might be the solution to the problem.

To add image preview support (requires X11 and ueberzug) see https://github.com/leo-arch/clifm/tree/master/misc/tools/imgprev#image-previews-via-ueberzug

Give it a try and let me know if it works for you.

leo-arch avatar Oct 06 '22 02:10 leo-arch

Hey @kjk11! Have you tried the new view command? Does it work for you?

leo-arch avatar Nov 05 '22 02:11 leo-arch

Hi leo-arch,

My apologies, I am currently not playing around with clifm. But I intend to come back to it once I have more capacity and report here.

kjk11 avatar Jan 20 '23 19:01 kjk11

Hi @kjk11. No problem. Your feedback will always be welcome.

The fzfnav plugin has been basically replaced by the view command (tough we keep it as a plugin, it makes no harm), so we can close this issue. However, please feel free to reopen it whenever you think it fit.

leo-arch avatar Jan 20 '23 19:01 leo-arch