diff options
author | Tom Smeding <tom.smeding@gmail.com> | 2020-04-06 23:13:52 +0200 |
---|---|---|
committer | Tom Smeding <tom.smeding@gmail.com> | 2020-04-06 23:13:52 +0200 |
commit | ef9c115245663a0ba8cc6aae428511fe98233062 (patch) | |
tree | 05fce73297407bcc37083bec11a1788f697cc2b4 /src | |
parent | 3775e0e0ce079d12e40aef18f2b5b5598831c380 (diff) |
Diffstat (limited to 'src')
-rw-r--r-- | src/main.rs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/main.rs b/src/main.rs index 3b8547f..42b9460 100644 --- a/src/main.rs +++ b/src/main.rs @@ -200,6 +200,10 @@ fn handle_key(key: Key, st: &mut State<'_>) -> Option<bool> { if st.input_buffer.len() != 0 { match st.input_buffer.parse::<Entry>() { Ok(val) => { + if st.stk.len() + 1 < nargs { + return None; + } + st.stk.push(val); print!("{}\r{}{}", termion::clear::CurrentLine, @@ -215,12 +219,13 @@ fn handle_key(key: Key, st: &mut State<'_>) -> Option<bool> { Err(_) => return None, } } else { + if st.stk.len() < nargs { + return None; + } + delay_lf = 0; } - if st.stk.len() < nargs { - return None; - } let prevlen = st.stk.len(); let npushed = f(&mut st.stk); let sizeincr = st.stk.len() as isize - prevlen as isize; |