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

Drop showing indent level number in DEFAULT prompt and INF_RUBY prompt #679

Merged
merged 2 commits into from
Aug 12, 2023

Conversation

tompng
Copy link
Member

@tompng tompng commented Aug 12, 2023

Removes indent level number in :DEFAULT and :INF_RUBY prompt mode.

irb(main):001:1> if true
irb(main):002:2>   puts(
irb(main):003:3>     1,
irb(main):004:3>     2,
↓
irb(main):001> if true
irb(main):002>   puts(
irb(main):003>     1,
irb(main):004>     2,

Until irb 1.0.0, auto indent was not enabled by default and this indent level number was useful.

irb(main):001:0> IRB::VERSION
=> "1.0.0"
irb(main):002:0> def f
irb(main):003:1> if true
irb(main):004:2> puts(
irb(main):005:3* 1,
irb(main):006:3* 2,
irb(main):007:3* )
irb(main):008:2> end
irb(main):009:1> end
=> :f

But now, auto indent is enabled by default. Indent level is identical to next-line's indentation spaces. You can easily know how deep the code is nested without seeing this number. It is just making prompt long.

Other prompt modes

For :INF_RUBY prompt mode, only PROMPT_I is present. In this case, indent level number (always zero) is completely useless.
Indent level number still remains in :CLASSIC prompt mode.

@st0012 st0012 added the enhancement New feature or request label Aug 12, 2023
Copy link
Member

@st0012 st0012 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love it 😍

@tompng tompng merged commit 3847532 into ruby:master Aug 12, 2023
24 checks passed
@tompng tompng deleted the remove_indent_from_default_prompt branch August 12, 2023 10:19
matzbot pushed a commit to ruby/ruby that referenced this pull request Aug 12, 2023
INF_RUBY prompt
(ruby/irb#679)

* Drop showing indent level number in DEFAULT prompt and INF_RUBY prompt

* Update prompt part of test_rendering's expected result

ruby/irb@3847532e54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

Successfully merging this pull request may close these issues.

2 participants