Skip to content

Commit

Permalink
Add color inline using Reline.output_modifier_proc
Browse files Browse the repository at this point in the history
  • Loading branch information
andrehjr committed Feb 11, 2024
1 parent 6b6998a commit aa46ee8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/pry/repl.rb
Expand Up @@ -197,6 +197,14 @@ def read_line(current_prompt)
def input_reline(*args)
require 'prism'

Reline.output_modifier_proc = ->(text, _) do
if pry.color
SyntaxHighlighter.highlight(text)
else
text
end
end

Pry::InputLock.for(:all).interruptible_region do
input.readmultiline(*args) do |multiline_input|
Pry.commands.find_command(multiline_input) ||
Expand Down

0 comments on commit aa46ee8

Please sign in to comment.