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 border drawing when border width or height == 0 #18

Open
docelic opened this issue Apr 4, 2023 · 1 comment
Open

Fix border drawing when border width or height == 0 #18

docelic opened this issue Apr 4, 2023 · 1 comment

Comments

@docelic
Copy link
Collaborator

docelic commented Apr 4, 2023

The code previously supported either having no border on a particular side, or having a border of 1 cell.
But now border can be of arbitrary width/height, and also a particular side can have border of width or height 0.

Somewhere inside src/widget_rendering.cr#_render there is a part titled "Draw borders".
Its code works on the assumption that if there is a border, its width/height is 1 cell. Having a border of 0c makes the border not show up, but it does overwrite the text in the line.

The part that the code reaches is near the end of the function:

          if (border.bottom == 0) && x != xi && x != xl - 1
            ch = ' '
            if cell != {default_attr, ch}
              lines[y][x].attr = default_attr
              lines[y][x].char = (ch || ' ')
              lines[y].dirty = true
            end
            next
          end     

This code should be adjusted so that a border of 0 on a particular side behaves identically as the no* setting on that side (e.g. like notop or noleft).

@docelic docelic changed the title Fix content drawing when border width or height == 0 Fix border drawing when border width or height == 0 Apr 4, 2023
@docelic
Copy link
Collaborator Author

docelic commented Apr 13, 2023

When resolved, also update Style#border to have a non-nil border object.

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

No branches or pull requests

1 participant