Skip to content

Drop Unicode.take_range's optional arg as it's never used #528

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

Merged
merged 1 commit into from
Mar 29, 2023

Conversation

st0012
Copy link
Member

@st0012 st0012 commented Mar 29, 2023

In all usages of Unicode.take_range, the last parameter never receives anything:

lib/reline/line_editor.rb
751:      str = padding_space_with_escape_sequences(Reline::Unicode.take_range(item, 0, str_width), str_width)
810:          s = Reline::Unicode.take_range(visual_lines[start + i], old_dialog.column, old_dialog.width)
828:          s = Reline::Unicode.take_range(visual_lines[start + i], old_dialog.column, old_dialog.width)
847:          s = Reline::Unicode.take_range(visual_lines[start + i], old_dialog.column, width)
866:          s = Reline::Unicode.take_range(visual_lines[start + i], old_dialog.column + dialog.width, width)
917:        str = Reline::Unicode.take_range(visual_lines_under_dialog[i], dialog.column, dialog.width)

So we can drop it to make it easier to understand.

(IRB doesn't use this method)

@st0012 st0012 requested a review from a team March 29, 2023 09:38
Copy link
Member

@tompng tompng left a comment

Choose a reason for hiding this comment

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

👍

@tompng tompng merged commit 428fed4 into master Mar 29, 2023
@tompng tompng deleted the drop-redundant-optional-arg-from-take_range branch March 29, 2023 10:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants