Package org.rstudio.studio.client.workbench.views.console.shell.editor

Examples of org.rstudio.studio.client.workbench.views.console.shell.editor.InputEditorSelection


   public String getCurrentSlide()
   {
      // search starting two lines ahead
      Position cursorPos = docDisplay_.getCursorPosition();
      Position searchPos = Position.create(cursorPos.getRow()+2, 0);
      InputEditorSelection sel = docDisplay_.search(SLIDE_REGEX,
                                                true,
                                                false,
                                                false,
                                                false,
                                                searchPos,
                                                null,
                                                true);
                                               
     
      if (sel != null)
      {
         InputEditorPosition titlePos = sel.getStart().moveToPreviousLine();
         String title = docDisplay_.getLine(
                           docDisplay_.selectionToPosition(titlePos).getRow());
         title = title.trim();
         if (title.length() > 0 && SLIDE_PATTERN.match(title, 0) == null)
            return title;
View Full Code Here


   }
  
   @Override
   public Position search(Position startPos, String regex)
   {
      InputEditorSelection sel = docDisplay_.search(regex,
                                                    false,
                                                    false,
                                                    false,
                                                    false,
                                                    startPos,
                                                    null,
                                                    true);
      if (sel != null)
         return docDisplay_.selectionToPosition(sel.getStart());
      else
         return null;
   }
View Full Code Here

      // check for completions disabled
      if (!completionContext_.isCompletionEnabled())
         return false;
     
      // check for no selection
      InputEditorSelection selection = docDisplay_.getSelection() ;
      if (selection == null)
         return false;
     
      // check for contiguous selection
      if (!docDisplay_.isSelectionCollapsed())
View Full Code Here

   }

   public InputEditorSelection getSelection()
   {
      Range selection = getSession().getSelection().getRange();
      return new InputEditorSelection(
            new AceInputEditorPosition(getSession(), selection.getStart()),
            new AceInputEditorPosition(getSession(), selection.getEnd()));

   }
View Full Code Here

   }

   @Override
   public InputEditorSelection createSelection(Position pos1, Position pos2)
   {
      return new InputEditorSelection(
            new AceInputEditorPosition(getSession(), pos1),
            new AceInputEditorPosition(getSession(), pos2));
   }
View Full Code Here

      selection.setSelectionRange(Range.fromPoints(pos, pos));
   }

   public InputEditorSelection getStart()
   {
      return new InputEditorSelection(
            new AceInputEditorPosition(getSession(), Position.create(0, 0)));
   }
View Full Code Here

   public InputEditorSelection getEnd()
   {
      EditSession session = getSession();
      int rows = session.getLength();
      Position end = Position.create(rows, session.getLine(rows).length());
      return new InputEditorSelection(new AceInputEditorPosition(session, end));
   }
View Full Code Here

      RnwWeave rnwWeave = getActiveRnwWeave();
      if ( (rnwWeave != null) && rnwWeave.getInjectConcordance())
      {
         if (!hasConcordanceDirective(docDisplay_.getCode()))
         {   
            InputEditorSelection doc = docDisplay_.search(
                                          "\\\\begin{document}",
                                          false,   // backwards
                                          true,    // wrap
                                          false,   // case sensitive
                                          false,   // whole word
                                          null,    // from selection
                                          null,    // range (search all)
                                          true);   // regexp mode
            if (doc != null)
            { 
               InputEditorPosition pos = doc.getEnd().moveToNextLine();
               docDisplay_.insertCode(pos, "\\SweaveOpts{concordance=TRUE}\n");
            }
         }
      }
   }
View Full Code Here

               if (currentLine.length() > 0 &&
                     cursorColumn > 0 &&
                     isAcceptableCharSequence)
               {
                  // manually remove the previous character
                  InputEditorSelection selection = input_.getSelection();
                  InputEditorPosition start = selection.getStart().movePosition(-1, true);
                  InputEditorPosition end = selection.getStart();

                  if (currentLine.charAt(cursorColumn) == ')' && currentLine.charAt(cursorColumn - 1) == '(')
                     end = selection.getStart().movePosition(1, true);

                  input_.setSelection(new InputEditorSelection(start, end));
                  input_.replaceSelection("", false);
                 
                  return beginSuggest(false, false, false);
               }
            }
View Full Code Here

      if (!input_.isSelectionCollapsed())
         return false ;
     
      invalidatePendingRequests(flushCache);
     
      InputEditorSelection selection = input_.getSelection() ;
      if (selection == null)
         return false;
     
      int cursorCol = selection.getStart().getPosition();
      String firstLine = input_.getText().substring(0, cursorCol);
     
      // don't auto-complete at the start of comments
      if (firstLine.matches(".*#+\\s*$"))
      {
View Full Code Here

TOP

Related Classes of org.rstudio.studio.client.workbench.views.console.shell.editor.InputEditorSelection

Copyright © 2018 www.massapicom. 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.