Skip to content

Commit 48f8fe5

Browse files
authored
Merge pull request #2526 from Alceris/pauseunbuffering
feat: Add PauseBuffer parameter to commands.
2 parents d428db5 + 5b6efef commit 48f8fe5

4 files changed

Lines changed: 17 additions & 0 deletions

File tree

data/common.cmd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@ name = "TagShiftBack"
99
command = d
1010
time = 1
1111
buffer.time = 1
12+
pausebuffer = 1
1213

1314
[Command]
1415
name = "TagShiftFwd"
1516
command = w
1617
time = 1
1718
buffer.time = 1
19+
pausebuffer = 1
1820

1921
[Command]
2022
name = "x"

src/compiler.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7484,6 +7484,7 @@ func (c *Compiler) Compile(pn int, def string, constants map[string]float32) (ma
74847484
if is.ReadI32("command.buffer.time", &i32) {
74857485
c.cmdl.DefaultBufferTime = Max(1, i32)
74867486
}
7487+
is.ReadBool("command.pausebuffer", &c.cmdl.DefaultPauseBuffer)
74877488
}
74887489
default:
74897490
// Read input commands
@@ -7505,11 +7506,13 @@ func (c *Compiler) Compile(pn int, def string, constants map[string]float32) (ma
75057506
"\ncommand = " + is["command"] + "\n" + err.Error())
75067507
}
75077508
cm.time, cm.buftime = c.cmdl.DefaultTime, c.cmdl.DefaultBufferTime
7509+
cm.pausebuffer = c.cmdl.DefaultPauseBuffer
75087510
is.ReadI32("time", &cm.time)
75097511
var i32 int32
75107512
if is.ReadI32("buffer.time", &i32) {
75117513
cm.buftime = Max(1, i32)
75127514
}
7515+
is.ReadBool("pausebuffer", &cm.pausebuffer)
75137516
c.cmdl.Add(*cm)
75147517
}
75157518

src/input.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1575,6 +1575,7 @@ type Command struct {
15751575
buftime, curbuftime int32
15761576
completeflag bool
15771577
hasSlash bool
1578+
pausebuffer bool
15781579
}
15791580

15801581
func newCommand() *Command {
@@ -2074,6 +2075,10 @@ func (c *Command) bufTest(ibuf *InputBuffer, ai bool, isHelper bool, holdTemp *[
20742075

20752076
// Update an individual command
20762077
func (c *Command) Step(ibuf *InputBuffer, ai, isHelper, hitpause bool, buftime int32) {
2078+
if !c.pausebuffer {
2079+
hitpause = false
2080+
buftime = 0
2081+
}
20772082
if !hitpause && c.curbuftime > 0 {
20782083
c.curbuftime--
20792084
}
@@ -2119,6 +2124,7 @@ type CommandList struct {
21192124
Commands [][]Command
21202125
DefaultTime int32
21212126
DefaultBufferTime int32
2127+
DefaultPauseBuffer bool
21222128
}
21232129

21242130
func NewCommandList(cb *InputBuffer) *CommandList {
@@ -2127,6 +2133,7 @@ func NewCommandList(cb *InputBuffer) *CommandList {
21272133
Names: make(map[string]int),
21282134
DefaultTime: 15,
21292135
DefaultBufferTime: 1,
2136+
DefaultPauseBuffer: true,
21302137
}
21312138
}
21322139

src/script.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -743,14 +743,19 @@ func systemScriptInit(l *lua.LState) {
743743
l.RaiseError(err.Error())
744744
}
745745
time, buftime := cl.DefaultTime, cl.DefaultBufferTime
746+
pausebuffer := cl.DefaultPauseBuffer
746747
if !nilArg(l, 4) {
747748
time = int32(numArg(l, 4))
748749
}
749750
if !nilArg(l, 5) {
750751
buftime = Max(1, int32(numArg(l, 5)))
751752
}
753+
if !nilArg(l, 6) {
754+
pausebuffer = boolArg(l, 6)
755+
}
752756
cm.time = time
753757
cm.buftime = buftime
758+
cm.pausebuffer = pausebuffer
754759
cl.Add(*cm)
755760
return 0
756761
})

0 commit comments

Comments
 (0)