From 6f7f979c056ef6a8a7a4858ea7fb609001d0733d Mon Sep 17 00:00:00 2001 From: Mark Date: Tue, 12 Mar 2024 18:36:53 -0600 Subject: [PATCH] don't skip to end of pstr in CommaSeparatedCharList token variant (#2356) --- src/heap_print.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/heap_print.rs b/src/heap_print.rs index e788c253..c844aede 100644 --- a/src/heap_print.rs +++ b/src/heap_print.rs @@ -1221,7 +1221,12 @@ impl<'a, Outputter: HCValueOutputter> HCPrinter<'a, Outputter> { let focus = self.iter.focus(); let mut heap_pstr_iter = HeapPStrIter::new(self.iter.heap, focus.value() as usize); + let next_h; + let next_hare; + if heap_pstr_iter.next().is_some() { + next_h = heap_pstr_iter.focus; + next_hare = heap_pstr_iter.focus(); for _ in heap_pstr_iter.by_ref() {} } else { return self.push_list(max_depth); @@ -1283,7 +1288,8 @@ impl<'a, Outputter: HCValueOutputter> HCPrinter<'a, Outputter> { // print an extraneous number. pstr offset value cells are never // used by the iterator to mark cyclic terms so the removal is safe. self.iter.pop_stack(); - Some(end_h) + Some(next_hare) + // Some(end_h) } else { None }; @@ -1291,7 +1297,7 @@ impl<'a, Outputter: HCValueOutputter> HCPrinter<'a, Outputter> { if !self.max_depth_exhausted(max_depth) { let pstr = cell_as_string!(self.iter.heap[h]); self.state_stack.push(TokenOrRedirect::CommaSeparatedCharList(CommaSeparatedCharList { - pstr, offset, max_depth, end_cell, end_h, + pstr, offset, max_depth, end_cell: next_h, end_h, })); } else { self.state_stack.push(TokenOrRedirect::Atom(atom!("..."))); -- 2.54.0