Skip to content

Latest commit

 

History

History
267 lines (219 loc) · 4.99 KB

seek-object-between.md

File metadata and controls

267 lines (219 loc) · 4.99 KB

1

behavior <- character /$object/"\((?#inner)\)"/g

if (ok) {
   ^ 0
  foo = a+(b+(c+(d)+e)+f)+g;
   |^^^ 1   ^^ 2
} else {
  for (var i = (foo + bar); i < 1000; i++) {
  ^^^^^^^^^^^^^^^^^^^^^^^^ 3
    getAction(i)();
               ^ 4
  }
}

1 to-end

up

  • .seek.object { input: $object, where: "end" }

Old selection #1 is removed because it is not in a parens block.
Old selection #4 is removed because it is not in a parens block (the ) it is on does not count, and the next ( starts a NEW parens block).

if (ok) {
   ^^^^ 0
  foo = a+(b+(c+(d)+e)+f)+g;
             ^^^^^^^^^ 1
} else {
  for (var i = (foo + bar); i < 1000; i++) {
                         ^^^^^^^^^^^^^^^^^ 2
    getAction(i)();
  }
}

1 to-end-extend

up

  • .seek.object { input: $object, where: "end", shift: "extend" }

Old selection #1 is removed because it is not in a parens block.
Old selection #4 is removed because it is not in a parens block (the ) it is on does not count, and the next ( starts a NEW parens block).

if (ok) {
   ^^^^ 0
  foo = a+(b+(c+(d)+e)+f)+g;
            ^^^^^^^^^^ 1
} else {
  for (var i = (foo + bar); i < 1000; i++) {
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2
    getAction(i)();
  }
}

1 to-end-inner

up

  • .seek.object { input: $object, where: "end", inner: true }

Old selection #1 is removed because it is not in a parens block.
Old selection #4 is removed because it is not in a parens block (the ) it is on does not count, and the next ( starts a NEW parens block).

if (ok) {
   ^^^ 0
  foo = a+(b+(c+(d)+e)+f)+g;
             ^^^^^^^^ 1
} else {
  for (var i = (foo + bar); i < 1000; i++) {
                         ^^^^^^^^^^^^^^^^ 2
    getAction(i)();
  }
}

1 to-end-inner-extend

up

  • .seek.object { input: $object, where: "end", inner: true, shift: "extend" }

Old selection #1 is removed because it is not in a parens block.
Old selection #4 is removed because it is not in a parens block (the ) it is on does not count, and the next ( starts a NEW parens block).

if (ok) {
   ^^^ 0
  foo = a+(b+(c+(d)+e)+f)+g;
            ^^^^^^^^^ 1
} else {
  for (var i = (foo + bar); i < 1000; i++) {
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2
    getAction(i)();
  }
}

1 to-start

up

  • .seek.object { input: $object, where: "start" }

Old selection #0 is removed because it is not in a parens block (the ( it is is on does not count).
Old selection #1 is removed because it is not in a parens block.

if (ok) {
  foo = a+(b+(c+(d)+e)+f)+g;
          |^^^ 0
} else {
  for (var i = (foo + bar); i < 1000; i++) {
               |^^^^^^^^^^ 1
    getAction(i)();
             |^^ 2
  }
}

1 to-start-extend

up

  • .seek.object { input: $object, where: "start", shift: "extend" }

Old selection #0 is removed because it is not in a parens block (the ( it is is on does not count).
Old selection #1 is removed because it is not in a parens block.

if (ok) {
  foo = a+(b+(c+(d)+e)+f)+g;
          |^^ 0
} else {
  for (var i = (foo + bar); i < 1000; i++) {
  ^^^^^^^^^^^^^ 1
    getAction(i)();
             |^^ 2
  }
}

1 to-start-inner

up

  • .seek.object { input: $object, where: "start", inner: true }

Old selection #0 is removed because it is not in a parens block (the ( it is on does not count).
Old selection #1 is removed because it is not in a parens block.

if (ok) {
  foo = a+(b+(c+(d)+e)+f)+g;
           |^^ 0
} else {
  for (var i = (foo + bar); i < 1000; i++) {
                |^^^^^^^^^ 1
    getAction(i)();
              |^ 2
  }
}

1 to-start-inner-extend

up

  • .seek.object { input: $object, where: "start", inner: true, shift: "extend" }

Old selection #0 is removed because it is not in a parens block (the ( it is on does not count).
Old selection #1 is removed because it is not in a parens block.

if (ok) {
  foo = a+(b+(c+(d)+e)+f)+g;
           |^ 0
} else {
  for (var i = (foo + bar); i < 1000; i++) {
  ^^^^^^^^^^^^^^ 1
    getAction(i)();
              |^ 2
  }
}

1 select

up

  • .seek.object { input: $object }

Old selection #1 is removed because it is not in a parens block.

if (ok) {
   ^^^^ 0
  foo = a+(b+(c+(d)+e)+f)+g;
             ^^^^^^^^^ 1
} else {
  for (var i = (foo + bar); i < 1000; i++) {
               ^^^^^^^^^^^ 2
    getAction(i)();
             ^^^ 3
  }
}

1 select-inner

up

  • .seek.object { input: $object, inner: true }
if (ok) {
    ^^ 0
  foo = a+(b+(c+(d)+e)+f)+g;
              ^^^^^^^ 1
} else {
  for (var i = (foo + bar); i < 1000; i++) {
                ^^^^^^^^^ 2
    getAction(i)();
              ^ 3
  }
}

2

/$object/"\{(?#inner)\}"/g

{
  "foo": {
    "bar": 0,
  },
  "baz": null,
   | 0
}

2 select-inner

up

Make sure that the object that wraps the selection is selected, rather than the one closest to it when going backward.

  • .seek.object { input: $object, inner: true }
{
 ^ 0
  "foo": {
    "bar": 0,
  },
  "baz": null,
              ^ 0
}