jesseduffield.lazygit/pkg/gocui
Stefan Haller 811b3fbdd1 Show the search status of what a re-rendered view now holds
Rendering a view's content again while a search is on leaves the "x of y"
describing the content that has just been replaced. The status is worked
out when the search is typed and again when a key steps through the
matches, and a render is neither. Change the diff context size while
searching the focused main view, and the count stays as it was, however
many matches the wider context brought in or took away.

Run the search again over the new content once the render has finished
putting it there.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-05 15:09:52 +02:00
..
attribute.go Bump tcell dependency to v3 2026-04-30 22:14:26 +02:00
AUTHORS Copy gocui files into lazygit repo under pkg/gocui 2026-04-30 14:29:08 +02:00
block_events_test.go Add gocui primitives to block input during an operation 2026-07-17 12:32:32 +02:00
CHANGES_tcell.md Copy gocui files into lazygit repo under pkg/gocui 2026-04-30 14:29:08 +02:00
CODE_OF_CONDUCT.md Copy gocui files into lazygit repo under pkg/gocui 2026-04-30 14:29:08 +02:00
CONTRIBUTING.md Copy gocui files into lazygit repo under pkg/gocui 2026-04-30 14:29:08 +02:00
doc.go Remove dead Modifier field from keybindings 2026-05-06 09:51:23 +02:00
double_click_test.go Remove error return value from functions that always return nil 2026-08-31 20:41:22 +02:00
edit.go Add a helper for recognizing printable keys 2026-08-31 20:41:22 +02:00
escape.go Snapshot the view width for command-task rendering on the UI thread 2026-07-17 12:35:54 +02:00
escape_test.go Materialize cursor-forward escapes as space runs 2026-07-03 18:47:15 +02:00
flush_test.go Make the user-event queue unbounded 2026-07-15 10:14:05 +02:00
gui.go Draw embedded views as one focused unit 2026-08-31 20:41:22 +02:00
gui_others.go Copy gocui files into lazygit repo under pkg/gocui 2026-04-30 14:29:08 +02:00
gui_windows.go Fix linter warnings 2026-04-30 14:29:08 +02:00
key.go Add a helper for recognizing printable keys 2026-08-31 20:41:22 +02:00
key_test.go Add a helper for recognizing printable keys 2026-08-31 20:41:22 +02:00
keybinding.go Remove dead Modifier field from keybindings 2026-05-06 09:51:23 +02:00
LICENSE Copy gocui files into lazygit repo under pkg/gocui 2026-04-30 14:29:08 +02:00
mouse_capture_test.go Remove error return value from functions that always return nil 2026-08-31 20:41:22 +02:00
parent_view_test.go Draw embedded views as one focused unit 2026-08-31 20:41:22 +02:00
README.md Copy gocui files into lazygit repo under pkg/gocui 2026-04-30 14:29:08 +02:00
scrollbar.go Copy gocui files into lazygit repo under pkg/gocui 2026-04-30 14:29:08 +02:00
scrollbar_test.go Copy gocui files into lazygit repo under pkg/gocui 2026-04-30 14:29:08 +02:00
search_test.go Work the search positions out when they are read, not on each line written 2026-09-05 15:09:52 +02:00
suspend_test.go Schedule a redraw when resuming from suspension 2026-07-20 14:23:09 +02:00
task.go Exclude view-buffer render tasks from the busy query 2026-07-07 18:09:33 +02:00
task_manager.go Fix a deadlock between task.Done() and the integration test's idle wait 2026-07-15 15:01:04 +02:00
task_manager_test.go Fix a deadlock between task.Done() and the integration test's idle wait 2026-07-15 15:01:04 +02:00
tcell_driver.go Remove a few unnecessary parentheses 2026-08-13 20:40:11 +02:00
tcell_driver_test.go Deliver mouse release after a drag 2026-07-31 08:22:35 +02:00
text_area.go Exclude more commit trailers from auto-wrapping 2026-08-02 19:22:34 +02:00
text_area_test.go Exclude more commit trailers from auto-wrapping 2026-08-02 19:22:34 +02:00
ui_thread_test.go Give up waiting for the UI thread once the main loop has exited 2026-08-12 13:03:26 +02:00
user_event_queue_test.go Log the user-event queue's high-water mark 2026-07-15 10:14:05 +02:00
view.go Show the search status of what a re-rendered view now holds 2026-09-05 15:09:52 +02:00
view_test.go Use lo.Map instead of manual append loops 2026-08-16 16:35:11 +02:00

GOCUI - Go Console User Interface

CircleCI CodeCov Go Report Card GolangCI GoDoc GitHub tag (latest SemVer)

Minimalist Go package aimed at creating Console User Interfaces. A community fork based on the amazing work of jroimartin

Features

  • Minimalist API.
  • Views (the "windows" in the GUI) implement the interface io.ReadWriter.
  • Support for overlapping views.
  • The GUI can be modified at runtime (concurrent-safe).
  • Global and view-level keybindings.
  • Mouse support.
  • Colored text.
  • Customizable editing mode.
  • Easy to build reusable widgets, complex layouts...

About fork

This fork has many improvements over the original work from jroimartin.

  • Written ontop of TCell
  • 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.

Installation

Execute:

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

Documentation

Execute:

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

Or visit godoc.org to read it online.

Example

See the _example folder for more examples

package main

import (
	"fmt"
	"log"

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

func main() {
	g, err := gocui.NewGui(gocui.OutputNormal, true)
	if err != nil {
		log.Panicln(err)
	}
	defer g.Close()

	g.SetManagerFunc(layout)

	if err := g.SetKeybinding("", gocui.KeyCtrlC, gocui.ModNone, quit); err != nil {
		log.Panicln(err)
	}

	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, 0); err != nil {
		if !gocui.IsUnknownView(err) {
			return err
		}

		if _, err := g.SetCurrentView("hello"); err != nil {
			return err
		}

		fmt.Fprintln(v, "Hello world!")
	}

	return nil
}

func quit(g *gocui.Gui, v *gocui.View) error {
	return gocui.ErrQuit
}

Screenshots

r2cui

_examples/demo.go

_examples/dynamic.go

Projects using gocui

  • komanda-cli: IRC Client For Developers.
  • vuls: Agentless vulnerability scanner for Linux/FreeBSD.
  • wuzz: Interactive cli tool for HTTP inspection.
  • httplab: Interactive web server.
  • domainr: Tool that checks the availability of domains based on keywords.
  • gotime: Time tracker for projects and tasks.
  • claws: Interactive command line client for testing websockets.
  • terminews: Terminal based RSS reader.
  • diagram: Tool to convert ascii arts into hand drawn diagrams.
  • pody: CLI app to manage Pods in a Kubernetes cluster.
  • kubexp: Kubernetes client.
  • kcli: Tool for inspecting kafka topics/partitions/messages.
  • fac: git merge conflict resolver
  • jsonui: Interactive JSON explorer for your terminal.
  • cointop: Interactive terminal based UI application for tracking cryptocurrencies.
  • lazygit: simple terminal UI for git commands.
  • lazydocker: The lazier way to manage everything docker.

Note: if your project is not listed here, let us know! :)