def
 adding here so that textpad can also use. Earlier in textarea only
 Test out with textarea too TODO
 2014-09-03 - 12:49
541365
def saveas name=nil, config={}
      unless name
        name = rb_gets "File to save as: "
        return if name.nil? || name == ""
      end
      overwrite_if_exists = config[:overwrite_if_exists] || false
      unless overwrite_if_exists
        exists = File.exists? name
        if exists # need to prompt
          return unless rb_confirm("Overwrite existing file? ")
        end
      end
      # if it has been set do not prompt. or ask only if value is :ask
      # But this should only be if there is someformatting provided, that is there 
      # is a @document
      l = @list
      # the check for document is to see if it is some old widget like textarea that is calling this.
      if @document
        if config.key? :save_with_formatting
          save_with_formatting = config[:save_with_formatting] 
        else
          save_with_formatting = rb_confirm("Save with formatting?")
        end
        if save_with_formatting
          l = @list
        else
          l = @document.native_text().map do |w| w.to_s ; end
        end
      end
      #l = getvalue
      File.open(name, "w"){ |f|
        l.each { |line| f.puts line }
        #l.each { |line| f.write line.gsub(/\r/,"\n") }
      }
      rb_puts "#{name} written."
    end
676123
protected boolean addTerm() {
        final boolean termAdded = !tokens.isEmpty();
        if (termAdded) {
            final String term = tokens.pop();
            clearAttributes();
            termAtt.append(term);
        }
        return termAdded;
    }
926656
private function AddTextField()
    {
        $name = 'Text';
        $this->AddRichTextField($name, $this->article->GetText());
        $this->SetRequired($name);
    }
1176261
function insertTextScript(text) {
    var script = document.createElement("script");
    script.type = "text/javascript";
    script.text = text;
    insertHeaderNode(script);
    return script;
}
825404
def _pad_added(self, element, pad):
        
        # Decoded data is ready. Connect up the decoder, finally.
        name = pad.query_caps(None).to_string()
        if name.startswith('audio/x-raw'):
            nextpad = self.conv.get_static_pad('sink')
            if not nextpad.is_linked():
                self._got_a_pad = True
                pad.link(nextpad)
1326378
def add_text(self, selector, new_value, by=By.CSS_SELECTOR,
                 timeout=settings.LARGE_TIMEOUT):
        
        if self.timeout_multiplier and timeout == settings.LARGE_TIMEOUT:
            timeout = self.__get_new_timeout(timeout)
        if page_utils.is_xpath_selector(selector):
            by = By.XPATH
        element = self.wait_for_element_visible(
            selector, by=by, timeout=timeout)
        self.__demo_mode_highlight_if_active(selector, by)
        if not self.demo_mode:
            self.__scroll_to_element(element)
        pre_action_url = self.driver.current_url
        try:
            if not new_value.endswith('\n'):
                element.send_keys(new_value)
            else:
                new_value = new_value[:-1]
                element.send_keys(new_value)
                element.send_keys(Keys.RETURN)
                if settings.WAIT_FOR_RSC_ON_PAGE_LOADS:
                    self.wait_for_ready_state_complete()
        except (StaleElementReferenceException, ENI_Exception):
            self.wait_for_ready_state_complete()
            time.sleep(0.06)
            element = self.wait_for_element_visible(
                selector, by=by, timeout=timeout)
            if not new_value.endswith('\n'):
                element.send_keys(new_value)
            else:
                new_value = new_value[:-1]
                element.send_keys(new_value)
                element.send_keys(Keys.RETURN)
                if settings.WAIT_FOR_RSC_ON_PAGE_LOADS:
                    self.wait_for_ready_state_complete()
        except Exception:
            exc_message = self.__get_improved_exception_message()
            raise Exception(exc_message)
        if self.demo_mode:
            if self.driver.current_url != pre_action_url:
                self.__demo_mode_pause_if_active()
            else:
                self.__demo_mode_pause_if_active(tiny=True)
757179
function TextareaState(input) {

  // Aliases
  var stateObj = this;
  var inputArea = input;
  this.init = function () {
    this.setInputAreaSelectionStartEnd();
    this.text = inputArea.getContent();
  };

  // Sets the selected text in the input box after we've performed an
  // operation.
  this.setInputAreaSelection = function () {
    inputArea.focus();
    inputArea.setSelection(stateObj.start, stateObj.end);
  };

  this.setInputAreaSelectionStartEnd = function () {
    stateObj.start = Math.min(
      inputArea.selectionMgr.selectionStart,
      inputArea.selectionMgr.selectionEnd
    );
    stateObj.end = Math.max(
      inputArea.selectionMgr.selectionStart,
      inputArea.selectionMgr.selectionEnd
    );
  };

  // Restore this state into the input area.
  this.restore = function () {

    if (stateObj.text !== undefined && stateObj.text != inputArea.getContent()) {
      inputArea.setContent(stateObj.text);
    }
    this.setInputAreaSelection();
  };

  // Gets a collection of HTML chunks from the inptut textarea.
  this.getChunks = function () {

    var chunk = new Chunks();
    chunk.before = util.fixEolChars(stateObj.text.substring(0, stateObj.start));
    chunk.startTag = "";
    chunk.selection = util.fixEolChars(stateObj.text.substring(stateObj.start, stateObj.end));
    chunk.endTag = "";
    chunk.after = util.fixEolChars(stateObj.text.substring(stateObj.end));

    return chunk;
  };

  // Sets the TextareaState properties given a chunk of markdown.
  this.setChunks = function (chunk) {

    chunk.before = chunk.before + chunk.startTag;
    chunk.after = chunk.endTag + chunk.after;

    this.start = chunk.before.length;
    this.end = chunk.before.length + chunk.selection.length;
    this.text = chunk.before + chunk.selection + chunk.after;
  };
  this.init();
}
57269
function(codeText) {

      this.textarea = WireIt.cn('textarea', null, {width: "90%", height: "70px", border: "0", padding: "5px"}, codeText);
      this.setBody(this.textarea);

      YAHOO.util.Event.addListener(this.textarea, 'change', this.createTerminals, this, true);
      
   }
424857
def pad_around(text, padding, fill: SPACE)
      fill * padding.left + text + fill * padding.right
    end
931524
private function AddPatternField()
    {
        $name = 'Pattern';
        $field = Fields\Input::Text($name, $this->textarea->GetPattern());
        $this->AddField($field);
        $this->SetTransAttribute($name, 'placeholder');
    }
47387
function updateTextArea(editor, checkForChange) {

    var html = $(editor.doc.body).html(),
      options = editor.options,
      updateTextAreaCallback = options.updateTextArea,
      $area = editor.$area;

    // Check for iframe change to avoid unnecessary firing
    // of potentially heavy updateTextArea callbacks.
    if (updateTextAreaCallback) {
      var sum = checksum(html);
      if (checkForChange && editor.frameChecksum == sum)
        return;
      editor.frameChecksum = sum;
    }

    // Convert the iframe html into textarea source code
    var code = updateTextAreaCallback ? updateTextAreaCallback(html) : html;

    // Update the textarea checksum
    if (options.updateFrame)
      editor.areaChecksum = checksum(code);

    // Update the textarea and trigger the change event
    if (code != $area.val()) {
      $area.val(code);
      $(editor).triggerHandler(CHANGE);
    }

  }
1260286
private void addNewText(final EAdd paramAdd, final Characters paramTextEvent) throws TTException {
        assert paramTextEvent != null;
        final String text = paramTextEvent.getData().trim();
        final ByteBuffer textByteBuffer = ByteBuffer.wrap(TypedValue.getBytes(text));
        if (textByteBuffer.array().length > 0) {
            if (paramAdd == EAdd.ASFIRSTCHILD) {
                mWtx.insertTextAsFirstChild(new String(textByteBuffer.array()));
            } else {
                mWtx.insertTextAsRightSibling(new String(textByteBuffer.array()));
            }
        }
    }
943597
private <T extends JTextComponent> T installSearchable(T textComponent) {

        SearchableUtils.installSearchable(textComponent);

        return textComponent;
    }
733312
function addTodo(text) {
    var todo = {
      _id: new Date().toISOString(),
      title: text,
      completed: false
    };
    db.put(todo, function callback (err, result) {
      if (!err) {
        console.log('Successfully posted a todo!');
      }
    });
  }
1243920
public function textarea($name = null, $value = null, $attr = null)
    {
        return $this->createInput('textarea', $name, $value, $attr);
    }
226362
function() {
      
      this.disabled = true;
      
      Dom.addClass(this.el,"inputEx-Button-disabled");
      
      if (this.options.type === "submit") {
         this.el.disabled = true;
      }
   }
1253000
public void select(int start, int end) {
        int docEnd = textArea.getDocument().getLength();
        textArea.select(docEnd, docEnd);
        textArea.select(start, end);
    }