code: static void setTrailingWSStart(Bidi bidi)
      {
          byte[] dirProps = bidi.dirProps;
          byte[] levels = bidi.levels;
          int start = bidi.length;
          byte paraLevel = bidi.paraLevel;
  
          /* If the line is terminated by a block separator, all preceding WS etc...
             are already set to paragraph level.
             Setting trailingWSStart to pBidi->length will avoid changing the
             level of B chars from 0 to paraLevel in getLevels when
             orderParagraphsLTR==TRUE
          */
          if (dirProps[start - 1] == Bidi.B) {
              bidi.trailingWSStart = start;   /* currently == bidi.length */
              return;
          }
          /* go backwards across all WS, BN, explicit codes */
          while (start > 0 &&
                  (Bidi.DirPropFlag(dirProps[start - 1]) & Bidi.MASK_WS) != 0) {
              --start;
          }
  
          /* if the WS run can be merged with the previous run then do so here */
          while (start > 0 && levels[start - 1] == paraLevel) {
              --start;
          }
  
          bidi.trailingWSStart=start;
      }
docs: /*
  setTrailingWSStart() sets the start index for a trailing
  run of WS in the line. This is necessary because we do not modify
  the paragraph's levels array that we just point into.
  Using trailingWSStart is another form of performing (L1).
  
  To make subsequent operations easier, we also include the run
  before the WS if it is at the paraLevel - we merge the two here.
  
  This method is called only from setLine(), so paraLevel is
  set correctly for the line even when contextual multiple paragraphs.