Giter VIP home page Giter VIP logo

Comments (17)

danfe avatar danfe commented on June 3, 2024 1

Thanks (referenced commit is fec3892). FWIW, issuing printf '\033[?2004l' can help one to disable bracketed paste mode if their terminal ended up in it for whatever reason.

from clifm.

danfe avatar danfe commented on June 3, 2024 1

Yup, commit 2262496 no longer exhibits the problem for me, thanks!

from clifm.

leo-arch avatar leo-arch commented on June 3, 2024

Hi @danfe! Thanks for reporting. Those are bracketed paste escape codes, so I'm pretty sure (though I've haven't reproduced the issue) that the thing is related to readline's config. Try this:

Edit readline's config file (~/.config/clifm/readline.clifm) and disable enable-bracketed-paste as follows:

set enable-bracketed-paste off

Or just comment out the line.

Restart clifm.

from clifm.

danfe avatar danfe commented on June 3, 2024

set enable-bracketed-paste off

This worked, thanks, nice and quick fix, albeit well-behaved programs should not leave the terminal in a troubled state regardless of the settings. :-)

Or just comment out the line.

This didn't work for some reason (tried it first).

from clifm.

leo-arch avatar leo-arch commented on June 3, 2024

Great! To be honest, I don't remember why this setting was set to on by default (indeed, the comment above -I mean, in the config file, clearly says "disable").

from clifm.

leo-arch avatar leo-arch commented on June 3, 2024

With the latest commit, bracketed-paste is disabled by default.

from clifm.

leo-arch avatar leo-arch commented on June 3, 2024

well-behaved programs should not leave the terminal in a troubled state regardless of the settings

@danfe, you're right of course. Could you please give the following a try?

  1. Compile/run the latest version of clifm.
  2. Reenable bracketed-paste.
  3. Make sure the issue is gone.

The latest commit makes clifm reset the terminal to its previous state immediately before quitting.

from clifm.

danfe avatar danfe commented on June 3, 2024

Make sure the issue is gone.

Hmm, it's not gone, I still need to reset the terminal by hand.

from clifm.

leo-arch avatar leo-arch commented on June 3, 2024

Ok. I'm using tcsetattr(3) to reset the terminal to its original state, saved at startup. This works fine and gives us a more consistent behavior. I guess thereby that this bracketed paste thing is a readline-specific feature/issue (maybe some readline internal function might work, but I'm not sure).

Of course, I can always print \033[?2004l at exit -as you suggested- to disable the feature (as far as I know this is what the nano editor does). But, to make this the right way I should find out first whether the running terminal supports it, and secondly, print it only if the feature was actually enabled.

I'll keep this in mind. For the time being, keeping the thing off by default is quite safe.

from clifm.

danfe avatar danfe commented on June 3, 2024

For the time being, keeping the thing off by default is quite safe.

Fair enough, I agree.

from clifm.

leo-arch avatar leo-arch commented on June 3, 2024

Be it as it may, I still need to reproduce the issue. Could you please report the exact steps you take? How are you pasting to the terminal from the clipboard?

Running FreeBSD/amd64 14.0, Clifm 1.16.1 (tried also 1.14.6), on XTerm 385.

Personally, I'm using this on my .Xresources:

XTerm*VT100.Translations: #override \
    Ctrl Shift <Key>V: insert-selection(CLIPBOARD) \n\
    Ctrl Shift <Key>C: copy-selection(CLIPBOARD)

I can copy to the clipboard via Ctrl-C as always (in Leafpad, say) or with Ctrl-Shift-C in XTerm itself, and then Ctrl-Shift-V, either on clifm itself or, after exiting, on XTerm: works fine in both cases.

from clifm.

danfe avatar danfe commented on June 3, 2024

How are you pasting to the terminal from the clipboard?

I select the text with LMB, it goes to X11 primary selection buffer (others are: clipboard, secondary, buffer-cut). In the example below, I double-click on the word "true":

$ true
$ xclip -selection primary -o
true$ _

The above xclip(1) command yields the same result as clicking the MMB or pressing Shift-Insert. Now, if I run and exit CliFM:

$ true
$ xclip -selection primary -o
true$ hd
^[[200~true^[[201~
00000000  1b 5b 32 30 30 7e 74 72  75 65 1b 5b 32 30 31 7e

Interestingly, xclip(1) returns undecorated string, but not when pasting with keyboard or mouse. That being said, I do have a bunch of non-standard XTerm-related settings in my ~/.Xdefaults, I'll redo the tests in clean environment.

from clifm.

leo-arch avatar leo-arch commented on June 3, 2024

Reproduced! It depends on how you exit clifm though: it happens when you exit with Ctrl-D or F12, but not with the q/quit/exit command. Briefly put, the issue is triggered when you exit via a keybinding.

from clifm.

danfe avatar danfe commented on June 3, 2024

it happens when you exit with Ctrl-D or F12, but not with the q/quit/exit command.

Confirmed (I always exit with ^D from everywhere so long it's supported).

from clifm.

leo-arch avatar leo-arch commented on June 3, 2024

We're on the right track, very close! Give me a few minutes.

from clifm.

leo-arch avatar leo-arch commented on June 3, 2024

Done! Give it a try now.

from clifm.

leo-arch avatar leo-arch commented on June 3, 2024

Thanks for your help @danfe! Closing.

from clifm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.