Drop ncurses dependency
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Close #818
authored by Junegunn Choi · committed by Junegunn Choi · parent 6ccc12c · Browse files · 11 files·+135 added−22 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
11 files+135 added−22 removed
- other:+135 added−22 removed
Provenance
- Commit
ff248d5- Tree
b716bb6- Author
Junegunn Choi <junegunn.c@gmail.com>- Committer
Junegunn Choi <junegunn.c@gmail.com>- Parent
6ccc12c
11 files changed+135 added−22 removed
modified:man/man1/fzf-tmux.1+1 added-1 removed
19 unmodified lines20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN22 THE SOFTWARE.23 ..24-.TH fzf-tmux 1 "Jan 2017" "fzf 0.16.1" "fzf-tmux - open fzf in tmux split pane"24+.TH fzf-tmux 1 "Jan 2017" "fzf 0.16.2" "fzf-tmux - open fzf in tmux split pane"25 26 .SH NAME27 fzf-tmux - open fzf in tmux split pane28 26 unmodified linesmodified:man/man1/fzf.1+1 added-1 removed
19 unmodified lines20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN22 THE SOFTWARE.23 ..24-.TH fzf 1 "Jan 2017" "fzf 0.16.1" "fzf - a command-line fuzzy finder"24+.TH fzf 1 "Jan 2017" "fzf 0.16.2" "fzf - a command-line fuzzy finder"25 26 .SH NAME27 fzf - a command-line fuzzy finder28 525 unmodified linesadded:src/tui/dummy.go+45 added
1+// +build !ncurses2+// +build !tcell3+// +build !windows4+5+package tui6+7+type Attr int8+9+func HasFullscreenRenderer() bool {10+ return false11+}12+13+func (a Attr) Merge(b Attr) Attr {14+ return a | b15+}16+17+const (18+ AttrRegular Attr = Attr(0)19+ Bold = Attr(1)20+ Dim = Attr(1 << 1)21+ Italic = Attr(1 << 2)22+ Underline = Attr(1 << 3)23+ Blink = Attr(1 << 4)24+ Blink2 = Attr(1 << 5)25+ Reverse = Attr(1 << 6)26+)27+28+func (r *FullscreenRenderer) Init() {}29+func (r *FullscreenRenderer) Pause() {}30+func (r *FullscreenRenderer) Clear() {}31+func (r *FullscreenRenderer) Refresh() {}32+func (r *FullscreenRenderer) Close() {}33+34+func (r *FullscreenRenderer) Resume() bool { return false }35+func (r *FullscreenRenderer) DoesAutoWrap() bool { return false }36+func (r *FullscreenRenderer) IsOptimized() bool { return false }37+func (r *FullscreenRenderer) GetChar() Event { return Event{} }38+func (r *FullscreenRenderer) MaxX() int { return 0 }39+func (r *FullscreenRenderer) MaxY() int { return 0 }40+41+func (r *FullscreenRenderer) RefreshWindows(windows []Window) {}42+43+func (r *FullscreenRenderer) NewWindow(top int, left int, width int, height int, border bool) Window {44+ return nil45+}modified:src/tui/ncurses.go+5 added
1+// +build ncurses2 // +build !windows3 // +build !tcell4 5 package tui26 unmodified lines32 "time"33 "unicode/utf8"34 )35 36+func HasFullscreenRenderer() bool {37+ return true38+}39+40 type Attr C.uint41 42 type CursesWindow struct {43 impl *C.WINDOW460 unmodified linesmodified:src/tui/tcell.go+4 added
13 unmodified lines14 15 "github.com/junegunn/go-runewidth"16 )17 18+func HasFullscreenRenderer() bool {19+ return true20+}21+22 func (p ColorPair) style() tcell.Style {23 style := tcell.StyleDefault24 return style.Foreground(tcell.Color(p.Fg())).Background(tcell.Color(p.Bg()))25 }539 unmodified linesmodified:src/constants.go+1 added-1 removed
6 unmodified lines7 )8 9 const (10 // Current version11- version = "0.16.1"11+ version = "0.16.2-alpha"12 13 // Core14 coordinatorDelayMax time.Duration = 100 * time.Millisecond15 coordinatorDelayStep time.Duration = 10 * time.Millisecond52 unmodified linesmodified:src/Makefile+45 added-10 removed
13 unmodified lines14 SRCDIR := $(GOPATH)/src/github.com/junegunn/fzf/src15 DOCKEROPTS := -i -t -v $(ROOTDIR):/fzf/src16 BINARY32 := fzf-$(GOOS)_38617 BINARY64 := fzf-$(GOOS)_amd6418+BINARYARM5 := fzf-$(GOOS)_arm519+BINARYARM6 := fzf-$(GOOS)_arm620 BINARYARM7 := fzf-$(GOOS)_arm721+BINARYARM8 := fzf-$(GOOS)_arm822 VERSION := $(shell awk -F= '/version =/ {print $$2}' constants.go | tr -d "\" ")23 RELEASE32 := fzf-$(VERSION)-$(GOOS)_38624 RELEASE64 := fzf-$(VERSION)-$(GOOS)_amd6425+RELEASEARM5 := fzf-$(VERSION)-$(GOOS)_arm526+RELEASEARM6 := fzf-$(VERSION)-$(GOOS)_arm627 RELEASEARM7 := fzf-$(VERSION)-$(GOOS)_arm728+RELEASEARM8 := fzf-$(VERSION)-$(GOOS)_arm829 export GOPATH30 31 UNAME_M := $(shell uname -m)32 ifeq ($(UNAME_M),x86_64)7 unmodified lines40 all: fzf/$(BINARY)41 42 ifeq ($(GOOS),windows)43 release: fzf/$(BINARY32) fzf/$(BINARY64)38- -cd fzf && cp $(BINARY32) $(RELEASE32).exe && zip $(RELEASE32).zip $(RELEASE32).exe39- cd fzf && cp $(BINARY64) $(RELEASE64).exe && zip $(RELEASE64).zip $(RELEASE64).exe && \40- rm -f $(RELEASE32).exe $(RELEASE64).exe44+ cd fzf && cp $(BINARY32) $(RELEASE32).exe && zip $(RELEASE32).zip $(RELEASE32).exe45+ cd fzf && cp $(BINARY64) $(RELEASE64).exe && zip $(RELEASE64).zip $(RELEASE64).exe46+ cd fzf && rm -f $(RELEASE32).exe $(RELEASE64).exe47+else ifeq ($(GOOS),linux)48+release: fzf/$(BINARY32) fzf/$(BINARY64) fzf/$(BINARYARM5) fzf/$(BINARYARM6) fzf/$(BINARYARM7) fzf/$(BINARYARM8)49+ cd fzf && cp $(BINARY32) $(RELEASE32) && tar -czf $(RELEASE32).tgz $(RELEASE32)50+ cd fzf && cp $(BINARY64) $(RELEASE64) && tar -czf $(RELEASE64).tgz $(RELEASE64)51+ cd fzf && cp $(BINARYARM5) $(RELEASEARM5) && tar -czf $(RELEASEARM5).tgz $(RELEASEARM5)52+ cd fzf && cp $(BINARYARM6) $(RELEASEARM6) && tar -czf $(RELEASEARM6).tgz $(RELEASEARM6)53+ cd fzf && cp $(BINARYARM7) $(RELEASEARM7) && tar -czf $(RELEASEARM7).tgz $(RELEASEARM7)54+ cd fzf && cp $(BINARYARM8) $(RELEASEARM8) && tar -czf $(RELEASEARM8).tgz $(RELEASEARM8)55+ cd fzf && rm -f $(RELEASE32) $(RELEASE64) $(RELEASEARM5) $(RELEASEARM6) $(RELEASEARM7) $(RELEASEARM8)56 else42-release: test fzf/$(BINARY32) fzf/$(BINARY64)43- -cd fzf && cp $(BINARY32) $(RELEASE32) && tar -czf $(RELEASE32).tgz $(RELEASE32)44- cd fzf && cp $(BINARY64) $(RELEASE64) && tar -czf $(RELEASE64).tgz $(RELEASE64) && \45- rm -f $(RELEASE32) $(RELEASE64)57+release: fzf/$(BINARY32) fzf/$(BINARY64)58+ cd fzf && cp $(BINARY32) $(RELEASE32) && tar -czf $(RELEASE32).tgz $(RELEASE32)59+ cd fzf && cp $(BINARY64) $(RELEASE64) && tar -czf $(RELEASE64).tgz $(RELEASE64)60+ cd fzf && rm -f $(RELEASE32) $(RELEASE64)61 endif62 63+release-all: clean test64+ GOOS=darwin make release65+ GOOS=linux make release66+ GOOS=freebsd make release67+ GOOS=openbsd make release68+ GOOS=windows make release69+70 $(SRCDIR):71 mkdir -p $(shell dirname $(SRCDIR))72 ln -s $(ROOTDIR) $(SRCDIR)73 7 unmodified lines81 cd $(SRCDIR)/fzf && cp $(BINARYARM7) $(RELEASEARM7) && tar -czf $(RELEASEARM7).tgz $(RELEASEARM7) && \82 rm -f $(RELEASEARM7)83 84 test: deps63- SHELL=/bin/sh GOOS=$(GOOS) go test -v -tags "$(TAGS)" ./...85+ SHELL=/bin/sh GOOS= go test -v -tags "$(TAGS)" ./...86 87 install: $(BINDIR)/fzf88 89 uninstall:2 unmodified lines92 clean:93 cd fzf && rm -f fzf-*94 95 fzf/$(BINARY32): deps74- cd fzf && GOARCH=386 CGO_ENABLED=1 go build -a -ldflags "-w -extldflags=$(LDFLAGS)" -tags "$(TAGS)" -o $(BINARY32)96+ cd fzf && GOARCH=386 go build -a -ldflags "-w -extldflags=$(LDFLAGS)" -tags "$(TAGS)" -o $(BINARY32)97 98 fzf/$(BINARY64): deps77- cd fzf && go build -a -ldflags "-w -extldflags=$(LDFLAGS)" -tags "$(TAGS)" -o $(BINARY64)99+ cd fzf && GOARCH=amd64 go build -a -ldflags "-w -extldflags=$(LDFLAGS)" -tags "$(TAGS)" -o $(BINARY64)100 101+# https://github.com/golang/go/wiki/GoArm102+fzf/$(BINARYARM5): deps103+ cd fzf && GOARCH=arm GOARM=5 go build -a -ldflags "-w -extldflags=$(LDFLAGS)" -tags "$(TAGS)" -o $(BINARYARM5)104+105+fzf/$(BINARYARM6): deps106+ cd fzf && GOARCH=arm GOARM=6 go build -a -ldflags "-w -extldflags=$(LDFLAGS)" -tags "$(TAGS)" -o $(BINARYARM6)107+108+fzf/$(BINARYARM7): deps109+ cd fzf && GOARCH=arm GOARM=7 go build -a -ldflags "-w -extldflags=$(LDFLAGS)" -tags "$(TAGS)" -o $(BINARYARM7)110+111+fzf/$(BINARYARM8): deps112+ cd fzf && GOARCH=arm64 go build -a -ldflags "-w -extldflags=$(LDFLAGS)" -tags "$(TAGS)" -o $(BINARYARM8)113+114 $(BINDIR)/fzf: fzf/$(BINARY) | $(BINDIR)115 cp -f fzf/$(BINARY) $(BINDIR)116 cd $(BINDIR) && ln -sf $(BINARY) fzf117 42 unmodified linesmodified:src/README.md+14 added-3 removed
57 unmodified lines58596061626364656667686970717273747568697677787980818283848575868788899016 unmodified lines57 unmodified linesUnit tests can be run with `make test`. Integration tests are written in Rubyscript that should be run on tmux.
```shcd src
# Unit testsmake test
# Integration testsruby ../test/test_go.rb
# Build binary for the platformmake
# Install the executable to ../bin directorymake install
# Integration testsruby ../test/test_go.rb# Make release archivesmake release
# Make release archives for all supported platformsmake release-all```
Third-party libraries used--------------------------
- [ncurses][ncurses]- ~[ncurses][ncurses]~- [mattn/go-runewidth](https://github.com/mattn/go-runewidth) - Licensed under [MIT](http://mattn.mit-license.org)- [mattn/go-shellwords](https://github.com/mattn/go-shellwords) - Licensed under [MIT](http://mattn.mit-license.org)16 unmodified linesmodified:src/terminal.go+4 added-1 removed
303 unmodified lines304 }305 return util.Max(maxHeight, minHeight)306 }307 renderer = tui.NewLightRenderer(opts.Theme, opts.Black, opts.Mouse, opts.Tabstop, maxHeightFunc)308- } else {308+ } else if tui.HasFullscreenRenderer() {309 renderer = tui.NewFullscreenRenderer(opts.Theme, opts.Black, opts.Mouse)310+ } else {311+ renderer = tui.NewLightRenderer(opts.Theme, opts.Black, opts.Mouse, opts.Tabstop,312+ func(h int) int { return h })313 }314 wordRubout := "[^[:alnum:]][[:alnum:]]"315 wordNext := "[[:alnum:]][^[:alnum:]]|(.$)"316 if opts.FileWord {1374 unmodified linesmodified:CHANGELOG.md+2 added
1 unmodified line2 =========3 4 0.16.25 ------6+- Dropped ncurses dependency7+- Binaries for freebsd, openbsd, arm5, arm6, arm7, and arm88 - Added support for composite actions in `--bind`. Multiple actions can be9 chained using `+` separator.10 - e.g. `fzf --bind 'ctrl-y:execute(echo -n {} | pbcopy)+abort'`11 539 unmodified linesmodified:install+13 added-5 removed
1 #!/usr/bin/env bash2 3 set -u4 5-version=0.16.15+version=0.16.2-alpha6 auto_completion=7 key_bindings=8 update_config=29 binary_arch=149 unmodified lines159 archi=$(uname -sm)160 binary_available=1161 binary_error=""162 case "$archi" in163- Darwin\ x86_64) download fzf-$version-darwin_${binary_arch:-amd64} ;;164- Darwin\ i*86) download fzf-$version-darwin_${binary_arch:-386} ;;165- Linux\ x86_64) download fzf-$version-linux_${binary_arch:-amd64} ;;166- Linux\ i*86) download fzf-$version-linux_${binary_arch:-386} ;;163+ Darwin\ *64) download fzf-$version-darwin_${binary_arch:-amd64} ;;164+ Darwin\ *86) download fzf-$version-darwin_${binary_arch:-386} ;;165+ Linux\ *64) download fzf-$version-linux_${binary_arch:-amd64} ;;166+ Linux\ *86) download fzf-$version-linux_${binary_arch:-386} ;;167+ Linux\ armv5*) download fzf-$version-linux_${binary_arch:-arm5} ;;168+ Linux\ armv6*) download fzf-$version-linux_${binary_arch:-arm6} ;;169+ Linux\ armv7*) download fzf-$version-linux_${binary_arch:-arm7} ;;170+ Linux\ armv8*) download fzf-$version-linux_${binary_arch:-arm8} ;;171+ FreeBSD\ *64) download fzf-$version-freebsd_${binary_arch:-amd64} ;;172+ FreeBSD\ *86) download fzf-$version-freebsd_${binary_arch:-386} ;;173+ OpenBSD\ *64) download fzf-$version-openbsd_${binary_arch:-amd64} ;;174+ OpenBSD\ *86) download fzf-$version-openbsd_${binary_arch:-386} ;;175 *) binary_available=0 binary_error=1 ;;176 esac177 178 install_ruby_fzf() {233 unmodified lines