started tidying for margin setting

This commit is contained in:
Liam Galvin 2018-08-31 20:43:28 +01:00
parent e673e72ad9
commit dab508e6e2
6 changed files with 31 additions and 12 deletions

BIN
fonts/Hack-Bold.ttf Normal file

Binary file not shown.

BIN
fonts/Hack-BoldItalic.ttf Normal file

Binary file not shown.

BIN
fonts/Hack-Italic.ttf Normal file

Binary file not shown.

BIN
fonts/Hack-Regular.ttf Normal file

Binary file not shown.

View File

@ -37,7 +37,7 @@ func New(config *config.Config, terminal *terminal.Terminal, logger *zap.Sugared
width: 600,
height: 300,
terminal: terminal,
fontScale: 15.0,
fontScale: 14.0,
}
}
@ -121,7 +121,7 @@ func (gui *GUI) Render() error {
gl.BindFragDataLocation(program, 0, gl.Str("outColour\x00"))
gui.logger.Debugf("Loading font...")
if err := gui.loadFont("./fonts/envypn-15.ttf"); err != nil {
if err := gui.loadFont("./fonts/Hack-Regular.ttf"); err != nil {
//if err := gui.loadFont("./fonts/Roboto.ttf"); err != nil {
return fmt.Errorf("Failed to load font: %s", err)
}

View File

@ -7,16 +7,33 @@ import (
)
var csiSequenceMap = map[rune]csiSequenceHandler{
'm': sgrSequenceHandler,
'P': csiDeleteHandler,
'J': csiEraseInDisplayHandler,
'K': csiEraseInLineHandler,
'd': csiLinePositionAbsolute,
'h': csiSetModeHandler,
'l': csiResetModeHandler,
'd': csiLinePositionAbsolute,
't': csiWindowManipulation,
'X': csiEraseCharactersHandler,
'm': sgrSequenceHandler,
'r': csiSetMarginsHandler,
't': csiWindowManipulation,
'J': csiEraseInDisplayHandler,
'K': csiEraseInLineHandler,
'P': csiDeleteHandler,
'T': csiScrollHandler,
'X': csiEraseCharactersHandler,
}
func csiScrollHandler(params []string, intermediate string, terminal *Terminal) error {
distance := 1
if len(params) > 1 {
return fmt.Errorf("Not supported")
}
if len(params) == 1 {
var err error
distance, err = strconv.Atoi(params[0])
if err != nil {
distance = 1
}
}
terminal.ScrollDown(uint16(distance))
return nil
}
// DECSTBM
@ -41,12 +58,14 @@ func csiSetMarginsHandler(params []string, intermediate string, terminal *Termin
}
}
}
top -= 1
bottom -= 1
top--
bottom--
terminal.logger.Warnf("Request to set margins from line %d to %d", top, bottom)
terminal.ActiveBuffer().SetPosition(0, 0)
return nil
return fmt.Errorf("Not supported")
}
func csiSetMode(modeStr string, enabled bool, terminal *Terminal) error {