Package ket

Examples of ket.Selection.replace()


    switch (character) {
      case 'i': // TODO: Merge with appendNewSibling().
        ok = current.isBranch() || s.variableTokenToBranch(knownArguments);
        if (!ok) return;
        if (replacement!=null) {
          s.replace(replacement);
        }
        if (relative==RELATIVE_EDIT) {
          s.prependNewChild();
        } else {
          c.selectInOrOutLeft();
View Full Code Here


        break;
      case 'o': // TODO: Merge with prependNewSibling().
        ok = current.isBranch() || s.variableTokenToBranch(knownArguments);
        if (!ok) return;
        if (replacement!=null) {
          s.replace(replacement);
        }
        if (relative==RELATIVE_EDIT) {
          s.appendNewChild();
        } else {
          c.selectInOrOutRight();
View Full Code Here

          setMessage(current.toString());
        }
        break;
      case 'h':
        if (replacement!=null) {
          s.replace(replacement);
        }
        if (relative==RELATIVE_EDIT) {
          s.prependNewSibling();
        } else {
          c.selectLeft();
View Full Code Here

          setMessage(current.toString());
        }
        break;
      case 'l':
        if (replacement!=null) {
          s.replace(replacement);
        }
        if (relative==RELATIVE_EDIT) {
          s.appendNewSibling();
        } else {
          c.selectRight();
View Full Code Here

        boolean prepend = (character=='k');
        insertEquation(prepend);
        break;
      case ' ':
        if (replacement!=null) {
          s.replace(replacement);
        }
        if (relative==RELATIVE_EDIT) {
          document.getModes().setDocumentState(DocumentState.APPEND_PURPOSE);
          s.addNewIntermediaryParent();
        } else {
View Full Code Here

        return;
      default:
        // TODO: If you are only moving then approach this command as 'f*' or 'F+'.
        Function knownFunction =  knownArguments.getFunctionByChar(character);
        if (replacement!=null) {
          s.replace(replacement);
        }
        s.addIntermediaryParent(knownFunction);
        s.appendNewChild();
    }
    clear();
View Full Code Here

    Argument current = getSelection().getCurrent();
    EquationList el = current.getEquationList();
    Selection s = getSelection();
    Argument replacement = document.parseArgument(line.getLine());
    if (replacement!=null) {
      s.replace(replacement);
    }
  }

  public void insertEquation(boolean prepend) {
    /*-
 
View Full Code Here

    if (document.getModes().getDocumentState()==DocumentState.UPDATE_TEXT) { //! UPDATE_SUBSTITUTE UPDATE_TEXT
      // BROKEN
      document.getModes().setDocumentState(DocumentState.UPDATE_REPLACE);
      Argument replacement = nonblank ? document.parseArgument(line) : null;
      if (replacement!=null) {
        s.replace(replacement);
        setMessage(line);
      }
    } else {
      // WORKS!
      document.getModes().setDocumentState(DocumentState.UPDATE_TEXT);
View Full Code Here

      }
    } else {
      // WORKS!
      document.getModes().setDocumentState(DocumentState.UPDATE_TEXT);
      if (nonblank) {
        s.replace(new Token(new Text(line)));
        setMessage(line);
      }
    }
  }
View Full Code Here

    Argument replacement = document.parseArgument(getLine());
    boolean ok = current.isBranch() || s.variableTokenToBranch(knownArguments);
    if (!ok) return;
    // TODO: What about current.isRoot()?
    if (replacement!=null) {
      s.replace(replacement);
    }
    s.appendNewSibling();
    clear();
  }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.