-
-
Notifications
You must be signed in to change notification settings - Fork 39
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
Refactor align converter #623
Conversation
Change reflect.DeepEqual to slices.Equal. rightAlign is changed to not reset every time. Change trimLeft and trimRight to trimmedIndices. markNext and markPrev are renamed to nextMark and prevMark.
esConv string = "es" // esConv processes escape sequence(default). | ||
rawConv string = "raw" // rawConv is displayed without processing escape sequences as they are. | ||
alignConv string = "align" // alignConv is aligned in each column. | ||
) | ||
|
||
const ( | ||
generalName string = "general" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Usually constants are sharing a common prefix, allowing to find the easily when using completion in the IDE, they are also ordered in the godoc if they are exported
esConv string = "es" // esConv processes escape sequence(default). | |
rawConv string = "raw" // rawConv is displayed without processing escape sequences as they are. | |
alignConv string = "align" // alignConv is aligned in each column. | |
) | |
const ( | |
generalName string = "general" | |
convEscaped string = "es" // convEscaped processes escape sequence(default). | |
convRaw string = "raw" // convRaw is displayed without processing escape sequences as they are. | |
convAlign string = "align" // convAlign is aligned in each column. | |
) | |
const ( | |
nameGeneral string = "general" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your comment.
That's right. Change.
@@ -120,18 +120,19 @@ func (root *Root) setAlignConverter() { | |||
maxWidths, addRight = m.maxColumnWidths(maxWidths, addRight, ln) | |||
} | |||
|
|||
if !reflect.DeepEqual(m.alignConv.maxWidths, maxWidths) { | |||
if !slices.Equal(m.alignConv.maxWidths, maxWidths) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based of the fact the if starts here and ends with the function, you could do this
if !slices.Equal(m.alignConv.maxWidths, maxWidths) { | |
if slices.Equal(m.alignConv.maxWidths, maxWidths) { | |
return | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, that's right.
// markNext moves to the next mark. | ||
func (root *Root) markNext(context.Context) { | ||
// nextMark moves to the next mark. | ||
func (root *Root) nextMark(context.Context) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This depends on the naming rules of the function name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as I said, why not 😁
This MR contains the following updates: | Package | Update | Change | |---|---|---| | [noborus/ov](https://github.com/noborus/ov) | minor | `v0.36.0` -> `v0.37.0` | MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot). **Proposed changes to behavior should be submitted there as MRs.** --- ### Release Notes <details> <summary>noborus/ov (noborus/ov)</summary> ### [`v0.37.0`](https://github.com/noborus/ov/releases/tag/v0.37.0) [Compare Source](noborus/ov@v0.36.0...v0.37.0) #### What's Changed Thank you for working on this release. [@​aoyama-val](https://github.com/aoyama-val) [@​ccoveille](https://github.com/ccoveille) [@​kapji](https://github.com/kapji) [@​yosagi](https://github.com/yosagi) [@​bprb](https://github.com/bprb) ##### Add a converter Escape sequence support has been changed from essential to selectable as a converter. There are converters: an interpretation of escape sequence (default), `raw`, which does not interpret escape sequence, and `align`. The columns can be shrinked, if the converter is aligned. noborus/ov#609 noborus/ov#610 noborus/ov#611 noborus/ov#612 noborus/ov#614 noborus/ov#615 noborus/ov#617 noborus/ov#618 noborus/ov#619 noborus/ov#623 noborus/ov#624 noborus/ov#625 noborus/ov#626 noborus/ov#627 noborus/ov#631 ##### Change specifications of suspend The suspend is suspended correctly, not sub-shell. Thank you to [@​yosagi](https://github.com/yosagi). - Change to suspend with SIGSTOP by [@​noborus](https://github.com/noborus) in noborus/ov#632 - Send SIGSTOP to the process group by [@​noborus](https://github.com/noborus) in noborus/ov#639 - STDIN switching when using Subshell by [@​noborus](https://github.com/noborus) in noborus/ov#640 ##### Changed redirect specifications - Change to Do not display screen when redirecting by [@​noborus](https://github.com/noborus) in noborus/ov#638 (Fix noborus/ov#634). ##### Fix bugs and improvements - Fix paste mistakes by [@​noborus](https://github.com/noborus) in noborus/ov#616 (Fix noborus/ov#613) - Avoid sector header when marking by [@​noborus](https://github.com/noborus) in noborus/ov#621 (Fix noborus/ov#620) - Change the style-related function name by [@​noborus](https://github.com/noborus) in noborus/ov#628 - help descriptions for better clarity by [@​noborus](https://github.com/noborus) in noborus/ov#635 - Fix the issue where the version contains "-1" by [@​noborus](https://github.com/noborus) in noborus/ov#637 Fix noborus/ov#636) - Fixed root.searcher is race condition by [@​noborus](https://github.com/noborus) in noborus/ov#642 (Fix noborus/ov#641) - Fix linkage of filter documents with headers by [@​noborus](https://github.com/noborus) in noborus/ov#644 - Improve follow/followAll/followSection by [@​noborus](https://github.com/noborus) in noborus/ov#645 - Add support of ANSI escape sequence for clear line by [@​noborus](https://github.com/noborus) in noborus/ov#651 (Fix noborus/ov#650) **Full Changelog**: noborus/ov@v0.36.0...v0.37.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this MR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box --- This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40NDAuNyIsInVwZGF0ZWRJblZlciI6IjM3LjQ0MC43IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiXX0=-->
Change reflect.DeepEqual to slices.Equal.
rightAlign is changed to not reset every time.
Change trimLeft and trimRight to trimmedIndices.
markNext and markPrev are renamed to nextMark and prevMark.