Class Less


  • public class Less
    extends java.lang.Object
    • Field Detail

      • MESSAGE_FILE_INFO

        private static final java.lang.String MESSAGE_FILE_INFO
        See Also:
        Constant Field Values
      • quitAtSecondEof

        public boolean quitAtSecondEof
      • quitAtFirstEof

        public boolean quitAtFirstEof
      • quitIfOneScreen

        public boolean quitIfOneScreen
      • printLineNumbers

        public boolean printLineNumbers
      • quiet

        public boolean quiet
      • veryQuiet

        public boolean veryQuiet
      • chopLongLines

        public boolean chopLongLines
      • ignoreCaseCond

        public boolean ignoreCaseCond
      • ignoreCaseAlways

        public boolean ignoreCaseAlways
      • noKeypad

        public boolean noKeypad
      • noInit

        public boolean noInit
      • tabs

        protected java.util.List<java.lang.Integer> tabs
      • syntaxName

        protected java.lang.String syntaxName
      • historyLog

        private java.lang.String historyLog
      • terminal

        protected final Terminal terminal
      • display

        protected final Display display
      • currentDir

        protected final java.nio.file.Path currentDir
      • sources

        protected java.util.List<Source> sources
      • sourceIdx

        protected int sourceIdx
      • reader

        protected java.io.BufferedReader reader
      • firstLineInMemory

        protected int firstLineInMemory
      • firstLineToDisplay

        protected int firstLineToDisplay
      • firstColumnToDisplay

        protected int firstColumnToDisplay
      • offsetInLine

        protected int offsetInLine
      • message

        protected java.lang.String message
      • errorMessage

        protected java.lang.String errorMessage
      • buffer

        protected final java.lang.StringBuilder buffer
      • options

        protected final java.util.Map<java.lang.String,​Less.Operation> options
      • window

        protected int window
      • halfWindow

        protected int halfWindow
      • nbEof

        protected int nbEof
      • pattern

        protected java.lang.String pattern
      • displayPattern

        protected java.lang.String displayPattern
      • size

        protected final Size size
      • syntaxFiles

        private final java.util.List<java.nio.file.Path> syntaxFiles
      • highlight

        private boolean highlight
      • nanorcIgnoreErrors

        private boolean nanorcIgnoreErrors
    • Constructor Detail

      • Less

        public Less​(Terminal terminal,
                    java.nio.file.Path currentDir)
      • Less

        public Less​(Terminal terminal,
                    java.nio.file.Path currentDir,
                    Options opts)
    • Method Detail

      • usage

        public static java.lang.String[] usage()
      • parseConfig

        private void parseConfig​(java.nio.file.Path file)
                          throws java.io.IOException
        Throws:
        java.io.IOException
      • doTabs

        private void doTabs​(java.lang.String val)
      • tabs

        public Less tabs​(java.util.List<java.lang.Integer> tabs)
      • run

        public void run​(Source... sources)
                 throws java.io.IOException,
                        java.lang.InterruptedException
        Throws:
        java.io.IOException
        java.lang.InterruptedException
      • run

        public void run​(java.util.List<Source> sources)
                 throws java.io.IOException,
                        java.lang.InterruptedException
        Throws:
        java.io.IOException
        java.lang.InterruptedException
      • moveToMatch

        private void moveToMatch​(boolean forward,
                                 boolean spanFiles)
                          throws java.io.IOException
        Throws:
        java.io.IOException
      • addSource

        private void addSource​(java.lang.String file)
                        throws java.io.IOException
        Throws:
        java.io.IOException
      • addFile

        private void addFile()
                      throws java.io.IOException,
                             java.lang.InterruptedException
        Throws:
        java.io.IOException
        java.lang.InterruptedException
      • search

        private boolean search()
                        throws java.io.IOException,
                               java.lang.InterruptedException
        Throws:
        java.io.IOException
        java.lang.InterruptedException
      • help

        private void help()
                   throws java.io.IOException
        Throws:
        java.io.IOException
      • openSource

        protected void openSource()
                           throws java.io.IOException
        Throws:
        java.io.IOException
      • moveTo

        void moveTo​(int lineNum)
             throws java.io.IOException
        Throws:
        java.io.IOException
      • moveToNextMatch

        private void moveToNextMatch()
                              throws java.io.IOException
        Throws:
        java.io.IOException
      • moveToNextMatch

        private void moveToNextMatch​(boolean spanFiles)
                              throws java.io.IOException
        Throws:
        java.io.IOException
      • moveToPreviousMatch

        private void moveToPreviousMatch()
                                  throws java.io.IOException
        Throws:
        java.io.IOException
      • moveToPreviousMatch

        private void moveToPreviousMatch​(boolean spanFiles)
                                  throws java.io.IOException
        Throws:
        java.io.IOException
      • printable

        private java.lang.String printable​(java.lang.String s)
      • moveForward

        void moveForward​(int lines)
                  throws java.io.IOException
        Throws:
        java.io.IOException
      • moveBackward

        void moveBackward​(int lines)
                   throws java.io.IOException
        Throws:
        java.io.IOException
      • eof

        private void eof()
      • bof

        private void bof()
      • getStrictPositiveNumberInBuffer

        int getStrictPositiveNumberInBuffer​(int def)
      • nextLine2display

        private Less.Pair<java.lang.Integer,​AttributedString> nextLine2display​(int line,
                                                                                     java.util.regex.Pattern dpCompiled)
                                                                              throws java.io.IOException
        Throws:
        java.io.IOException
      • prevLine2display

        private Less.Pair<java.lang.Integer,​AttributedString> prevLine2display​(int line,
                                                                                     java.util.regex.Pattern dpCompiled)
                                                                              throws java.io.IOException
        Throws:
        java.io.IOException
      • toBeDisplayed

        private boolean toBeDisplayed​(AttributedString curLine,
                                      java.util.regex.Pattern dpCompiled)
      • display

        boolean display​(boolean oneScreen)
                 throws java.io.IOException
        Throws:
        java.io.IOException
      • display

        boolean display​(boolean oneScreen,
                        java.lang.Integer curPos)
                 throws java.io.IOException
        Throws:
        java.io.IOException
      • getPattern

        private java.util.regex.Pattern getPattern()
      • getPattern

        private java.util.regex.Pattern getPattern​(boolean doDisplayPattern)
      • getLine

        AttributedString getLine​(int line)
                          throws java.io.IOException
        Throws:
        java.io.IOException
      • checkInterrupted

        public static void checkInterrupted()
                                     throws java.lang.InterruptedException
        This is for long running commands to be interrupted by ctrl-c
        Throws:
        java.lang.InterruptedException - if the thread has been interruped