mirror of https://github.com/liamg/aminal.git
Gofmt (#216)
* Added Make targets for gofmt - `make check-gofmt` will check for files that aren't gofmt compliant - `make gofmt` will fix any gofmt error's in Aminal's source Vendored files are ignored. * Add gofmt check to TravisCI checks * Fix gofmt errors
This commit is contained in:
parent
6ded551de9
commit
35193b7981
|
@ -29,6 +29,7 @@ script:
|
|||
- if [[ $TRAVIS_OS_NAME == 'osx' ]]; then make build-darwin-native-travis; fi
|
||||
- if [[ $TRAVIS_OS_NAME == 'linux' ]]; then make build-linux-travis; fi
|
||||
- if [[ $TRAVIS_OS_NAME == 'linux' ]]; then make windows-cross-compile-travis; fi
|
||||
- if [[ $TRAVIS_OS_NAME == 'linux' ]]; then make check-gofmt; fi
|
||||
env:
|
||||
global:
|
||||
- secure: "pdRpTOGQSUgbC9tK37voxUYJHMWDPJEmdMhNBsljpP9VnxxbR6JEFwvOQEmUHGlsYv8jma6a17jE60ngVQk8QP12cPh48i2bdbVgym/zTUOKFawCtPAzs8i7evh0di5eZ3uoyc42kG4skc+ePuVHbXC8jDxwaPpMqSHD7QyQc1/6ckI9LLkyWUqhnJJXkVwhmI74Aa1Im6QhywAWFMeTBRRL02cwr6k7VKSYOn6yrtzJRCALFGpZ/n58lPrpDxN7W8o+HRQP89wIDy8FyNeEPdmqGFNfMHDvI3oJRN4dGC4H9EkKf/iGuNJia1Bs+MgaG9kKlMHsI6Fkh5uw9KNTvC1llx43VRQJzm26cn1CpRxxRtF4F8lqkpY4tHjxxCitV+98ddW8jdmQYyx+LeueC5wqlO9g2M5L3oXsGMqZ++mDRDa8oQoQAVUSVtimeO8ODXFuVNR8TlupP0Cthgucil63VUZfAD8EHc2zpRSFxfYByDH53uMEinn20uovL6W42fqgboC43HOnR6aVfSANPsBFDlcpZFa2BY5RkcKyYdaLkucy0DKJ946UDfhOu6FNm0GPHq5HcgWkLojNF0dEFgG6J+SGQGiPjxTlHP/zoe61qMlWu+fYRXQnKWZN5Kk0T1TbAk6pKSE6wRLG8ddxvMg+eVpGLT+gAvQdrrkMFvs="
|
||||
|
|
9
Makefile
9
Makefile
|
@ -11,6 +11,15 @@ test:
|
|||
go test -v ./...
|
||||
go vet -v
|
||||
|
||||
.PHONY: check-gofmt
|
||||
check-gofmt:
|
||||
$(eval files := $(shell gofmt -l `find -name '*.go' | grep -v vendor`))
|
||||
$(if $(files),@echo "Some files not gofmt compliant: $(files)"; exit 1, @exit 0)
|
||||
|
||||
.PHONY: gofmt
|
||||
gofmt:
|
||||
gofmt -w -l `find -name '*.go' | grep -v vendor`
|
||||
|
||||
.PHONY: install
|
||||
install: build
|
||||
go install -ldflags "-X github.com/liamg/aminal/version.Version=`git describe --tags`"
|
||||
|
|
|
@ -167,7 +167,7 @@ func (buffer *Buffer) GetSelectedText() string {
|
|||
}
|
||||
|
||||
var builder strings.Builder
|
||||
builder.Grow( int(buffer.terminalState.viewWidth) * (end.Line - start.Line + 1)) // reserve space to minimize allocations
|
||||
builder.Grow(int(buffer.terminalState.viewWidth) * (end.Line - start.Line + 1)) // reserve space to minimize allocations
|
||||
|
||||
for row := start.Line; row <= end.Line; row++ {
|
||||
if row >= len(buffer.lines) {
|
||||
|
@ -206,7 +206,7 @@ func (buffer *Buffer) StartSelection(col uint16, viewRow uint16, mode SelectionM
|
|||
row := buffer.convertViewLineToRawLine(viewRow) - uint64(buffer.terminalState.scrollLinesFromBottom)
|
||||
buffer.selectionMode = mode
|
||||
|
||||
buffer.selectionStart = &Position {
|
||||
buffer.selectionStart = &Position{
|
||||
Col: int(col),
|
||||
Line: int(row),
|
||||
}
|
||||
|
@ -214,7 +214,7 @@ func (buffer *Buffer) StartSelection(col uint16, viewRow uint16, mode SelectionM
|
|||
if mode == SelectionChar {
|
||||
buffer.selectionEnd = nil
|
||||
} else {
|
||||
buffer.selectionEnd = &Position {
|
||||
buffer.selectionEnd = &Position{
|
||||
Col: int(col),
|
||||
Line: int(row),
|
||||
}
|
||||
|
@ -240,7 +240,7 @@ func (buffer *Buffer) ExtendSelection(col uint16, viewRow uint16, complete bool)
|
|||
|
||||
row := buffer.convertViewLineToRawLine(viewRow) - uint64(buffer.terminalState.scrollLinesFromBottom)
|
||||
|
||||
buffer.selectionEnd = &Position {
|
||||
buffer.selectionEnd = &Position{
|
||||
Col: int(col),
|
||||
Line: int(row),
|
||||
}
|
||||
|
@ -263,8 +263,8 @@ func (buffer *Buffer) getActualSelection() (*Position, *Position) {
|
|||
return nil, nil
|
||||
}
|
||||
|
||||
start := &Position {}
|
||||
end := &Position {}
|
||||
start := &Position{}
|
||||
end := &Position{}
|
||||
|
||||
if comparePositions(buffer.selectionStart, buffer.selectionEnd) >= 0 {
|
||||
start.Col = buffer.selectionStart.Col
|
||||
|
|
|
@ -7,6 +7,7 @@ import (
|
|||
"os"
|
||||
"os/user"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/liamg/aminal/config"
|
||||
"github.com/liamg/aminal/version"
|
||||
)
|
||||
|
|
|
@ -64,7 +64,7 @@ func LoadTrueTypeFont(program uint32, r io.Reader, scale float32) (*Font, error)
|
|||
gl.BindVertexArray(0)
|
||||
|
||||
//create new face to measure glyph dimensions
|
||||
f.ttfFace = truetype.NewFace(f.ttf, &truetype.Options {
|
||||
f.ttfFace = truetype.NewFace(f.ttf, &truetype.Options{
|
||||
Size: float64(f.scale),
|
||||
DPI: DPI,
|
||||
Hinting: font.HintingFull,
|
||||
|
|
|
@ -745,4 +745,3 @@ func (gui *GUI) windowPosChangeCallback(w *glfw.Window, xpos int, ypos int) {
|
|||
func (gui *GUI) monitorChangeCallback(monitor *glfw.Monitor, event glfw.MonitorEvent) {
|
||||
gui.SetDPIScale()
|
||||
}
|
||||
|
||||
|
|
|
@ -5,9 +5,9 @@ import (
|
|||
"math"
|
||||
|
||||
"github.com/go-gl/glfw/v3.2/glfw"
|
||||
"github.com/liamg/aminal/buffer"
|
||||
"github.com/liamg/aminal/terminal"
|
||||
"time"
|
||||
"github.com/liamg/aminal/buffer"
|
||||
)
|
||||
|
||||
func (gui *GUI) glfwScrollCallback(w *glfw.Window, xoff float64, yoff float64) {
|
||||
|
@ -75,7 +75,7 @@ func (gui *GUI) updateLeftClickCount(x uint16, y uint16) int {
|
|||
gui.prevLeftClickY = y
|
||||
}()
|
||||
|
||||
if gui.prevLeftClickX == x && gui.prevLeftClickY == y && time.Since(gui.leftClickTime) < time.Millisecond * 500 {
|
||||
if gui.prevLeftClickX == x && gui.prevLeftClickY == y && time.Since(gui.leftClickTime) < time.Millisecond*500 {
|
||||
gui.leftClickCount++
|
||||
if gui.leftClickCount > 3 {
|
||||
gui.leftClickCount = 3
|
||||
|
|
|
@ -92,7 +92,8 @@ func TestCursorMovement(t *testing.T) {
|
|||
runMain(func() {
|
||||
|
||||
testFunc := func(term *terminal.Terminal, g *gui.GUI) {
|
||||
termRef = term; guiRef = g
|
||||
termRef = term
|
||||
guiRef = g
|
||||
|
||||
sleep()
|
||||
send(term, "vttest\n")
|
||||
|
@ -122,7 +123,8 @@ func TestScreenFeatures(t *testing.T) {
|
|||
runMain(func() {
|
||||
|
||||
testFunc := func(term *terminal.Terminal, g *gui.GUI) {
|
||||
termRef = term; guiRef = g
|
||||
termRef = term
|
||||
guiRef = g
|
||||
|
||||
sleep()
|
||||
send(term, "vttest\n")
|
||||
|
|
|
@ -165,9 +165,9 @@ package platform
|
|||
import "C"
|
||||
import (
|
||||
"errors"
|
||||
"os"
|
||||
"syscall"
|
||||
"unicode/utf16"
|
||||
"os"
|
||||
)
|
||||
|
||||
var procsInitSucceeded = false
|
||||
|
|
Loading…
Reference in New Issue