com.raelity.jvi
Class Misc

java.lang.Object
  extended by com.raelity.jvi.Misc
All Implemented Interfaces:
ClipboardOwner

public class Misc
extends Object
implements ClipboardOwner


Constructor Summary
Misc()
           
 
Method Summary
static void check_cursor_col()
          Make sure curwin->w_cursor.col is valid.
static boolean coladvance(int wcol)
           
static boolean coladvance(ViFPOS fpos, int wcol)
          advance the fpos, note it may be the cursor
static int coladvanceColumnIndex(int wcol, TextUtil.MySegment txt)
           
static int coladvanceColumnIndex(int wcol, TextUtil.MySegment txt, MutableBoolean reached)
          coladvance(col).
static int coladvanceColumnIndex(TextUtil.MySegment txt)
           
static void do_put(int regname_, int dir, int count, int flags)
          put contents of register "regname" into the text.
static void getvcol(Buffer buf, ViFPOS fpos, MutableInt start, MutableInt cursor, MutableInt end)
           
static void getvcol(ViTextView tv, ViFPOS fpos, MutableInt start, MutableInt cursor, MutableInt end)
          Get virtual column number of pos.
 void lostOwnership(Clipboard clipboard, Transferable contents)
          Lost clipboard ownership, implementation of ClibboardOwner.
static int op_replace(OPARG oap, char c)
           
static int op_replace7(OPARG oap, char c)
           
static int op_yank(OPARG oap, boolean deleting, boolean mess)
          Yank the text between curwin->w_cursor and startpos into a yank register.
static void out_flush()
          This is used to do showcommand stuff.
static String plural(int n)
           
static boolean valid_yank_reg(char regname, boolean writing)
          Check if 'regname' is a valid name of a yank register.
static boolean vim_iswhite(char c)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Misc

public Misc()
Method Detail

plural

public static String plural(int n)

coladvanceColumnIndex

public static int coladvanceColumnIndex(int wcol,
                                        TextUtil.MySegment txt,
                                        MutableBoolean reached)
coladvance(col). Using cursWant as the target column, advance the cursor on the line specified by argument segment.

Returns:
the index of where to set the cursor on the line

coladvanceColumnIndex

public static int coladvanceColumnIndex(int wcol,
                                        TextUtil.MySegment txt)

coladvanceColumnIndex

public static int coladvanceColumnIndex(TextUtil.MySegment txt)

coladvance

public static boolean coladvance(int wcol)

coladvance

public static boolean coladvance(ViFPOS fpos,
                                 int wcol)
advance the fpos, note it may be the cursor


check_cursor_col

public static void check_cursor_col()
Make sure curwin->w_cursor.col is valid.

Kind of screwy, using swing component cursor is always valid, but this may backup the cursor off of a newline.


valid_yank_reg

public static boolean valid_yank_reg(char regname,
                                     boolean writing)
Check if 'regname' is a valid name of a yank register. Note: There is no check for 0 (default register), caller should do this

Parameters:
writing - if true check for writable registers

op_replace

public static int op_replace(OPARG oap,
                             char c)

op_replace7

public static int op_replace7(OPARG oap,
                              char c)

op_yank

public static int op_yank(OPARG oap,
                          boolean deleting,
                          boolean mess)
Yank the text between curwin->w_cursor and startpos into a yank register. If we are to append (uppercase register), we first yank into a new yank register and then concatenate the old and the new one (so we keep the old one in case of out-of-memory).
NEEDSWORK:

Returns:
FAIL for failure, OK otherwise

do_put

public static void do_put(int regname_,
                          int dir,
                          int count,
                          int flags)
put contents of register "regname" into the text. For ":put" command count == -1. flags: PUT_FIXINDENT make indent look nice PUT_CURSEND leave cursor after end of new text FIX_INDENT not supported, used by mouse and bracket print, [p


lostOwnership

public void lostOwnership(Clipboard clipboard,
                          Transferable contents)
Lost clipboard ownership, implementation of ClibboardOwner.

Specified by:
lostOwnership in interface ClipboardOwner

getvcol

public static void getvcol(ViTextView tv,
                           ViFPOS fpos,
                           MutableInt start,
                           MutableInt cursor,
                           MutableInt end)
Get virtual column number of pos. start: on the first position of this character (TAB, ctrl) cursor: where the cursor is on this character (first char, except for TAB) end: on the last position of this character (TAB, ctrl) This is used very often, keep it fast! From vim's charset.c I think cursor is wrong for swing. Determine the virtual column positions of the begin and end of the character at the given position. The begin and end may be different when the character is a TAB. The values are returned through the start, end parameters.

Parameters:
tv - the textview to use for fpos.
fpos - the row and column/index of char to determin vcol for
start - store the start vcol here, may be null
cursor - store the cursor vcol here, may be null
end - store the end vcol here, may be null

getvcol

public static void getvcol(Buffer buf,
                           ViFPOS fpos,
                           MutableInt start,
                           MutableInt cursor,
                           MutableInt end)

vim_iswhite

public static boolean vim_iswhite(char c)

out_flush

public static void out_flush()
This is used to do showcommand stuff.