mirror of https://github.com/liamg/aminal.git
Adding missing DL CIS handler
This commit is contained in:
parent
7b181ac241
commit
1371ace95c
|
@ -0,0 +1,15 @@
|
||||||
|
BINARY := aminal
|
||||||
|
VERSION ?= vlatest
|
||||||
|
|
||||||
|
.PHONY: build
|
||||||
|
build: test
|
||||||
|
mkdir -p release
|
||||||
|
go build -o release/$(BINARY)-$(VERSION)
|
||||||
|
|
||||||
|
.PHONY: test
|
||||||
|
test:
|
||||||
|
go test -v ./...
|
||||||
|
|
||||||
|
.PHONY: install
|
||||||
|
install: build
|
||||||
|
install -m 0755 release/$(BINARY)-$(VERSION) /usr/local/bin/aminal
|
|
@ -442,6 +442,11 @@ func (buffer *Buffer) ViewHeight() uint16 {
|
||||||
return buffer.viewHeight
|
return buffer.viewHeight
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (buffer *Buffer) deleteLine() {
|
||||||
|
index := int(buffer.RawLine())
|
||||||
|
buffer.lines = buffer.lines[:index+copy(buffer.lines[index:], buffer.lines[index+1:])]
|
||||||
|
}
|
||||||
|
|
||||||
func (buffer *Buffer) insertLine() {
|
func (buffer *Buffer) insertLine() {
|
||||||
|
|
||||||
defer buffer.emitDisplayChange()
|
defer buffer.emitDisplayChange()
|
||||||
|
@ -492,6 +497,21 @@ func (buffer *Buffer) InsertLines(count int) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (buffer *Buffer) DeleteLines(count int) {
|
||||||
|
|
||||||
|
if buffer.HasScrollableRegion() && !buffer.InScrollableRegion() {
|
||||||
|
// should have no effect outside of scrollable region
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
buffer.cursorX = 0
|
||||||
|
|
||||||
|
for i := 0; i < count; i++ {
|
||||||
|
buffer.deleteLine()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
func (buffer *Buffer) Index() {
|
func (buffer *Buffer) Index() {
|
||||||
|
|
||||||
// This sequence causes the active position to move downward one line without changing the column position.
|
// This sequence causes the active position to move downward one line without changing the column position.
|
||||||
|
|
|
@ -41,6 +41,7 @@ var csiSequences = []csiMapping{
|
||||||
{id: 'J', handler: csiEraseInDisplayHandler, description: "Erase in Display (ED), VT100"},
|
{id: 'J', handler: csiEraseInDisplayHandler, description: "Erase in Display (ED), VT100"},
|
||||||
{id: 'K', handler: csiEraseInLineHandler, description: "Erase in Line (EL), VT100"},
|
{id: 'K', handler: csiEraseInLineHandler, description: "Erase in Line (EL), VT100"},
|
||||||
{id: 'L', handler: csiInsertLinesHandler, description: "Insert Ps Line(s) (default = 1) (IL)"},
|
{id: 'L', handler: csiInsertLinesHandler, description: "Insert Ps Line(s) (default = 1) (IL)"},
|
||||||
|
{id: 'M', handler: csiDeleteLinesHandler, description: "Delete Ps Line(s) (default = 1) (DL)"},
|
||||||
{id: 'P', handler: csiDeleteHandler, description: " Delete Ps Character(s) (default = 1) (DCH)"},
|
{id: 'P', handler: csiDeleteHandler, description: " Delete Ps Character(s) (default = 1) (DCH)"},
|
||||||
{id: 'S', handler: csiScrollUpHandler, description: "Scroll up Ps lines (default = 1) (SU), VT420, ECMA-48"},
|
{id: 'S', handler: csiScrollUpHandler, description: "Scroll up Ps lines (default = 1) (SU), VT420, ECMA-48"},
|
||||||
{id: 'T', handler: csiScrollDownHandler, description: "Scroll down Ps lines (default = 1) (SD), VT420"},
|
{id: 'T', handler: csiScrollDownHandler, description: "Scroll down Ps lines (default = 1) (SD), VT420"},
|
||||||
|
@ -276,6 +277,24 @@ func csiInsertLinesHandler(params []string, intermediate string, terminal *Termi
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func csiDeleteLinesHandler(params []string, intermediate string, terminal *Terminal) error {
|
||||||
|
count := 1
|
||||||
|
if len(params) > 1 {
|
||||||
|
return fmt.Errorf("Not supported")
|
||||||
|
}
|
||||||
|
if len(params) == 1 {
|
||||||
|
var err error
|
||||||
|
count, err = strconv.Atoi(params[0])
|
||||||
|
if err != nil || count < 1 {
|
||||||
|
count = 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
terminal.ActiveBuffer().DeleteLines(count)
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func csiScrollDownHandler(params []string, intermediate string, terminal *Terminal) error {
|
func csiScrollDownHandler(params []string, intermediate string, terminal *Terminal) error {
|
||||||
distance := 1
|
distance := 1
|
||||||
if len(params) > 1 {
|
if len(params) > 1 {
|
||||||
|
|
|
@ -3,6 +3,7 @@ package terminal
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/liamg/aminal/buffer"
|
"github.com/liamg/aminal/buffer"
|
||||||
"github.com/liamg/aminal/config"
|
"github.com/liamg/aminal/config"
|
||||||
|
@ -15,7 +16,10 @@ func sgrSequenceHandler(params []string, intermediate string, terminal *Terminal
|
||||||
}
|
}
|
||||||
|
|
||||||
for i := range params {
|
for i := range params {
|
||||||
switch params[i] {
|
|
||||||
|
p := strings.Replace(strings.Replace(params[i], "[", "", -1), "]", "", -1)
|
||||||
|
|
||||||
|
switch p {
|
||||||
case "00", "0":
|
case "00", "0":
|
||||||
attr := terminal.ActiveBuffer().CursorAttr()
|
attr := terminal.ActiveBuffer().CursorAttr()
|
||||||
*attr = buffer.CellAttributes{
|
*attr = buffer.CellAttributes{
|
||||||
|
@ -38,6 +42,8 @@ func sgrSequenceHandler(params []string, intermediate string, terminal *Terminal
|
||||||
terminal.ActiveBuffer().CursorAttr().Bold = false
|
terminal.ActiveBuffer().CursorAttr().Bold = false
|
||||||
case "22":
|
case "22":
|
||||||
terminal.ActiveBuffer().CursorAttr().Dim = false
|
terminal.ActiveBuffer().CursorAttr().Dim = false
|
||||||
|
case "23":
|
||||||
|
// not italic
|
||||||
case "24":
|
case "24":
|
||||||
terminal.ActiveBuffer().CursorAttr().Underline = false
|
terminal.ActiveBuffer().CursorAttr().Underline = false
|
||||||
case "25":
|
case "25":
|
||||||
|
@ -46,6 +52,8 @@ func sgrSequenceHandler(params []string, intermediate string, terminal *Terminal
|
||||||
terminal.ActiveBuffer().CursorAttr().Reverse = false
|
terminal.ActiveBuffer().CursorAttr().Reverse = false
|
||||||
case "28":
|
case "28":
|
||||||
terminal.ActiveBuffer().CursorAttr().Hidden = false
|
terminal.ActiveBuffer().CursorAttr().Hidden = false
|
||||||
|
case "29":
|
||||||
|
// not strikethrough
|
||||||
case "39":
|
case "39":
|
||||||
terminal.ActiveBuffer().CursorAttr().FgColour = terminal.config.ColourScheme.Foreground
|
terminal.ActiveBuffer().CursorAttr().FgColour = terminal.config.ColourScheme.Foreground
|
||||||
case "30":
|
case "30":
|
||||||
|
|
Loading…
Reference in New Issue