diff --git a/buffer/buffer.go b/buffer/buffer.go index 28f45a3..541bcc7 100644 --- a/buffer/buffer.go +++ b/buffer/buffer.go @@ -216,7 +216,6 @@ func (buffer *Buffer) StartSelection(col uint16, viewRow uint16) { if buffer.selectionComplete { buffer.selectionEnd = nil - if buffer.selectionStart != nil && time.Since(buffer.selectionClickTime) < time.Millisecond*500 { if buffer.selectionExpanded { //select whole line! diff --git a/glfont/font.go b/glfont/font.go index fe3c871..e3d857a 100644 --- a/glfont/font.go +++ b/glfont/font.go @@ -198,18 +198,18 @@ func (f *Font) Size(text string) (float32, float32) { return width, height } -func(f *Font) MaxSize() (float32, float32){ - b:= f.ttf.Bounds(fixed.Int26_6(f.scale)) - return float32(b.Max.X - b.Min.X),float32(b.Max.Y - b.Min.Y) +func (f *Font) MaxSize() (float32, float32) { + b := f.ttf.Bounds(fixed.Int26_6(f.scale)) + return float32(b.Max.X - b.Min.X), float32(b.Max.Y - b.Min.Y) } -func(f *Font) MinY() float32 { - b:= f.ttf.Bounds(fixed.Int26_6(f.scale)) +func (f *Font) MinY() float32 { + b := f.ttf.Bounds(fixed.Int26_6(f.scale)) return float32(b.Min.Y) } -func(f *Font) MaxY() float32 { - b:= f.ttf.Bounds(fixed.Int26_6(f.scale)) +func (f *Font) MaxY() float32 { + b := f.ttf.Bounds(fixed.Int26_6(f.scale)) return float32(b.Max.Y) } diff --git a/glfont/shader.go b/glfont/shader.go index 9f23476..175eb0f 100644 --- a/glfont/shader.go +++ b/glfont/shader.go @@ -82,7 +82,7 @@ void main() var vertexFontShader = `#version 150 core -//vertex position +//vertex position in vec2 vert; //pass through to fragTexCoord diff --git a/gui/fonts.go b/gui/fonts.go index 5582e6d..a060fd3 100644 --- a/gui/fonts.go +++ b/gui/fonts.go @@ -39,12 +39,11 @@ func (gui *GUI) loadFonts() error { if gui.fontMap == nil { gui.fontMap = NewFontMap(defaultFont, boldFont) - }else{ + } else { gui.fontMap.defaultFont = defaultFont gui.fontMap.defaultBoldFont = boldFont } - // add special non-ascii fonts here return nil diff --git a/gui/gui.go b/gui/gui.go index f859b9b..acbc31d 100644 --- a/gui/gui.go +++ b/gui/gui.go @@ -352,7 +352,7 @@ func (gui *GUI) createWindow() (*glfw.Window, error) { window, err = gui.createWindowWithOpenGLVersion(v[0], v[1]) if err != nil { gui.logger.Warnf("Failed to create window: %s. Will attempt older version...", err) - }else{ + } else { break } } @@ -369,7 +369,7 @@ func (gui *GUI) createWindow() (*glfw.Window, error) { return window, nil } -func(gui *GUI) createWindowWithOpenGLVersion(major int, minor int) (*glfw.Window, error) { +func (gui *GUI) createWindowWithOpenGLVersion(major int, minor int) (*glfw.Window, error) { glfw.WindowHint(glfw.ContextVersionMajor, major) glfw.WindowHint(glfw.ContextVersionMinor, minor) @@ -377,7 +377,7 @@ func(gui *GUI) createWindowWithOpenGLVersion(major int, minor int) (*glfw.Window window, err := glfw.CreateWindow(gui.width, gui.height, "Terminal", nil, nil) if err != nil { e := err.Error() - if i := strings.Index(e, ", got version "); i > - 1 { + if i := strings.Index(e, ", got version "); i > -1 { v := strings.Split(strings.TrimSpace(e[i+14:]), ".") if len(v) == 2 { major, err := strconv.Atoi(v[0]) @@ -395,6 +395,7 @@ func(gui *GUI) createWindowWithOpenGLVersion(major int, minor int) (*glfw.Window return window, nil } + // initOpenGL initializes OpenGL and returns an intiialized program. func (gui *GUI) createProgram() (uint32, error) { if err := gl.Init(); err != nil { diff --git a/gui/renderer.go b/gui/renderer.go index b4d5e77..8310958 100644 --- a/gui/renderer.go +++ b/gui/renderer.go @@ -57,11 +57,10 @@ func (r *OpenGLRenderer) newRectangle(x float32, y float32, colourAttr uint32) * halfAreaWidth := float32(r.areaWidth / 2) halfAreaHeight := float32(r.areaHeight / 2) - x = (x - halfAreaWidth) / halfAreaWidth - y = -(y - ( halfAreaHeight)) / halfAreaHeight + y = -(y - (halfAreaHeight)) / halfAreaHeight w := r.cellWidth / halfAreaWidth - h := (r.cellHeight ) / halfAreaHeight + h := (r.cellHeight) / halfAreaHeight rect := &rectangle{ points: []float32{ @@ -165,7 +164,7 @@ func (r *OpenGLRenderer) SetArea(areaX int, areaY int, areaWidth int, areaHeight f := r.fontMap.GetFont('X') _, r.cellHeight = f.MaxSize() r.cellWidth, _ = f.Size("X") - //= f.LineHeight() // includes vertical padding + //= f.LineHeight() // includes vertical padding r.termCols = uint(math.Floor(float64(float32(r.areaWidth) / r.cellWidth))) r.termRows = uint(math.Floor(float64(float32(r.areaHeight) / r.cellHeight))) r.rectangles = map[[2]uint]*rectangle{} @@ -179,7 +178,7 @@ func (r *OpenGLRenderer) getRectangle(col uint, row uint) *rectangle { } x := float32(float32(col) * r.cellWidth) - y := float32(float32(row) * r.cellHeight) + r.cellHeight + y := float32(float32(row)*r.cellHeight) + r.cellHeight r.rectangles[[2]uint{col, row}] = r.newRectangle(x, y, r.colourAttr) return r.rectangles[[2]uint{col, row}] diff --git a/gui/shaders.go b/gui/shaders.go index 63e618a..7c737b7 100644 --- a/gui/shaders.go +++ b/gui/shaders.go @@ -24,7 +24,7 @@ const ( smooth in vec3 theColour; out vec4 outColour; void main() { - outColour = vec4(theColour, 1.0); + outColour = vec4(theColour, 1.0); } ` + "\x00" )