< prev index next >

jdk/src/jdk.jline/share/classes/jdk/internal/jline/console/CursorBuffer.java

Print this page


   1 /*
   2  * Copyright (c) 2002-2012, the original author or authors.
   3  *
   4  * This software is distributable under the BSD license. See the terms of the
   5  * BSD license in the documentation provided with this software.
   6  *
   7  * http://www.opensource.org/licenses/bsd-license.php
   8  */
   9 package jline.console;
  10 
  11 import static jline.internal.Preconditions.checkNotNull;
  12 
  13 /**
  14  * A holder for a {@link StringBuilder} that also contains the current cursor position.
  15  *
  16  * @author <a href="mailto:mwp1@cornell.edu">Marc Prud'hommeaux</a>
  17  * @author <a href="mailto:jason@planet57.com">Jason Dillon</a>
  18  * @since 2.0
  19  */
  20 public class CursorBuffer
  21 {
  22     private boolean overTyping = false;
  23 
  24     public int cursor = 0;
  25 
  26     public final StringBuilder buffer = new StringBuilder();
  27     
  28     public CursorBuffer copy () {
  29         CursorBuffer that = new CursorBuffer();
  30         that.overTyping = this.overTyping;
  31         that.cursor = this.cursor;


   1 /*
   2  * Copyright (c) 2002-2012, the original author or authors.
   3  *
   4  * This software is distributable under the BSD license. See the terms of the
   5  * BSD license in the documentation provided with this software.
   6  *
   7  * http://www.opensource.org/licenses/bsd-license.php
   8  */
   9 package jdk.internal.jline.console;
  10 
  11 import static jdk.internal.jline.internal.Preconditions.checkNotNull;
  12 
  13 /**
  14  * A holder for a {@link StringBuilder} that also contains the current cursor position.
  15  *
  16  * @author <a href="mailto:mwp1@cornell.edu">Marc Prud'hommeaux</a>
  17  * @author <a href="mailto:jason@planet57.com">Jason Dillon</a>
  18  * @since 2.0
  19  */
  20 public class CursorBuffer
  21 {
  22     private boolean overTyping = false;
  23 
  24     public int cursor = 0;
  25 
  26     public final StringBuilder buffer = new StringBuilder();
  27 
  28     public CursorBuffer copy () {
  29         CursorBuffer that = new CursorBuffer();
  30         that.overTyping = this.overTyping;
  31         that.cursor = this.cursor;


< prev index next >