leo-arch / clifm

The shell-like, command line terminal file manager: simple, fast, extensible, and lightweight as hell.
https://github.com/leo-arch/clifm/wiki
GNU General Public License v2.0
1.33k stars 40 forks source link

bulk rename #268

Closed Docbroke closed 7 months ago

Docbroke commented 7 months ago

hi leo,

"br" command doesn't work as expected when default file association is like "lxterminal -e kak %f", in this case the editor kak opens in lxterminal but file list remains empty. The command works as expected with "kak %f"

This issue is present with last few versions.

leo-arch commented 7 months ago

Hey @Docbroke! Thanks for reporting. Reproduced on FreeBSD (working fine on Arch though). Let me see what I can do.

leo-arch commented 7 months ago

I can reproduce the issue on FreeBSD (not on Linux), but only if the invoked terminal is Lxterminal. It doesn't happen at all with Xterm.

It seems that some versions of Lxterminal are prematurely returning control to the calling process. Just run lxterminal on your regular shell (control is immediately returned to the shell, as if it were executed in the background); now run xterm, and voilà, it behaves as expected (control is not returned to the shell until you close the terminal, as it should be with a foreground process).

If I'm right, this is an Lxterminal issue, not clifm's.

EDIT: How does this explain the issue you described?

  1. Clifm runs the given command: lxterminal -e kak %f, where %f is a temp file containing the file names to be renamed.
  2. Lxterminal immediately returns control to Clifm, which, since it founds the temp file unmodified, assumes the user cancelled the operation (there's nothing to do) and then proceeds to remove the temp file.
  3. Lxterminal runs Kakoune, which attempts to open the temp file, but cannot find it (it was removed): this is why it opens it as a new empty file.

Just replace lxterminal by any other terminal emulator, and the issue should be gone.

Docbroke commented 7 months ago

Hi,

  1. I confirm, issue is with lxterminal, and changing to another terminal solves issue.
  2. I am facing this issue in archlinux. I am closing this as this is not clifm issue.