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, width: 600,
height: 300, height: 300,
terminal: terminal, 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")) gl.BindFragDataLocation(program, 0, gl.Str("outColour\x00"))
gui.logger.Debugf("Loading font...") 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 { //if err := gui.loadFont("./fonts/Roboto.ttf"); err != nil {
return fmt.Errorf("Failed to load font: %s", err) return fmt.Errorf("Failed to load font: %s", err)
} }

View File

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