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

Fix ASCII Table shrinkage #629

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion oviewer/convert_align.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,14 @@ func (a *align) convertDelm(src contents) contents {
dst := make(contents, 0, len(src))

s := 0
if indexes[0][0] == 0 {
if len(indexes) == 1 {
return src
}
dst = append(dst, src[0:indexes[0][1]]...)
s = indexes[0][1]
indexes = indexes[1:]
}
Comment on lines +87 to +94
Copy link
Contributor

Choose a reason for hiding this comment

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

This code is so cryptic 😅

I'm thinking about using this just after you checked indexes is not empty

firstEntry := indexes[0]

Then you could use a better name than s for firstEntry[0]

Also adding comments won't kill you you know.

My message is somehow a "clean your room, mom" post it 😬😂

Copy link
Owner Author

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.
It was difficult to understand and had a problem, so I will change it significantly.

for c := 0; c < len(indexes); c++ {
e := pos.x(indexes[c][0])
width := e - s
Expand All @@ -93,7 +101,7 @@ func (a *align) convertDelm(src contents) contents {

// shrink column.
if a.isShrink(c) {
if s == 0 {
if c == 0 {
dst = appendShrink(dst, nil)
} else {
dst = appendShrink(dst, src[s:s+delmWidth])
Expand Down