Commit Graph

258 Commits

Author SHA1 Message Date
Michael Lorant
de4601232b
Fix truncate of table cells containing ANSI (#256) 2024-02-02 19:04:43 -05:00
Michael Lorant
92946d34c2
chore: refactor padding functions (#254)
The `padLeft` and `padRight` functions were nearly identical and could
benefit from being refactored to share common code.

A new function called `pad` was added that applies padding based on the
sign of the amount of padding needed. A positive value applies padding
to the right side while a negative value applies padding to the left
side.

Issue: #252

Signed-off-by: Michael Lorant <michael.lorant@nine.com.au>
2024-01-30 22:18:35 -05:00
Michael Lorant
59874c2afa
chore: apply gofumpt to all files (#255)
Apply gofumpt to all files to correct minor formatting issues.

Signed-off-by: Michael Lorant <michael.lorant@nine.com.au>
2024-01-30 17:44:00 -05:00
Michael Lorant
04def9df3e
fix: the empty string can have padding on the right (#253)
An empty string could not have padding applied on the right side.

Issue: #252

Signed-off-by: Michael Lorant <michael.lorant@nine.com.au>
2024-01-30 17:38:39 -05:00
dependabot[bot]
fb3000d55f
chore(deps): bump actions/setup-go from 4 to 5 (#244)
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 4 to 5.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](https://github.com/actions/setup-go/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-07 08:55:19 -03:00
Christian Rocha
d354842a40
feat: Style.Transform for altering strings at render time (#232)
* feat: Style.Transform for altering strings at render time

* feat: add `UnsetTransform`

---------

Co-authored-by: Maas Lalani <maas@lalani.dev>
2023-11-27 14:33:38 -05:00
Julien Ammous
59fcf6fa80
fix(align): fixed help comment (#239) 2023-11-22 15:16:16 -05:00
Reid Mason
49671292f7
fix: Corrected border shorthand functions explanation (#237) 2023-10-20 19:52:10 -04:00
Christian Rocha
b0605d31b2
docs: also link to table examples in the README 2023-10-12 07:30:51 -04:00
Maas Lalani
f093bc1509
Make headers []string (#234)
* fix: make headers `[]string`

* downgrade Lip Gloss to 1.17
2023-10-12 00:53:13 -04:00
Maas Lalani
42db873617
test(table): ensure README example works 2023-10-10 11:32:42 -04:00
Maas Lalani
4476263d05
Feature: Tables (#218)
* feat: tables

* fix(table): examples

* docs(table): `any` -> `string`

* chore: go mod tidy

* docs(table): update image

* fix(table): lint

* fix: remove binary

* chore: color adjustments to pokemon example (#231)

* fix(table): support rendering empty data sets

* chore(table): simplify table's data interface

* fix(table): correct GoDoc + add doc comments to Data methods

---------

Co-authored-by: Christian Rocha <christian@rocha.is>
Co-authored-by: Christian Muehlhaeuser <muesli@gmail.com>
2023-10-10 10:27:52 -04:00
Maas Lalani
408dcf3b9e
feat: add Middle borders (#230) 2023-10-05 12:26:16 -04:00
Ayman Bagabas
93cd5e0d35
feat: bump minimum go version to 1.18 (#216)
* feat: bump minimum go version to 1.18

* chore: bump go version in build.yml

---------

Co-authored-by: Maas Lalani <maas@lalani.dev>
2023-10-05 12:07:18 -04:00
dependabot[bot]
b766f24d45
feat(deps): bump github.com/mattn/go-runewidth from 0.0.14 to 0.0.15 (#215)
Bumps [github.com/mattn/go-runewidth](https://github.com/mattn/go-runewidth) from 0.0.14 to 0.0.15.
- [Commits](https://github.com/mattn/go-runewidth/compare/v0.0.14...v0.0.15)

---
updated-dependencies:
- dependency-name: github.com/mattn/go-runewidth
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-05 12:01:04 -04:00
nervo
b0eb95dbc1
fix(border): both GetHorizontalBorderSize and GetVerticalBorderSize (#225) 2023-10-05 11:48:38 -04:00
nervo
2d2a577e2d
fix(border): GetBorderRightSize (#224) 2023-10-05 11:45:52 -04:00
dependabot[bot]
18166eaa8a
chore(deps): bump actions/checkout from 3 to 4 (#222) 2023-09-05 11:57:55 +00:00
Ayman Bagabas
07d22725d9
chore(ci): bump workflow actions 2023-08-04 13:49:32 -04:00
dependabot[bot]
7611cdfffe
chore(deps): bump golang.org/x/crypto in /examples (#192)
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.0.0-20220307211146-efcb8507fb70 to 0.1.0.
- [Release notes](https://github.com/golang/crypto/releases)
- [Commits](https://github.com/golang/crypto/commits/v0.1.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-04 12:59:17 -04:00
Ayman Bagabas
160ffe826e
fix: cache color profile and background (#212)
* fix: renderer race condition

Guard accessing the underlying Termenv output behind a mutex. Multiple goroutines can set/get the dark background color causing a race condition.

* fix: cache color profile and background

* docs: add comment
2023-08-04 12:58:59 -04:00
Ayman Bagabas
ac8231edce
fix: renderer race condition (#210)
Guard accessing the underlying Termenv output behind a mutex. Multiple goroutines can set/get the dark background color causing a race condition.

Needs: https://github.com/muesli/termenv/pull/146
2023-08-01 08:23:15 -04:00
Christian Rocha
b3bce2366a
chore(docs): add section about tab conversion (#207) 2023-07-24 12:42:34 -04:00
Christian Rocha
01248034d0
chore(lint): add various nolint directives (#206)
Generally run-of-the-mill directives to disable magic number and exhaustive switches. Reasonings should be self explanatory while reading the code and comments, where applicable.
2023-07-24 11:50:04 -04:00
Christian Rocha
df8b3fa1f2
feat: convert tabs to spaces with Style.TabWidth(int) (#204)
* feat: convert tabs to spaces with Style.TabWidth(int)

By default tabs will be converted to 4 spaces. To disable tab
conversion set Style.TabWidth(NoTabConversion).
2023-07-24 11:22:48 -04:00
Christian Muehlhaeuser
233079e2d9 fix: go mod tidy examples 2023-06-28 17:01:41 +02:00
Carlos Alexandro Becker
3556cdfa89
feat(deps): update termenv (#202)
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2023-06-27 12:07:45 -03:00
bashbunni
859b49e848
docs: add FAQ (#189)
* docs: add FAQ

* chore(docs): update encoding/locale answer in FAQ

* chore(docs): update color profile disclaimer

* chore(docs): faq copyedits

* chore(docs): additional faq copy edits

* fix(docs): add missing closing code block in faq

---------

Co-authored-by: Christian Rocha <christian@rocha.is>
2023-05-23 11:58:52 -07:00
bashbunni
9bc85709f2
docs: add issue template (#193)
* docs: add issue template

* chore(template): add locale
2023-05-23 11:58:18 -07:00
Ayman Bagabas
97bf676aa0
fix(ci): remove soft-serve workflow 2023-05-12 14:11:20 -04:00
Carlos Alexandro Becker
63540b90ab
docs: update license
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2023-05-11 12:39:34 +00:00
mieubrisse
7fef6782b8 Undo additions to .gitignore 2023-05-01 09:37:20 -04:00
mieubrisse
4c3e61d4d1 Fix bugs with border size calculation 2023-05-01 09:37:20 -04:00
dependabot[bot]
da2d04b534 chore(deps): bump actions/checkout from 3.4.0 to 3.5.0
Bumps [actions/checkout](https://github.com/actions/checkout) from 3.4.0 to 3.5.0.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3.4.0...v3.5.0)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-25 08:24:43 +01:00
dependabot[bot]
06dd20ee57 chore(deps): bump actions/checkout from 3.3.0 to 3.4.0
Bumps [actions/checkout](https://github.com/actions/checkout) from 3.3.0 to 3.4.0.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3.3.0...v3.4.0)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-16 11:05:48 +01:00
dependabot[bot]
403643d322 chore(deps): bump actions/setup-go from 2 to 4
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 2 to 4.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](https://github.com/actions/setup-go/compare/v2...v4)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-16 11:05:16 +01:00
Glenn Gonda
303724f7da
docs: fix typos and clean up comments (#182) 2023-03-12 11:04:42 +01:00
Glenn Gonda
53cc780a5a chore: use io pkg for Discard 2023-03-12 05:26:34 +01:00
Carlos Alexandro Becker
9afe8e2952
fix: retract v0.7.0 (#181)
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
2023-03-10 10:28:23 -03:00
Christian Muehlhaeuser
c43b22e00f chore: bump termenv to v0.15.1 2023-03-09 19:54:32 +01:00
Ayman Bagabas
7f47f0b5e0 fix(renderer): use termenv default renderer
Creating a _new_ global termenv output clashes with the default global
termenv output leading the terminal to block and freeze.
Share the default termenv output with the global default lipgloss renderer.
2023-03-09 19:38:42 +01:00
Christian Rocha
19ca9a3f8c
docs: renderer documentation (#175)
* docs(readme): add some context to the examples

* docs(readme): revert to render-function-based initial example

* docs(readme): drop extraneous stringer usage

* docs(readme): copyedits

* docs(renderer): minor documentation improvements

* docs(readme): edit renderer section to focus on custom outputs

* docs(readme): for now just use SetString to illustrate stringer

* docs(readme): re-add Ayman's clever stringer example

* docs(examples): tidy up wish example

* docs(examples): improve wish example

* docs(examples): session is an io.Writer

Co-authored-by: Ayman Bagabas <ayman.bagabas@gmail.com>

* docs(examples): add missing pty argument

Co-authored-by: Ayman Bagabas <ayman.bagabas@gmail.com>

* docs(example): remove extra space

* fix(examples): use termenv output

---------

Co-authored-by: Ayman Bagabas <ayman.bagabas@gmail.com>
2023-03-08 14:51:26 -05:00
Ayman Bagabas
b3440ac41f feat(go): bump termenv to v0.15 2023-03-08 09:54:27 -08:00
Ayman Bagabas
c5382b35ef ref(renderer): change renderer impl 2023-03-08 09:54:27 -08:00
László GÖRÖG
d09532a91a chore: unify get border size function names 2023-03-08 09:16:03 -05:00
Ayman Bagabas
4eea195dfa feat(go): upgrade golang to 1.17
feat(examples): upgrade golang to 1.17
2023-03-07 16:44:08 +01:00
István Donkó
1eab58f1d8 docs: fix the description of MaxHeight 2023-03-01 13:58:42 +01:00
Christian Muehlhaeuser
a74950e6da fix: don't concurrently change output profiles
Multiple lipgloss renderer instances can end up using the same default
termenv.Output. This leads to a race condition when manipulating the
ColorProfile concurrently.

We could mutex protect the standard output in termenv, but it feels like
a weak promise, as the rest of the Output wouldn't (and probably
shouldn't) get protected. Protecting it in lipgloss itself would require
a global lock however.

I can't come up with a proper use-case for this scenario, and therefore
we shift this responsibility to the user.
2023-02-22 17:28:33 +01:00
Ayman Bagabas
776c15f0da chore(examples): update ssh example
chore(examples): go mod tidy
2023-02-09 11:59:54 -05:00
Ayman Bagabas
5e2b9055dc docs: update readme 2023-02-09 11:59:54 -05:00