com.raelity.jvi
Class Buffer

java.lang.Object
  extended by com.raelity.jvi.Buffer
All Implemented Interfaces:
ViBuffer, ViOptionBag
Direct Known Subclasses:
DefaultBuffer

public abstract class Buffer
extends Object
implements ViBuffer, ViOptionBag

Buffer: structure that holds information about one file, primarily per file options. Several windows can share a single Buffer.


Nested Class Summary
 class Buffer.VisualBounds
          Calculate the 4 boundary points for a visual selection.
 
Field Summary
 ViMark b_op_end
           
 ViMark b_op_start
           
 boolean b_p_et
           
 String b_p_mps
           
 int b_p_sw
           
 int b_p_ts
           
 int b_p_tw
           
 ViMark b_visual_end
           
 char b_visual_mode
           
 ViMark b_visual_start
           
 
Constructor Summary
Buffer(ViTextView tv)
          Creates a new instance of Buffer, initialize values from Options.
 
Method Summary
 void activateOptions(ViTextView tv)
          from switchto
protected  int[] addBlock(MutableInt idx, int[] blocks, int start, int end)
           
 void addShare()
           
 int[] calculateVisualBlocks(Buffer.VisualBounds vb, int startOffset, int endOffset)
           
 void checkModeline()
          from switchto, everything else has been setup
 void displayFileInfo(ViTextView tv)
           
protected  void docInsert(int offset, String s)
           
protected  void docRemove(int offset, int length, String s)
           
static void dumpBlocks(String tag, int[] b)
           
 String getDisplayFileName()
           
 String getDisplayFileNameAndSize()
           
 int[] getHighlightSearchBlocks(int startOffset, int endOffset)
           
 File getJavaFile()
           
 ViMark getMark(int i)
          Fetch the lower case mark.
protected  String getRemovedText(DocumentEvent e)
           
 int getShare()
           
 int[] getVisualSelectBlocks(ViTextView tv, int startOffset, int endOffset)
           
protected  void initOptions()
           
protected  boolean isInsertMode()
           
 String modifyFilename(char option)
          In the future, to support multiple file modifiers, could take a File as an argument, and return a File.
 void removeShare()
           
 void viOptionSet(ViTextView tv, String name)
          The set command used to change an option
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.raelity.jvi.ViBuffer
beginInsertUndo, beginUndo, createMark, deleteChar, endInsertUndo, endUndo, getColumnNumber, getDocument, getLength, getLineCount, getLineEndOffset, getLineEndOffsetFromOffset, getLineNumber, getLineSegment, getLineStartOffset, getLineStartOffsetFromOffset, getSegment, getText, insertText, isGuarded, isInInsertUndo, isInUndo, redo, reindent, replaceChar, replaceString, setMarkOffset, undo
 

Field Detail

b_p_ts

public int b_p_ts

b_p_sw

public int b_p_sw

b_p_et

public boolean b_p_et

b_p_tw

public int b_p_tw

b_visual_start

public final ViMark b_visual_start

b_visual_end

public final ViMark b_visual_end

b_visual_mode

public char b_visual_mode

b_p_mps

public String b_p_mps

b_op_start

public final ViMark b_op_start

b_op_end

public final ViMark b_op_end
Constructor Detail

Buffer

public Buffer(ViTextView tv)
Creates a new instance of Buffer, initialize values from Options. NOTE: tv is not completely "constructed".

Method Detail

getShare

public int getShare()

addShare

public void addShare()

removeShare

public void removeShare()

initOptions

protected void initOptions()

viOptionSet

public void viOptionSet(ViTextView tv,
                        String name)
Description copied from interface: ViOptionBag
The set command used to change an option

Specified by:
viOptionSet in interface ViOptionBag

activateOptions

public void activateOptions(ViTextView tv)
from switchto

Specified by:
activateOptions in interface ViOptionBag

checkModeline

public void checkModeline()
from switchto, everything else has been setup


getMark

public ViMark getMark(int i)
Description copied from interface: ViBuffer
Fetch the lower case mark. May not be initialized.

Specified by:
getMark in interface ViBuffer

displayFileInfo

public void displayFileInfo(ViTextView tv)
Specified by:
displayFileInfo in interface ViBuffer

getDisplayFileNameAndSize

public String getDisplayFileNameAndSize()
Specified by:
getDisplayFileNameAndSize in interface ViBuffer

getDisplayFileName

public String getDisplayFileName()
Specified by:
getDisplayFileName in interface ViBuffer

getJavaFile

public File getJavaFile()
Specified by:
getJavaFile in interface ViBuffer

modifyFilename

public String modifyFilename(char option)
In the future, to support multiple file modifiers, could take a File as an argument, and return a File. Or take a String which is the list of options. VIM: ":help filename-modifiers" NEEDSWORK: missing options, only one option handled

Specified by:
modifyFilename in interface ViBuffer

getRemovedText

protected String getRemovedText(DocumentEvent e)

isInsertMode

protected boolean isInsertMode()

docInsert

protected void docInsert(int offset,
                         String s)

docRemove

protected void docRemove(int offset,
                         int length,
                         String s)

getVisualSelectBlocks

public int[] getVisualSelectBlocks(ViTextView tv,
                                   int startOffset,
                                   int endOffset)
Specified by:
getVisualSelectBlocks in interface ViBuffer

calculateVisualBlocks

public int[] calculateVisualBlocks(Buffer.VisualBounds vb,
                                   int startOffset,
                                   int endOffset)

getHighlightSearchBlocks

public int[] getHighlightSearchBlocks(int startOffset,
                                      int endOffset)

addBlock

protected final int[] addBlock(MutableInt idx,
                               int[] blocks,
                               int start,
                               int end)

dumpBlocks

public static void dumpBlocks(String tag,
                              int[] b)