diff options
Diffstat (limited to 'src/main.rs')
-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; |