Skip to content

When used inside Emacs with Reline, input is echoed #644

@dgutov

Description

@dgutov

Description

This issue is about using Pry as a Ruby REPL inside Emacs.

The effect looks very much like #616:

[1] pry(main)> [1] pry(main)> 2
[1] pry(main)> 2[1] pry(main)> 2=> 2
[2] pry(main)> [2] pry(main)> 3
[2] pry(main)> 3[2] pry(main)> 3=> 3
[3] pry(main)> [3] pry(main)> 

But there doesn't seem to be any interest in having this solved inside Reline (i.e. providing a "simple" io driver).

What are your expected behavior and actual behavior of your environment?

The expected behavior is that the input is not copied or otherwise reproduced in the output.

This problem come up more often now than Ruby 3.3 defaults to Reline.

Terminal Emulator

Comint inside Emacs.

IRB has a workaround: when launched with --nosingleline --nomultiline, it switches to a different I/O implementation, which it calls StdioInputMethod.

Should Pry carry its own solution like that as well? The hackish patch below seems to do the trick. It can be a configuration option, a separate wrapper class, etc.

@@ -179,7 +179,10 @@
           end
         end
 
-        if readline_available?
+        if ENV['TERM'] == 'dumb'
+          STDOUT.print(current_prompt)
+          STDIN.gets
+        elsif readline_available?
           set_readline_output
           input_readline(current_prompt, false) # false since we'll add it manually
         elsif coolline_available?

Downstream report: dgutov/robe#147 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions