public final class KillRing
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private static int |
DEFAULT_SIZE
Default size is 60, like in emacs.
|
private int |
head |
private boolean |
lastKill |
private boolean |
lastYank |
private java.lang.String[] |
slots |
Constructor and Description |
---|
KillRing()
Creates a new kill ring of the default size.
|
KillRing(int size)
Creates a new kill ring of the given size.
|
Modifier and Type | Method and Description |
---|---|
void |
add(java.lang.String str)
Adds the string to the kill-ring.
|
void |
addBackwards(java.lang.String str)
Adds the string to the kill-ring product of killing
backwards.
|
boolean |
lastYank()
Returns
true if the last command was a yank. |
private void |
next()
Moves the pointer to the current slot forward.
|
private void |
prev()
Moves the pointer to the current slot backwards.
|
void |
resetLastKill()
Resets the last-kill state.
|
void |
resetLastYank()
Resets the last-yank state.
|
java.lang.String |
yank()
Yanks a previously killed text.
|
java.lang.String |
yankPop()
Moves the pointer to the current slot back and returns the text
in that position.
|
private static final int DEFAULT_SIZE
private final java.lang.String[] slots
private int head
private boolean lastKill
private boolean lastYank
public KillRing(int size)
public KillRing()
DEFAULT_SIZE
.public void resetLastYank()
public void resetLastKill()
public boolean lastYank()
true
if the last command was a yank.public void add(java.lang.String str)
public void addBackwards(java.lang.String str)
public java.lang.String yank()
null
if the
ring is empty.public java.lang.String yankPop()
private void next()
private void prev()