Don't show text in the cmd entry area

This commit is contained in:
bloeys
2022-09-24 07:15:16 +04:00
parent b6c468a23b
commit 976682d2d2
2 changed files with 21 additions and 5 deletions

View File

@ -38,7 +38,19 @@ func (gg *GlyphGrid) Write(rs []rune, fgColor *gglm.Vec4, bgColor *gglm.Vec4) {
} }
} }
func (gg *GlyphGrid) Clear() { func (gg *GlyphGrid) ClearRow(rowIndex uint) {
if rowIndex >= gg.SizeY {
panic(fmt.Sprintf("passed row index of %d is larger or equal than grid Y size of %d\n", rowIndex, gg.SizeY))
}
row := gg.Tiles[rowIndex]
for x := 0; x < len(row); x++ {
row[x].Glyph = utf8.RuneError
}
}
func (gg *GlyphGrid) ClearAll() {
for y := 0; y < len(gg.Tiles); y++ { for y := 0; y < len(gg.Tiles); y++ {
row := gg.Tiles[y] row := gg.Tiles[y]
@ -46,8 +58,6 @@ func (gg *GlyphGrid) Clear() {
row[x].Glyph = utf8.RuneError row[x].Glyph = utf8.RuneError
} }
} }
gg.SetCursor(0, 0)
} }
func (gg *GlyphGrid) SetCursor(x, y uint) { func (gg *GlyphGrid) SetCursor(x, y uint) {

10
main.go
View File

@ -324,13 +324,18 @@ func (nt *nterm) MainUpdate() {
nt.SepLinePos.SetY(2 * nt.GlyphRend.Atlas.LineHeight) nt.SepLinePos.SetY(2 * nt.GlyphRend.Atlas.LineHeight)
// Draw textBuf // Draw textBuf
nt.glyphGrid.Clear() nt.glyphGrid.ClearAll()
nt.glyphGrid.SetCursor(0, 0)
gw, gh := nt.GridSize() gw, gh := nt.GridSize()
v1, v2 := nt.textBuf.ViewsFromToRelIndex(uint64(nt.scrollPosRel), uint64(nt.scrollPosRel)+uint64(gw*gh)) v1, v2 := nt.textBuf.ViewsFromToRelIndex(uint64(nt.scrollPosRel), uint64(nt.scrollPosRel)+uint64(gw*gh))
nt.lastCmdCharPos.Data = gglm.NewVec3(0, float32(nt.GlyphRend.ScreenHeight)-nt.GlyphRend.Atlas.LineHeight, 0).Data nt.lastCmdCharPos.Data = gglm.NewVec3(0, float32(nt.GlyphRend.ScreenHeight)-nt.GlyphRend.Atlas.LineHeight, 0).Data
nt.DrawTextAnsiCodesOnGlyphGrid(v1) nt.DrawTextAnsiCodesOnGlyphGrid(v1)
nt.DrawTextAnsiCodesOnGlyphGrid(v2) nt.DrawTextAnsiCodesOnGlyphGrid(v2)
nt.glyphGrid.ClearRow(nt.glyphGrid.SizeY - 1)
nt.glyphGrid.ClearRow(nt.glyphGrid.SizeY - 2)
nt.glyphGrid.ClearRow(nt.glyphGrid.SizeY - 3)
for y := 0; y < len(nt.glyphGrid.Tiles); y++ { for y := 0; y < len(nt.glyphGrid.Tiles); y++ {
@ -419,6 +424,7 @@ func (nt *nterm) ReadInputs() {
func (nt *nterm) DrawTextAnsiCodesOnGlyphGrid(bs []byte) { func (nt *nterm) DrawTextAnsiCodesOnGlyphGrid(bs []byte) {
// @TODO: We should remember color state even if the ansi codes are out of view
currFgColor := nt.Settings.DefaultFgColor currFgColor := nt.Settings.DefaultFgColor
currBgColor := nt.Settings.DefaultBgColor currBgColor := nt.Settings.DefaultBgColor