Skip to content

Idea: New fragment selector button "insert or elide" #121

Description

@david-a-wheeler

I can't figure out a good way to help handle parentheses in "edit" mode. I think the fundamental problem is that the editor can't know which part of the expression you care about. But there's already functionality for this - the fragment selector.

So I propose adding a new button to the fragment selector, "Insert or Elide", with icon "+A".

This would let you insert text, plus the parentheses that surround it, in a way sensitive to fragments. It would even let you insert text "on both sides", e.g., of an equation. It'd also let you elide (remove) text in a way that automatically handles parentheses.

When you click on it, it pops up a dialogue box (mockup below) that lets you insert or elide text in a fragment-aware way. The heading just says "Insert or Elide"
It then shows the field name "Initial:" followed below by a copy of whatever fragment had been selected. In this case, "A = B".

Then there are checkboxes (all checked by default):

  • Insert (else elide) - normally this inserts new text, but if unchecked this will elide some text of the fragment.
  • on left (else right)
  • on both sides (else one side)

I am intentionally picking checkboxes and NOT dropdowns - dropdowns take longer to manipulate, and you want this selection process to be fast. There are only 2 options in each case, too, making dropdowns pointless.

This followed by:

  • An editable box for the "start of parentheses" symbol, "(" by default. It can be empty. If you edit this, its corresponding "end of parentheses" symbol is updated.
  • An editable box of what to insert. I drew two boxes, but I just realized that 1 are unnecessary, one will do & might be easier to use. If "insert" is not checked, this editable box disappears.
  • The fixed text "initial" ("what to insert" and "initial" are swapped in position with "on left" is unchecked).
  • An editable box for the "end of parentheses" symbol, ")" by default. It can be empty. Editing this doesn't change the "start of parentheses" symbol in case you're doing an unusual pair of "parentheses".

Then the fixed text "Result:"

This is followed by the calculated result based on what's above. The result is updated whenever the inputs are changed. The calculations are pretty simple, e.g.:

  • Initial "A = B" with "insert" "left" "on both sides" with text "(" "1 +" ")" would produce "( 1 + A ) = ( 1 + B )".
  • Initial "A = B" with "insert" "left" "NOT on both sides" with text "(" "1 +" ")" would produce "( 1 + (A = B ) )".
  • Initial "A = B" with "insert" "NOT left" "on both sides" with text "(" "+ 1" ")" would produce "( A + 1 ) = ( B + 1 )".
  • Initial "( A + B )" with "NOT insert" "left" "NOT on both sides" with text "(" ... ")" would produce "B".

Under this is what to do with the results (these might be icons):

  • Copy - Copy to clipboard
  • Cancel
  • Initial - Copy the reult into a new "initial" value, for insertion inception. You might also want an "undo" button on this row.
  • Paste - (only in editor) paste into the current fragment selection
  • Step above / step below - create a new step using the result as the step's statement (after a copy of the original typecode).

I put this into a single dialogue box because "initial" looks handy & it'd be hard to understand if it weren't all in one dialogue box.

Here's a mock-up picture.

insert_or_elide

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions