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

x, y parameters are unsigned; C API has defined behavior for values under 0. #62

Open
mpatraw opened this issue Mar 16, 2016 · 0 comments

Comments

@mpatraw
Copy link

mpatraw commented Mar 16, 2016

Since the C API has well defined behavior for values under 0 for the x,y coordinates, I feel like it's incorrect to place such a restriction on the Rust API via usize. Here's the relevant termbox code: https://github.com/nsf/termbox/blob/master/src/termbox.c#L226

void tb_put_cell(int x, int y, const struct tb_cell *cell)
{
    if ((unsigned)x >= (unsigned)back_buffer.width)
        return;
    if ((unsigned)y >= (unsigned)back_buffer.height)
        return;
    CELL(&back_buffer, x, y) = *cell;
}

This also would allow for print to be used offscreen and correctly clip the few first characters off screen without any funky splice logic.

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