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

Ability to parse both background and foreground colors. #210

Open
wants to merge 93 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
6dca0eb
Added code of conduct
mjarkk Apr 27, 2019
f685acd
Added code of conduct (#2)
mjarkk Apr 27, 2019
65defda
Created templates
glvr182 Apr 27, 2019
70c5401
Changed all refrences from jroimartin to awesome-gocui
mjarkk Apr 27, 2019
c7fd251
Changed all refrences from jroimartin to awesome-gocui (#5)
mjarkk Apr 27, 2019
3744626
Added pr template
glvr182 Apr 27, 2019
9829f51
Added contributors guide
glvr182 Apr 27, 2019
23d04c9
Merge pull request #9 from glvr182/feature/contributors-guide
glvr182 Apr 27, 2019
f50da5a
Visually wide character support
frizinak Nov 5, 2016
8e407b7
default to input mode of InputEsc
jesseduffield Jun 5, 2018
d1cbd48
Ignore char keys when in an editable panel
jesseduffield Jun 5, 2018
d9a7952
bold highlighted text
jesseduffield Jun 5, 2018
8d3fcc6
support collapsed edges (WIP)
jesseduffield Aug 5, 2018
e572e63
revert bolding of box character
jesseduffield Aug 5, 2018
1dc2347
disable overlapping views for now
jesseduffield Aug 5, 2018
c50a372
defining overlapping edge support in the Gui constructor
jesseduffield Aug 5, 2018
2fb90d3
make view dimensions accessible
jesseduffield Aug 12, 2018
a80ffd8
use dimensions method rather than function
jesseduffield Aug 12, 2018
6c1b364
flush the gui before polling for any events
jesseduffield Aug 13, 2018
f27fbaa
enforce that keybindings can only be handled by a single handler, pri…
jesseduffield Aug 21, 2018
b2e97d2
ignore global rune keybindings on editable views
jesseduffield Aug 24, 2018
32c5b9b
move cursor directly rather than through function because the old way…
jesseduffield Sep 5, 2018
4ff4056
support subtitles on panels
jesseduffield Sep 5, 2018
d6ff636
use jesse's fork of termbox which handles poll event errors
jesseduffield Sep 19, 2018
6aacc83
view.go: add ViewLinesHeight()
remyabel2 Sep 17, 2018
44898ff
missed a couple of imports that I need to switch to my fork of termbox
jesseduffield Sep 19, 2018
4869a57
use LinesHeight instead of ViewLinesHeight
jesseduffield Sep 21, 2018
9673d56
convert tab runes to 4 spaces
jesseduffield Dec 9, 2018
6c25764
don't truncate lines on wrapped views
jesseduffield Jan 15, 2019
219f0b0
use go-errors package to give stack traces to new errors
jesseduffield Feb 11, 2019
53e7c0b
use standard errors when defining package level errors and wrap when …
jesseduffield Feb 15, 2019
605f01c
add loader animations to views with the HasLoader bool set
jesseduffield Feb 15, 2019
569bfa3
stop polling termbox events after closing the gui
jesseduffield Mar 3, 2019
106cbe4
fix performance issue causing high cpu drain
jesseduffield Mar 5, 2019
b2f96ac
don't write subtitle outside of view's bounds
jesseduffield Apr 9, 2019
95d85f5
support views of height 1 or even negative height
jesseduffield Apr 26, 2019
62396a4
Merge remote-tracking branch 'origin/master' into merge-jesseduffield…
mjarkk Apr 27, 2019
14f6d58
Changed the user imports to the organizations it's repo
mjarkk Apr 27, 2019
fb41ca5
Made examples compilable
mjarkk Apr 27, 2019
563a1c8
Most examples work but there are still problems
mjarkk Apr 27, 2019
8bdd321
The examples now don't error on exit
mjarkk Apr 28, 2019
76fa877
The examples now don't error on exit
mjarkk Apr 28, 2019
059fa98
Made the gobot happy
mjarkk Apr 28, 2019
9a62783
Added note at the top of the stdin example
mjarkk Apr 28, 2019
c62d980
Moved to loader to component
mjarkk Apr 29, 2019
f4d7a4b
Merge jesseduffields master (#8)
mjarkk Apr 29, 2019
8668cab
Improve get terminal window size in the docker container #15
skanehira Apr 28, 2019
5b7b2af
fixed some
skanehira Apr 28, 2019
4d77d32
Merge pull request #18 from awesome-gocui/improveGetTermWindowSize
glvr182 Apr 29, 2019
fd0c729
Added go mod files
glvr182 Apr 27, 2019
ad0ed37
Updated go mod file
glvr182 Apr 29, 2019
6a2a164
Merge pull request #21 from glvr182/feature/go-mod
glvr182 Apr 30, 2019
f0af933
Added changes
mjarkk May 18, 2019
68c8f54
Fixed a sugestion
mjarkk May 18, 2019
5e449e9
Added changes a view changes from jesseduffield fork (#23)
mjarkk May 19, 2019
3afa000
Fixed go mod
glvr182 May 28, 2019
8134275
Added circle-ci config
glvr182 May 28, 2019
dc479ab
Added badges to readme
glvr182 May 28, 2019
7a44180
Merge branch 'feature/automation'
glvr182 May 28, 2019
9646e38
Merge branch 'community_merges' from RIscRIpt
RIscRIpt Jun 24, 2019
188c59e
Fixed formatting
glvr182 Jun 24, 2019
6c6b519
Merge branch 'feature/formatting'
glvr182 Jun 24, 2019
17da2ee
Added some information about this fork
mjarkk Jun 25, 2019
eabbdda
Trivial typo fix
justinclift Jun 30, 2019
1178df4
Merge pull request #27 from justinclift/patch-1
glvr182 Jun 30, 2019
3b583fb
Change edition mode to editing mode in documentation
ibnesayeed Jul 2, 2019
c6f7a7b
Fixed readme code example
JLevconoks-Sky Jul 12, 2019
f92294d
Merge pull request #29 from JLevconoks/readme_fix
glvr182 Jul 12, 2019
209c645
Merge pull request #28 from ibnesayeed/edit
glvr182 Jul 15, 2019
ff771a7
Fix build on Windows
mattn Aug 13, 2019
a0714e1
Fix comment
mattn Aug 14, 2019
64e9199
Merge pull request #32 from mattn/windows
skanehira Aug 14, 2019
bc0690d
Make IsUnknownView(nil) and IsQuit(nil) return false
josharian Aug 26, 2019
4deda6b
Improve docs
josharian Aug 26, 2019
95f3736
Add lazygit to README
josharian Aug 26, 2019
a0e4508
Merge pull request #34 from josharian/check-nil-err
glvr182 Aug 26, 2019
4194559
Add lazydocker to readme (#35)
mjarkk Aug 26, 2019
0ad6ed3
Pad syscall correctly in getTermWindowSize
josharian Aug 26, 2019
4e340cb
Merge pull request #36 from josharian/fix-syscall-size
glvr182 Aug 27, 2019
036856b
Fix manual bounds checks in View.SetLine
josharian Sep 6, 2019
446ca33
Merge pull request #38 from josharian/fix-bounds-check
glvr182 Sep 6, 2019
210b6ef
Fix another manual bounds check
josharian Sep 9, 2019
f8bfb59
Fix another manual bounds check (#40)
mjarkk Sep 9, 2019
cf624e3
View: Use mutex lock when writing
glvr182 Sep 9, 2019
e40d63c
View: Use mutex when clearing
glvr182 Sep 9, 2019
d0b5cfa
Merge branch 'feature/safety'
glvr182 Sep 10, 2019
da1361c
View: Added ViewLinesHeight()
glvr182 Sep 9, 2019
8c37133
View: Added IsTained()
glvr182 Sep 9, 2019
6dc74ec
Edit: Added editor functions
glvr182 Sep 9, 2019
57f0125
Gui: Added SetViewBeneath()
glvr182 Sep 9, 2019
ce41128
Keybinding: Added keybind parsing
glvr182 Sep 12, 2019
a7ae619
Keybinding: Added blacklist / whitelist support
glvr182 Oct 12, 2019
c9d3c2b
Merge branch 'feature/utils'
glvr182 Oct 20, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
version: 2
jobs:
build:
working_directory: /go/src/github.com/glvr182/git-profile

docker:
- image: circleci/golang:1.12

steps:
- checkout
- run:
name: go mod
command: go mod tidy
- run:
name: go fmt
command: |
if [ $(find . ! -path "./vendor/*" -name "*.go" -exec gofmt -s -d {} \;|wc -l) -gt 0 ]; then
find . ! -path "./vendor/*" -name "*.go" -exec gofmt -s -d {} \;
exit 1;
fi
- run:
name: go build
command: |
cd _examples/
for file in *.go
do
go build $file
done

workflows:
version: 2
build:
jobs:
- build
29 changes: 29 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
name: Bug report
about: Create a report to help us improve
title: "[BUG]"
labels: bug
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Environment (please complete the following information):**
- OS: [e.g. Linux]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
17 changes: 17 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: ''

---

**Describe the feature you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
15 changes: 15 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE/pull_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
name: Pull request
about: Create a pull request to solve an issue
title: ""
labels:
assignees: ''

---

**Related issue**

**Describe the fix**

**Screenshots**
If applicable, add screenshots to help explain your implementation.
76 changes: 76 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at [email protected]. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq
33 changes: 33 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Contributing

Everyone is welcome to help make gocui better!

When contributing to this repository, please first discuss the change you wish
to make via issue, email, or any other method with the owners of this repository
before making a change.

## So all code changes happen through Pull Requests
Pull requests are the best way to propose changes to the codebase. We actively
welcome your pull requests:

1. Fork the repo and create your branch from `master` with a name like `feature/contributors-guide`.
2. If you've added code that should be tested, add tests.
3. If you've added code that need documentation, update the documentation.
4. Make sure your code follows the [effective go](https://golang.org/doc/effective_go.html) guidelines as much as possible.
5. Be sure to test your modifications.
6. Make sure your branch is up to date with the master branch.
7. Write a [good commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
8. Create that pull request!

## Code of conduct
Please note by participating in this project, you agree to abide by the [code of conduct].

[code of conduct]: https://github.com/awesome-gocui/gocui/blob/master/CODE-OF-CONDUCT.md

## Any contributions you make will be under the license indicated in the [license](LICENSE.md)
In short, when you submit code changes, your submissions are understood to be
under the same license as the rest of project. Feel free to contact the maintainers if that's a concern.

## Report bugs using Github's [issues](https://github.com/awesome-gocui/gocui/issues)
We use GitHub issues to track public bugs. Report a bug by [opening a new
issue](https://github.com/awesome-gocui/gocui/issues/new); it's that easy!
49 changes: 37 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
# GOCUI - Go Console User Interface
[![CircleCI](https://circleci.com/gh/awesome-gocui/gocui/tree/master.svg?style=svg)](https://circleci.com/gh/awesome-gocui/gocui/tree/master)
[![CodeCov](https://codecov.io/gh/awesome-gocui/gocui/branch/master/graph/badge.svg)](https://codecov.io/gh/awesome-gocui/gocui)
[![Go Report Card](https://goreportcard.com/badge/github.com/awesome-gocui/gocui)](https://goreportcard.com/report/github.com/awesome-gocui/gocui)
[![GolangCI](https://golangci.com/badges/github.com/awesome-gocui/gocui.svg)](https://golangci.com/badges/github.com/awesome-gocui/gocui.svg)
[![GoDoc](https://godoc.org/github.com/awesome-gocui/gocui?status.svg)](https://godoc.org/github.com/awesome-gocui/gocui)
![GitHub tag (latest SemVer)](https://img.shields.io/github/tag/awesome-gocui/gocui.svg)

[![GoDoc](https://godoc.org/github.com/jroimartin/gocui?status.svg)](https://godoc.org/github.com/jroimartin/gocui)

Minimalist Go package aimed at creating Console User Interfaces.
Minimalist Go package aimed at creating Console User Interfaces.
A community fork based on the amazing work of [jroimartin](https://github.com/jroimartin/gocui)

## Features

Expand All @@ -13,29 +18,44 @@ Minimalist Go package aimed at creating Console User Interfaces.
* Global and view-level keybindings.
* Mouse support.
* Colored text.
* Customizable edition mode.
* Customizable editing mode.
* Easy to build reusable widgets, complex layouts...

## About fork

This fork has many improvements over the original work from [jroimartin](https://github.com/jroimartin/gocui).

* Better wide character support
* Support for 1 Line height views
* Better support for running in docker container
* Customize frame colors
* Improved code comments and quality
* Many small improvements
* Change Visibility of views

For information about this org see: [awesome-gocui/about](https://github.com/awesome-gocui/about).

## Installation

Execute:

```
$ go get github.com/jroimartin/gocui
$ go get github.com/awesome-gocui/gocui
```

## Documentation

Execute:

```
$ go doc github.com/jroimartin/gocui
$ go doc github.com/awesome-gocui/gocui
```

Or visit [godoc.org](https://godoc.org/github.com/jroimartin/gocui) to read it
Or visit [godoc.org](https://godoc.org/github.com/awesome-gocui/gocui) to read it
online.

## Example
See the [_example](./_example/) folder for more examples

```go
package main
Expand All @@ -44,11 +64,11 @@ import (
"fmt"
"log"

"github.com/jroimartin/gocui"
"github.com/awesome-gocui/gocui"
)

func main() {
g, err := gocui.NewGui(gocui.OutputNormal)
g, err := gocui.NewGui(gocui.OutputNormal, false)
if err != nil {
log.Panicln(err)
}
Expand All @@ -60,18 +80,21 @@ func main() {
log.Panicln(err)
}

if err := g.MainLoop(); err != nil && err != gocui.ErrQuit {
if err := g.MainLoop(); err != nil && !gocui.IsQuit(err) {
log.Panicln(err)
}
}

func layout(g *gocui.Gui) error {
maxX, maxY := g.Size()
if v, err := g.SetView("hello", maxX/2-7, maxY/2, maxX/2+7, maxY/2+2); err != nil {
if err != gocui.ErrUnknownView {
if v, err := g.SetView("hello", maxX/2-7, maxY/2, maxX/2+7, maxY/2+2, 0); err != nil {
if !gocui.IsUnknownView(err) {
return err
}
fmt.Fprintln(v, "Hello world!")
if _, err := g.SetCurrentView("hello"); err != nil {
return err
}
}
return nil
}
Expand Down Expand Up @@ -106,5 +129,7 @@ func quit(g *gocui.Gui, v *gocui.View) error {
* [fac](https://github.com/mkchoi212/fac): git merge conflict resolver
* [jsonui](https://github.com/gulyasm/jsonui): Interactive JSON explorer for your terminal.
* [cointop](https://github.com/miguelmota/cointop): Interactive terminal based UI application for tracking cryptocurrencies.
* [lazygit](https://github.com/jesseduffield/lazygit): simple terminal UI for git commands.
* [lazydocker](https://github.com/jesseduffield/lazydocker): The lazier way to manage everything docker.

Note: if your project is not listed here, let us know! :)
22 changes: 11 additions & 11 deletions _examples/active.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"fmt"
"log"

"github.com/jroimartin/gocui"
"github.com/awesome-gocui/gocui"
)

var (
Expand Down Expand Up @@ -49,8 +49,8 @@ func nextView(g *gocui.Gui, v *gocui.View) error {

func layout(g *gocui.Gui) error {
maxX, maxY := g.Size()
if v, err := g.SetView("v1", 0, 0, maxX/2-1, maxY/2-1); err != nil {
if err != gocui.ErrUnknownView {
if v, err := g.SetView("v1", 0, 0, maxX/2-1, maxY/2-1, 0); err != nil {
if !gocui.IsUnknownView(err) {
return err
}
v.Title = "v1 (editable)"
Expand All @@ -62,25 +62,25 @@ func layout(g *gocui.Gui) error {
}
}

if v, err := g.SetView("v2", maxX/2-1, 0, maxX-1, maxY/2-1); err != nil {
if err != gocui.ErrUnknownView {
if v, err := g.SetView("v2", maxX/2-1, 0, maxX-1, maxY/2-1, 0); err != nil {
if !gocui.IsUnknownView(err) {
return err
}
v.Title = "v2"
v.Wrap = true
v.Autoscroll = true
}
if v, err := g.SetView("v3", 0, maxY/2-1, maxX/2-1, maxY-1); err != nil {
if err != gocui.ErrUnknownView {
if v, err := g.SetView("v3", 0, maxY/2-1, maxX/2-1, maxY-1, 0); err != nil {
if !gocui.IsUnknownView(err) {
return err
}
v.Title = "v3"
v.Wrap = true
v.Autoscroll = true
fmt.Fprint(v, "Press TAB to change current view")
}
if v, err := g.SetView("v4", maxX/2, maxY/2, maxX-1, maxY-1); err != nil {
if err != gocui.ErrUnknownView {
if v, err := g.SetView("v4", maxX/2, maxY/2, maxX-1, maxY-1, 0); err != nil {
if !gocui.IsUnknownView(err) {
return err
}
v.Title = "v4 (editable)"
Expand All @@ -94,7 +94,7 @@ func quit(g *gocui.Gui, v *gocui.View) error {
}

func main() {
g, err := gocui.NewGui(gocui.OutputNormal)
g, err := gocui.NewGui(gocui.OutputNormal, true)
if err != nil {
log.Panicln(err)
}
Expand All @@ -113,7 +113,7 @@ func main() {
log.Panicln(err)
}

if err := g.MainLoop(); err != nil && err != gocui.ErrQuit {
if err := g.MainLoop(); err != nil && !gocui.IsQuit(err) {
log.Panicln(err)
}
}
Loading