There are many "interesting" cases:
- logical content is wider than display width (long lines).
In this case, we truncate.
- logical content is smaller than display height (fewer lines
than visible).
In this case, we pad with empty lines up to the specified height.
- logical content is higher than display height (more lines than
visible).
In this case, we truncate.
- style specifies a width wider than the display width.
In this case, we ignore the style width and
fit in the display width.
- style specifies a height higher than the display height.
Same as width, we ignore the style and fit in the display height.
- style specifies a narrower width or smaller height than the display.
In this case we obey the style.
* Extract char navigation in separate function.
* Make wordLeft/wordRight find words on the prev/next line
... if there's no word on the current line to find any more.
* Support uppercase/lowercase/capitalize commands.
* Add transpose
This reverts the code back to the logic from 4ce16e8 which fixed the
issue of the cursor not being moved when an initial value was set with
SetValue.
The fix regressed in 16053f4.
* Add spinner.New test
Signed-off-by: Leandro López (inkel) <inkel.ar@gmail.com>
* Add spinner.Option type and spinner.WithSpinner option
Signed-off-by: Leandro López (inkel) <inkel.ar@gmail.com>
* Allow passing options in spinner.New
This doesn't break existing code as it uses variadic arguments, so
any existing code as the following should continue to work:
s := spinner.New()
s.spinner = spinner.Dot
This change allows for instead of those two lines, having a call:
s := spinner.New(spinner.WithSpinner(spinner.Dot))
Signed-off-by: Leandro López (inkel) <inkel.ar@gmail.com>
* Add spinner.WithX option for each spinner.Spinner
Signed-off-by: Leandro López (inkel) <inkel.ar@gmail.com>
* Refactor spinner tests
Signed-off-by: Leandro López (inkel) <inkel.ar@gmail.com>
* Add spinner.WithStyle option function
Signed-off-by: Leandro López (inkel) <inkel.ar@gmail.com>
* refactor: remove With... Spinner aliases
Co-authored-by: Maas Lalani <maas@lalani.dev>
* feat: allow to set the height of the item
The user might want to show more than 2 lines, and, right now, if they
try to do so, things break.
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
* fix: short-circuit if width <= 0
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
* fix: height check
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>