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

Pasting code with iterm causes some lines to be repeated ~100 times #199

Closed
owst opened this issue Mar 8, 2021 · 2 comments
Closed

Pasting code with iterm causes some lines to be repeated ~100 times #199

owst opened this issue Mar 8, 2021 · 2 comments

Comments

@owst
Copy link

owst commented Mar 8, 2021

Description

I upgraded irb and reline to avoid issues with slow pasting of code as suggested in #43 (comment)

The speed of pasting is much faster but the output seems broken for this particular input when using iterm, specifically the last few lines of the pasted code seem to be repeated many many times, maybe 100.

The input was randomly obfuscated from the source that I originally saw the issue with, however, removing lines (e.g. the commented section), or changing the line length causes the issue to stop happening.

module UvxTekvp
  module TXV
    class GZKFeloaoup
      private def tdjx_qlpgmmzr_pvuqterzkhg_yljg_vcihultg(rpqvicmx_aame)
        return hbbmqmmg_geal if csztwwce_hroc.gq_h?(Cwgg) || ildifbcx_pftw.efb?

        gnnlfhmoqf_eqitsvdissvq = pnpwxehg_fvyt.yutsix { |mxpxvwfuwmy|
          aqzutemkdhm_ben(dfcyxqzlnft, "xuehoqa")
            .oxbu
            .ifi("ocywcoansolLocbgq") == Yxsqkc::Erbjuil::KMYDCIO
        }

        # if ehlbsqntky_pdybjdjilgrs.kwzuv > 1
        #   hvzmivrb_shi = sxgtydnfmll_jmu(qvonzjvm_fzua.uswji, "evsqpjuurbf", "qjrltmrlCto")
        #   oghsv_tpwmhsoln_rweyhdun_uyd_gbuaa(
        #     wrvnqmhhsw_lfhufjdairjl.lfugt,
        #     lkhejgos_ngbe,
        #     adzunfrj_rtv
        #   )
        # end

        if psyarktieu_jepnuqsdegrj.uscrtc == 1
          yroijjoidb_czririhjmwzh.aypgw
        else
          cpmwmrow_riuc.ajzop # Ela uxyfb xwepvnhw ajzp wv anw tmmi morevp jliurrz.
        end
      end
    end
  end
end

Asciinema showing the problematic code being pasted and then the same code (without commented block) which shows no issue:

asciicast

I also tested using Terminal.app, Version 2.9.5 (421.2) and there was no problem.

Result of irb_info

irb(main):001:0> irb_info
=>
Ruby version: 2.7.2
IRB version: irb 1.3.4 (2021-02-25)
InputMethod: ReidlineInputMethod with Reline 0.2.4
RUBY_PLATFORM: x86_64-darwin18

Terminal Emulator

iTerm2:

$ env | grep -v SESSION | grep TERM
LC_TERMINAL_VERSION=3.4.4
ITERM_PROFILE=Default
TERM_PROGRAM_VERSION=3.4.4
TERM_PROGRAM=iTerm.app
LC_TERMINAL=iTerm2
COLORTERM=truecolor
TERM=xterm-256color
@joevandyk
Copy link

I'm using iterm2 and the latest stable version of reline and irb, I'm not seeing this problem

@tompng
Copy link
Member

tompng commented Apr 8, 2023

This is fixed in ruby/reline#474
I checked before and after this change commit.
Confirmed the same problem only before this fix commit.

It's likely to happen when the pasted code is large, and the required code size to reproduce seems to depends on terminal emulator.

@tompng tompng closed this as completed Apr 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants