mirror of
https://github.com/bloeys/nterm.git
synced 2025-12-29 06:28:20 +00:00
Correct arg quote handling in windows+place return at end of cmdBuf
This commit is contained in:
@ -127,7 +127,7 @@ func (gr *GlyphRend) DrawTextOpenGLAbs(text []rune, screenPos *gglm.Vec3, color
|
|||||||
return *pos
|
return *pos
|
||||||
}
|
}
|
||||||
|
|
||||||
// @TODO: Debug
|
// @Debug
|
||||||
var PrintPositions bool
|
var PrintPositions bool
|
||||||
|
|
||||||
func (gr *GlyphRend) drawRune(run *TextRun, i int, prevRune rune, screenPos, pos *gglm.Vec3, color *gglm.Vec4, lineHeightF32 float32, bufIndex *uint32) {
|
func (gr *GlyphRend) drawRune(run *TextRun, i int, prevRune rune, screenPos, pos *gglm.Vec3, color *gglm.Vec4, lineHeightF32 float32, bufIndex *uint32) {
|
||||||
|
|||||||
9
main.go
9
main.go
@ -6,9 +6,11 @@ import (
|
|||||||
"math"
|
"math"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
"runtime"
|
||||||
"runtime/pprof"
|
"runtime/pprof"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
"unicode/utf8"
|
"unicode/utf8"
|
||||||
|
|
||||||
@ -273,6 +275,7 @@ var sepLinePos = gglm.NewVec3(0, 0, 0)
|
|||||||
func (p *program) MainUpdate() {
|
func (p *program) MainUpdate() {
|
||||||
|
|
||||||
if input.KeyClicked(sdl.K_RETURN) || input.KeyClicked(sdl.K_KP_ENTER) {
|
if input.KeyClicked(sdl.K_RETURN) || input.KeyClicked(sdl.K_KP_ENTER) {
|
||||||
|
p.cursorCharIndex = p.cmdBufLen // This is so \n is written to the end of the cmdBuf
|
||||||
p.WriteToCmdBuf([]rune{'\n'})
|
p.WriteToCmdBuf([]rune{'\n'})
|
||||||
p.HandleReturn()
|
p.HandleReturn()
|
||||||
}
|
}
|
||||||
@ -514,7 +517,6 @@ func (p *program) DeleteNextChar() {
|
|||||||
p.cmdBufLen--
|
p.cmdBufLen--
|
||||||
}
|
}
|
||||||
|
|
||||||
// @TODO: Handle double quotes not being sent properly to cmd
|
|
||||||
func (p *program) HandleReturn() {
|
func (p *program) HandleReturn() {
|
||||||
|
|
||||||
cmdRunes := p.cmdBuf[:p.cmdBufLen]
|
cmdRunes := p.cmdBuf[:p.cmdBufLen]
|
||||||
@ -547,6 +549,11 @@ func (p *program) HandleReturn() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cmd := exec.Command(cmdName, args...)
|
cmd := exec.Command(cmdName, args...)
|
||||||
|
if runtime.GOOS == "windows" {
|
||||||
|
cmd.SysProcAttr = &syscall.SysProcAttr{
|
||||||
|
CmdLine: strings.TrimSpace(cmdStr),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
outPipe, err := cmd.StdoutPipe()
|
outPipe, err := cmd.StdoutPipe()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user