mirror of https://github.com/liamg/aminal.git
gofmt everythign
This commit is contained in:
parent
16e369ef1d
commit
adbbf0f5cf
|
@ -216,7 +216,6 @@ func (buffer *Buffer) StartSelection(col uint16, viewRow uint16) {
|
||||||
if buffer.selectionComplete {
|
if buffer.selectionComplete {
|
||||||
buffer.selectionEnd = nil
|
buffer.selectionEnd = nil
|
||||||
|
|
||||||
|
|
||||||
if buffer.selectionStart != nil && time.Since(buffer.selectionClickTime) < time.Millisecond*500 {
|
if buffer.selectionStart != nil && time.Since(buffer.selectionClickTime) < time.Millisecond*500 {
|
||||||
if buffer.selectionExpanded {
|
if buffer.selectionExpanded {
|
||||||
//select whole line!
|
//select whole line!
|
||||||
|
|
|
@ -198,18 +198,18 @@ func (f *Font) Size(text string) (float32, float32) {
|
||||||
return width, height
|
return width, height
|
||||||
}
|
}
|
||||||
|
|
||||||
func(f *Font) MaxSize() (float32, float32){
|
func (f *Font) MaxSize() (float32, float32) {
|
||||||
b:= f.ttf.Bounds(fixed.Int26_6(f.scale))
|
b := f.ttf.Bounds(fixed.Int26_6(f.scale))
|
||||||
return float32(b.Max.X - b.Min.X),float32(b.Max.Y - b.Min.Y)
|
return float32(b.Max.X - b.Min.X), float32(b.Max.Y - b.Min.Y)
|
||||||
}
|
}
|
||||||
|
|
||||||
func(f *Font) MinY() float32 {
|
func (f *Font) MinY() float32 {
|
||||||
b:= f.ttf.Bounds(fixed.Int26_6(f.scale))
|
b := f.ttf.Bounds(fixed.Int26_6(f.scale))
|
||||||
return float32(b.Min.Y)
|
return float32(b.Min.Y)
|
||||||
}
|
}
|
||||||
|
|
||||||
func(f *Font) MaxY() float32 {
|
func (f *Font) MaxY() float32 {
|
||||||
b:= f.ttf.Bounds(fixed.Int26_6(f.scale))
|
b := f.ttf.Bounds(fixed.Int26_6(f.scale))
|
||||||
return float32(b.Max.Y)
|
return float32(b.Max.Y)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,12 +39,11 @@ func (gui *GUI) loadFonts() error {
|
||||||
|
|
||||||
if gui.fontMap == nil {
|
if gui.fontMap == nil {
|
||||||
gui.fontMap = NewFontMap(defaultFont, boldFont)
|
gui.fontMap = NewFontMap(defaultFont, boldFont)
|
||||||
}else{
|
} else {
|
||||||
gui.fontMap.defaultFont = defaultFont
|
gui.fontMap.defaultFont = defaultFont
|
||||||
gui.fontMap.defaultBoldFont = boldFont
|
gui.fontMap.defaultBoldFont = boldFont
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// add special non-ascii fonts here
|
// add special non-ascii fonts here
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -352,7 +352,7 @@ func (gui *GUI) createWindow() (*glfw.Window, error) {
|
||||||
window, err = gui.createWindowWithOpenGLVersion(v[0], v[1])
|
window, err = gui.createWindowWithOpenGLVersion(v[0], v[1])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
gui.logger.Warnf("Failed to create window: %s. Will attempt older version...", err)
|
gui.logger.Warnf("Failed to create window: %s. Will attempt older version...", err)
|
||||||
}else{
|
} else {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -369,7 +369,7 @@ func (gui *GUI) createWindow() (*glfw.Window, error) {
|
||||||
return window, nil
|
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.ContextVersionMajor, major)
|
||||||
glfw.WindowHint(glfw.ContextVersionMinor, minor)
|
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)
|
window, err := glfw.CreateWindow(gui.width, gui.height, "Terminal", nil, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
e := err.Error()
|
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:]), ".")
|
v := strings.Split(strings.TrimSpace(e[i+14:]), ".")
|
||||||
if len(v) == 2 {
|
if len(v) == 2 {
|
||||||
major, err := strconv.Atoi(v[0])
|
major, err := strconv.Atoi(v[0])
|
||||||
|
@ -395,6 +395,7 @@ func(gui *GUI) createWindowWithOpenGLVersion(major int, minor int) (*glfw.Window
|
||||||
|
|
||||||
return window, nil
|
return window, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// initOpenGL initializes OpenGL and returns an intiialized program.
|
// initOpenGL initializes OpenGL and returns an intiialized program.
|
||||||
func (gui *GUI) createProgram() (uint32, error) {
|
func (gui *GUI) createProgram() (uint32, error) {
|
||||||
if err := gl.Init(); err != nil {
|
if err := gl.Init(); err != nil {
|
||||||
|
|
|
@ -57,11 +57,10 @@ func (r *OpenGLRenderer) newRectangle(x float32, y float32, colourAttr uint32) *
|
||||||
halfAreaWidth := float32(r.areaWidth / 2)
|
halfAreaWidth := float32(r.areaWidth / 2)
|
||||||
halfAreaHeight := float32(r.areaHeight / 2)
|
halfAreaHeight := float32(r.areaHeight / 2)
|
||||||
|
|
||||||
|
|
||||||
x = (x - halfAreaWidth) / halfAreaWidth
|
x = (x - halfAreaWidth) / halfAreaWidth
|
||||||
y = -(y - ( halfAreaHeight)) / halfAreaHeight
|
y = -(y - (halfAreaHeight)) / halfAreaHeight
|
||||||
w := r.cellWidth / halfAreaWidth
|
w := r.cellWidth / halfAreaWidth
|
||||||
h := (r.cellHeight ) / halfAreaHeight
|
h := (r.cellHeight) / halfAreaHeight
|
||||||
|
|
||||||
rect := &rectangle{
|
rect := &rectangle{
|
||||||
points: []float32{
|
points: []float32{
|
||||||
|
@ -179,7 +178,7 @@ func (r *OpenGLRenderer) getRectangle(col uint, row uint) *rectangle {
|
||||||
}
|
}
|
||||||
|
|
||||||
x := float32(float32(col) * r.cellWidth)
|
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)
|
r.rectangles[[2]uint{col, row}] = r.newRectangle(x, y, r.colourAttr)
|
||||||
return r.rectangles[[2]uint{col, row}]
|
return r.rectangles[[2]uint{col, row}]
|
||||||
|
|
Loading…
Reference in New Issue