{{{  comments
; Same as goto-line, but does only open folds on the way to the line and not
; close all other folds. The line-argument must be in OCL-variable
; go-line-arg. The macro isn't to fast on long linear texts.
; -----------------------------------------------------------------------------
;
; using tag SCR-OFF lets go-line work without display
}}}
@if-using not(GO-LINE)
  @use (GO-LINE)
  {{{  libs
  {{{F fun/error
  :::F fun/error
  }}}
  {{{F fun/mt-fold
  :::F fun/mt-fold
  }}}
  }}}
  {{{  vars
  ( defvar
     ( go-line-arg ; input: linenumber
       x           ; help-counter
     )
  )
  }}}
  {{{  go-line
  ( deffun go-line
     ( local
        ( x go-line-arg )
        ( @if-using (SCR-OFF)
            screen-off
          @fi
          while
             pre
              ( set-counter x -(go-line-arg store-line) )
                not(counter-0 x)
             {{{  one step to correct line
             ( if counter>0 x
                {{{  down
                ( if test-bottom
                   ( @if-using (SCR-OFF)
                       screen-on
                       redraw-display
                     @fi
                     return-from-macro
                   )
                  fi
                  next-line
                )
                }}}
               else
                {{{  up
                ( if test-top ( return-from-macro ) fi
                  previous-line
                  {{{  on fold?, maybe down again
                  if or(test-fold-line,test-filed)
                   ( set-counter x -(go-line-arg store-line)
                     if counter-0 x
                      ( @if-using (SCR-OFF)
                           screen-on
                           redraw-display
                        @fi
                        return-from-macro
                      )
                     fi
                     {{{  maybe skip to end of this fold
                     if counter>0 x
                      ( if test-filed
                         ( @if-using (SCR-OFF)
                              screen-on
                              redraw-display
                           @fi
                           return-from-macro
                         )
                        fi
                        open-fold
                        mtool-bot
                      )
                     fi
                     }}}
                   )
                  fi
                  }}}
                )
                }}}
               fi
             )
             }}}
          @if-using (SCR-OFF)
            screen-on
            redraw-display
          @fi
        )
     )
  )
  }}}
  {{{  undeclare
  ( undeclare ( x ) )
  }}}
@fi
