on 6/23/03 7:41 PM, Simon Strandgaard at 0bz63fz3m1qt3001 / sneakemail.com
wrote:

> I have an absurd problem in my ruby-code. I tried recreating the
> same problem in a small piece of code, but impossible!
> Therefore I have to show you that buggy part in my application-code.
> 
> 
> /edit.rb:417:in `get_state': vspace has not been removed correct!
> (RuntimeError)
> right.empty?   true
> current.class  LineObjects::VSpace
> left.size      12
> objs.size      11
> from ./edit.rb:408:in `each'
> from ./edit.rb:408:in `get_state'
> from ./buffer.rb:312:in `get_state'
> from ./history.rb:12:in `get_memento'
> from ./control.rb:8:in `get_memento'
> from ./history.rb:31:in `execute'
> from ./control.rb:189:in `dispatch'
> from ./main.rb:24:in `run'
> from ./main.rb:22:in `loop'
> from ./main.rb:25:in `run'
> from ./main.rb:35:in `launch'
> from ./aeditor:3
> 
> 
> I don't understand why this exception occur... can someone enligthen me ?
> 
> 
> # purpose:
> # take a snapshot of current state, maybe restore it later
> # used by memento
> def get_state
> objs = @left
> objs << @current if @current
> objs += @right
> if objs.last.kind_of?(LineObjects::VSpace)
> objs.pop
> end
> objs.each do |obj|
> if obj.kind_of?(LineObjects::VSpace)
> msg =<<MSG
> vspace has not been removed correct!
> \tright.empty?   #{@right.empty?}
> \tcurrent.class  #{@current.class.to_s}
> \tleft.size      #{@left.size}
> \tobjs.size      #{objs.size}
> MSG
> raise msg
> end
> end
> [position, objs]
> end
> 
> 
> The output indicates that the last element has
> successfully been removed... but during the objs.each
> then its still present.
> 
> Why is it still present ?
> How can I remove the last element ?
> 
> --
> Simon Strandgaard
> 

The next to the last element is the last element after the delete, could
that be it?

-- 
Regards,
  JJ

Be Kind, Be Careful, Be Yourself