cpp-terminal icon indicating copy to clipboard operation
cpp-terminal copied to clipboard

align the row / col parameters

Open MCWertGaming opened this issue 2 years ago • 2 comments

Currently it's really hard to figure out whether the function takes (row, col) or (col, row) as argument which is really confusing. Also I have noticed a few other things that don't work out that well:

  • [x] align row / col parameters for all functions #191
  • [x] change get_term_size() to return a std::tuple #191
  • [ ] create functions for centering content

MCWertGaming avatar Aug 19 '22 09:08 MCWertGaming

Hi, maybe returning a class with width weigth would be better ?

And use std::size_t windows is complaining about int to size_t convertion and size_t seams really a good type for a size of a window

flagarde avatar Aug 19 '22 14:08 flagarde

A class?

std::tuple is basically what rust, GO, many others use, like

std::tuple<size_t, size_t> get_term_size() {
  return std::tuple<size_t, size_t>(width, hight)
}

int main() {
  auto width, height = get_term_size();
}

Most C++ libraries do that for multiple returns because it's parts of C++17

For the size_t and int conversion: Yeah I have had those problems too, idk why int was used, especially because it will cause a lot of problems on big screens (size_t is a uint64_t, while int is int32_t).

MCWertGaming avatar Aug 19 '22 19:08 MCWertGaming