Advertisement
Guest User

Untitled

a guest
May 27th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Remove whitespace from long bullet points so tabs work
  2. markerString = state.src.substr(state.bMarks[nextLine] + state.tShift[nextLine], posAfterMarker - state.bMarks[nextLine] - state.tShift[nextLine] - 1);
  3. if (markerString.length > 2) {
  4.     indent -= markerString.length - 2;
  5.     ch = state.src.charCodeAt(state.bMarks[nextLine] + state.tShift[nextLine] - 1);
  6.     if (ch === 0x09) {
  7.         state.src = state.src.substring(0, state.bMarks[nextLine] + state.tShift[nextLine] - 1) + " ".repeat(Math.max(4 - markerString.length + 2, 0)) + state.src.substring(state.bMarks[nextLine] + state.tShift[nextLine]);
  8.         state.tShift[nextLine] += 3 - markerString.length + 2;
  9.         offset += 3 - markerString.length + 2;
  10.         state.sCount[nextLine] += 3 - markerString.length + 2;
  11.         state.eMarks[nextLine] += 3 - markerString.length + 2;
  12.         max += 3 - markerString.length + 2;
  13.         for (i = nextLine + 1; i <= endLine; i++) {
  14.             state.bMarks[i] += 3 - markerString.length + 2;
  15.             state.eMarks[i] += 3 - markerString.length + 2;
  16.         }
  17.     }
  18.     else {
  19.         for (i = 0; i < markerString.length - 2; i++) {
  20.             state.src = state.src.substring(0, state.bMarks[nextLine] + state.tShift[nextLine] - 1) + state.src.substring(state.bMarks[nextLine] + state.tShift[nextLine]);
  21.         }
  22.         state.tShift[nextLine] -= markerString.length - 2;
  23.         offset -= markerString.length - 2;
  24.         state.sCount[nextLine] -= markerString.length - 2;
  25.         state.eMarks[nextLine] -= markerString.length - 2;
  26.         max -= markerString.length - 2;
  27.         for (i = nextLine + 1; i <= endLine; i++) {
  28.             state.bMarks[i] -= markerString.length - 2;
  29.             state.eMarks[i] -= markerString.length - 2;
  30.         }
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement