Package: trowser
DescriptionTrowseris a graphical browser for large line-oriented text files with color highlighting and a highly flexible search and cherry-picking window. Trowser was developed as an alternative to tools such as “less” (UNIX) or “Notepad++” (Windows) when analyzing debug log files (or “trace files”, as they are often called in embedded software world - hence the name).Trowser has a graphical interface, but is designed to allow browsing via the keyboard at least to the same extent as less. Additional key bindings and the cursor positioning concept are derived from the Vim text editor.Note in this context “line-oriented” denotes that each line of text is considered a data unit.  Color highlighting (including search matches) will always apply the highlight to a complete line of text.When you start trowser for the first time, you’ll have to create highlight patterns for your type of file.  To do this, first enter a search pattern and verify that it matches the intended lines. Then open theEdit highlight patternsdialog in theSearchmenu, press the right mouse button to open the context menu and selectAdd current search. You can change the highlight color or select a different kind of mark-up by double-clicking on the new entry in the dialog, or by selectingEdit markupin the context menu.  To define new colors, click onEdit color paletteat the bottom of the markup editor dialog.There are several ways to quickly navigate in the file to lines matching search patterns: Firstly, you can search forwards or backwards to any sub-string or pattern you enter in theFind:field. Secondly, you can repeat previous searches by opening the search history dialog and double-clicking on an entry, or by clickingNextorPrevious. Third, you can assign bookmarks to selected text lines and jump in-between those lines by clicking on them in the bookmark list dialog or via'+and'-key bindings (not in vim.) Fourth, you can search for patterns defined in the color highlight list by selecting a pattern in the list and then clicking onNextorPreviousin the pattern list dialog. Fifth, you can open theSearch result list(via theSearchmenu or by clicking onList allin any dialog or by enteringALT-a) to display all text lines which match a set of patterns and click on an entry in this list to jump to the respective line in the main window. Sixth, you can manually copy arbitrary lines from the main text window into the search result window via the'i'key (not in vim.)The search filter list is one of the main features of the trace browser, as it allows to consecutively build an arbitrary sub-set of text lines in the main window. You can not only use one or more search patterns to add text, but also add selected text lines from the main text window via theikey binding and remove individual lines again, either manually or by use of a search pattern.  Additionally you can use bookmarks in the search result window. When searching in the main window, the search result list will scroll to show the same region of text. Thus you effectively can navigate the text on three levels: Bookmarks > Search list > Main text.Both the bookmark and search result lists support prefixing all entries with a “frame number”. This is useful when your input file does not have time-stamp prefixes on each line. In this case trowser can search for a preceding time-stamp and automatically prefix bookmarked lines with this number.  Additionally trowser allows to fetch a “frame number” which is not printed in the same line as the frame interval start line. In this case trowser searches the next frame start lines in forward and backward direction and then inside of that range for a line containing the frame number value.  Note for the search result list this feature is disabled by default for performance reasons. It must be enabled in the dialog’sOptionsmenu. The search patterns used to locate time-stamps currently have to be inserted into the RC file manually.For performance reasons most search-related commands are executed as background processes, so that the GUI remains responsive during search. For example, this applies to the initial color highlighting, global search highlighting, incremental search while editing search patterns and filling the search result list.  Such background activity is indicated by display of a progress bar and switching the mouse cursor to a watch or hourglass image.  You still can use trowser as usual during this time though.  The background activity is automatically aborted or restarted when a conflicting command is entered (e.g. when the search pattern is modified during global search highlighting.)Key bindingsGenerally, keyboard focus can be moved between control elements (e.g. buttons, check-boxes and text containers) using theTABorShift-TAB.  The widget with the keyboard focus is marked by a black border.  After start-up, keyboard focus is in the main text window.  Functions which are bound to mouse clicks on buttons etc. can be activated via the keyboard using theSpacebar. Many functions can also be activated via shortcuts: Press theALTkey plus the character which is underlines in the button description (e.g. PressALT-cto open theControlmenu, orALT-ato simulate a mouse-click on theAllbutton at the bottom of the main window.)In the following descriptions,^XmeansControl-X, i.e. holding the Control key pressed while pressing theXkey.ALTrefers to the key to the left of theSpacebar.  Enclosing quotes must be typed.Key Bindings in the Main WindowThe commands in this section can be used when the keyboard focus is in the main window.Commands to move the cursor or change the view:Up,Down,Left,RightMove the cursor in the respective direction. When the cursor hits the end of the visible area (i.e. the view), the text is scrolled vertically by a line or horizontally by a character (same as in vim, except for the smoother horizontal scrolling)Control-Up,Control-Down,Control-Left,Control-RightScroll the view by a line or character in the respective direction (not in vim - unless you have added “map <C-Down> ^E” etc. in.vimrc)h,l,k,jMove the cursor left, right, up or down (same as in vim)Return,+,-Move the cursor to the start of the following or preceding line (to be exact: the first non-blank character) (same as in vim)Space,BackSpaceMove the cursor to the next or preceding character (same as in vim)Home,End,0,$,^Move the cursor to the first or last character of the current line (same as in vim)Control-Home,Control-End,G,ggMove the cursor to the start or end of the file (same as in vim) Note an equivalent alternative toggis1g.H,M,LMove the cursor to the start of the line at the top, middle or bottom of the view (same as in vim)w,e,b,W,E,B,ge,gEMove the cursor to the start or end of the next or preceding word (same as in vim)^e,^y,^d,^u,^f,^bScroll the screen by a single line, half a screen or a full screen forwards or backwards (same as in vim)zReturn,z.,z-Adjusts the view vertically so that the current line is at the top, middle or bottom of the screen and places the cursor on the first non-blank character (same as in vim)  The horizontal view is set to start at the left border.zt,zz,zbAdjusts the view so that the current line is at the top, middle or bottom of the screen; the cursor position is unchanged (same as in vim)zl,zh,zL,zHMove the view horizontally to the left or right (same as in vim)zs,zeScroll the view horizontally so that the current cursor column is placed at the left or the right side of the screen (as far as possible); in any case the cursor position remains unchanged (same as in vim)f,FSearch for the following character in the same line to the right or left respectively (same as in vim);,,(semicolon, comma)Repeat a previous in-line search (forF) in the same or opposite direction respectively (same as in vim)''(two apostrophes)Moves the cursor to the position before the latest jump (same as in vim and less.)  A “jump” is one of the following commands:',G,/,?,n,N,L,MandH(same as in vim.)  Note movements controlled via the GUI, such as the bookmark list or search result list, do not modify the jump list.'+,'-Moves the cursor to the next or previous bookmark (not in vim)'^,'$Moves the cursor to the start or end of file (same as in less; not in vim)^o,^iMoves the cursor to the next older (or newer respectively) position in the jump list (same as in vim; noteTABwhich is identical to^iin vim has a different meaning here.) See''for a list of commands which are considered jumps and add pre-jump cursor positions to the list.1,2, …9A number without leading zeroes can be used to repeat the subsequent key command or place the cursor on a given line or column (same as in vim)For example:1Gplaces the cursor in the first line of the file;10|places the cursor in the tenth column of the current line (line and column numbering starts at 1.)  Note the number cannot start with zero, as0is treated specially (immediately moves the cursor into the first column, same as in vim.)Searching and repeating:/,?Search for the following pattern (same as in vim.) Similar to vim, the keyboard focus is moved from the main text into a small text entry field (command line in vim) Note the previous search pattern is always cleared when re-entering the entry field, but all previously used patterns are still available in the history which can be accessed with the cursor up/down keys like in vim. Note in addition, you can use^din the search field to copy the text under the cursor in the main window into the search field, word by word.As soon as a search expression is typed into the field, an incremental search is started and matching lines are highlighted. The cursor in the main text isn’t actually moved there until the search is completed by pressingReturn.  The search can be aborted by^CorEscape. For more details seeKey bindings in the search entry field.n,NRepeats the previous search in forward or backwards direction respectively (similar to vim - however in contrary to vimnalways searches forward andNalways backwards because the standard vim behavior of remembering and reversing the search direction withNis very confusing.)*,#Searches for the word under the cursor in forward or backwards direction respectively (same as in vim)  Note when regular expression search mode is not enabled, this command performs a plain sub-string text search. Else, word boundary matches are placed around the search text, as done by vim.&Remove the highlighting of previous search matches (not in vim as such, but can be added viamap & :nohlsearch^Min.vimrc)  Note this does not disable highlighting in subsequent searches.ALT-fMoves the focus in the search search entry field.  This is equivalent to/or?but without changing the search direction (not in vim) This is equivalent to clicking into the “Find:” entry field with the mouse button.ALT-n,ALT-pRepeat a previous search, equivalent tonandN(not in vim)ALT-hEnable the “Highlight all” option, i.e. highlight all lines in the text where the current search pattern matches (not in vim)ALT-aOpen the search result window and fill it with all text lines which match the current search pattern (not in vim)ALT-N,ALT-POpen the search result window and fill it with all text lines below or above the current cursor position respectively which match the current search pattern (not in vim)The following commands can be used to change the selection.Note that selected text is automatically exported and can be pasted into other applications.Shift-Left,Shift-Right,Shift-Up,Shift-DownStarts or extends the selection in the respective direction (not in vim) Note that trowser only supports the character-wise selection mode (likevin vim)Shift-Home,Shift-EndStarts or extends the selection from the current cursor position to the start or end of the current line (not in vim)Control-Shift-Home,Control-Shift-EndStarts or extends the selection from the current cursor position to the start or end of the file (not in vim)^cCopies the currently selected text to the clipboard.  (Note that this command is actually superfluous as the text is copied as soon as some text is selected.)Misc. commands (none of these are in vim):mThis key, or double-clicking into a text line, toggles a bookmark in the respective line (different from vim; note setting named bookmarks is not supported.)  Additionally the view of the search result list, if open, will be centered around the line (even if the marked line is not included in the search results.)iInsert (i.e. copy) the text line holding the cursor into the search result window. If a selection exists and is currently visible, the selected lines are copied instead. (Note the restriction to visibility of the selection exists to avoid confusion aboutinot working on the current text line.)u,^rUndo or redo respectively the last addition or removal of text lines in the search list done byior “Search All” (different from vim.)ALT-+,ALT--Increases or decreases the font size for the text content. Note the behavior when reaching the maximum or minimum font size is undefined.ALT-wToggle line-wrap for text in the main window (i.e. text lines which are longer than the window width will wrap into the next line.)Key Bindings in the Search Entry FieldThe following commands can be used when the keyboard focus is in thesearch entry fieldat the bottom of the main window:ReturnStore the current pattern in the search history and return focus to the main window with the cursor on the next match (same as vim)   Note the cursor is already moved via incremental search when entering the text (including the highlighting of adjacent matches) so the search and cursor movement need not be done again here.  This command is equivalent to leaving the search field by clicking with the mouse outside or switching keyboard focus viaTABorShift-TAB.Escape,^cAbort the current search, i.e. return focus to the main window and place the cursor on the previous position. The search pattern in the entry field is still pushed onto the history (same as in vim.)^a,^eMove the insertion cursor to the start or end of the search text entry field (^eis same as in vim;^ais not in vim.)  Note: movement and selection via cursor keys works in the same way as described for the main text.^n,^NJump to the next or previous match respectively for the current pattern using incremental search.  Note these commands do not affect the fall-back cursor position, i.e. when the search is aborted or the pattern is changed, the cursor returns to the original start position (not in vim)Up,DownCopies the previous or next pattern in the search history into the entry field. If the entry field already contains some text, the search is restricted to patterns with the same prefix.^d,^DComplete the search text with the text to the right or left of the current match in the main text (i.e. right or left of the text marked with green background color.)^xRemove the currently used pattern in the search history, if the current pattern was copied by use ofUporDown(not in vim)ALT-n,ALT-pSame as pressing theNextorPreviousbuttons respectively, i.e. search for the current pattern in forward or backwards direction and add the pattern to the search history. Keyboard focus remains in the search entry field.ALT-aOpen the search result window and fill it with all text lines which match the current search pattern (not in vim)  Additionally, keyboard focus is moved back into the main window.ALT-N,ALT-POpen the search result window and fill it with all text lines below or above the current cursor position respectively which match the current search pattern (not in vim)  Additionally, the keyboard focus is moved back into the main window.ALT-cToggle the “match case” option, i.e. equivalent to clicking onMatch case(not in vim)ALT-eToggle the regular expression search option, i.e. equivalent to clicking on buttonReg.Exp.(not in vim.)  When this option is enabled, special characters are parsed according tore_syntaxTcl manual page; the syntax is almost identical to Perl with few exceptions (notably\mand\Mto match beginning and end of words)  When the option is not enabled, no characters have a special meaning (i.e. even “*”) and a simple sub-string search is started.Note: for performance reasons it’s recommended to use case-sensitive sub-string searches for color highlighting, especially if you have many patterns. This is usually faster than combining multiple patterns with|in a regular expression.Key Bindings in the Search Result WindowThe following commands can be used in the search result window (i.e. the list filled by “Search All” and lines copied from the main window via theikey binding.)For users who prefer controls via the mouse it should be noted that there’s a context menu which opens via a click with the right mouse button into a line, which has equivalent commands to the ones listed below.mBookmark the currently selected line.  The line will be marked both in the search result window and the main window.DeleteRemove the selected lines from the search result list.uUndo the last addition or removal.^rRedo the last addition or removal (if previously undone.)/,?Moves the keyboard focus in the search entry field in the main window for entering a search expression. The behavior of the search is the same as in the main window. When leaving the search entry field viaReturnorEscape, the keyboard focus returns to the search list.n,NRepeat the last search in downwards or upwards direction respectively. The search is restricted to lines in the search result window.EscapeAbort an ongoing search. Lines which were already found and added to the search result window will remain. (You can still remove these lines using “undo”.)&Same as in the main window: Remove the highlighting of previous search matches (same as:nohlsearchin vim) and of lines highlighted in the main window by positioning via selections in the search result list.In addition to the above, the general selection dialog key bindings in the next section also work in the search result window.Key Bindings in DialogsThe following commands can be used to manipulate the selection cursor in all dialogs which display lists (i.e. search result list, search history, bookmarks, highlight pattern editor)  Note there’s no distinction between selection and cursor in these dialogs. This means you cannot move the selection cursor from line A to D using the keyboard without temporarily selecting lines B and C in-between.Of course you can also manipulate the selection via the mouse in the usual ways, i.e. clicking on single entries, or dragging the mouse to select multiple elements, or pressing the mouse while holding Control or Shift keys pressed to add or remove single elements or extend the selection respectively.Up,DownMove the selection cursor one line up or down respectively, scrolling the view if necessary.  If no line is selected yet, the cursor is placed on the first or last line; if the previously selected line is still in the visible area, the cursor is placed there instead.Home,EndMove the selection cursor on the first or last item in the list.Shift-Up,Shift-Down,Shift-Home,Shift-EndExtend or reduce the selection in the given direction, or to the start or end of the list.Page-Up,Page-DownScroll the view up or down by a page. These commands remove the selection cursor.OptionsThe following command line options are available:-hlimit,–head=limitThis option specifies the maximum number of bytes to load from input file or stream for display. When loading from a stream via STDIN, it’s possible to continue reading more data later via commandContinue loading STDIN.The limit value is remembered in the configuration file and used as default the next time data is loaded from STDIN. When loading from a file, default is to load the complete file.When neither option-hor-tare specified and data is loaded from a stream via STDIN, a small dialog window pops up when the buffer limit is exceeded. This allows the user to select between head and tail modes manually.-tlimit,–tail=limitThis option specifies to load only the given maximum number of bytes into the display from the end of the file or input stream. This means when reading from a file, data from the beginning is skipped if the file is larger than the limit.  If the input is a STDIN stream, data is read into a ring buffer of the given size. Once the end-of-stream is reached, the last content of the ring buffer is loaded into the display.The limit value is remembered in the configuration file equivalently as described for the “head” option.-rpath,–rcfile=pathThis option can be used to specify an alternate configuration file. When this option is not present, the configuration file is stored in system directories, seeFiles.Environmenttrowseronly evaluates the standard variablesDISPLAY(X11 display address) andHOME(home directory, for storing the configuration file.)Files$HOME/.config/trowser/trowser.py.rcUNIX: Configuration file where all personal settings and the search history are stored. The path may be overriden via environment variableXDG_CONFIG_HOME. A different file name can be specified with the–rcfileoption (seeOptions).During updates to this file, trowser temporarily creates a new file the same directory, where “XXXXX” is a random number. The old file is then replaced with this new file. This procedure will obviously fail if the target directory (not the file itself!) is not writable.MS Windows: On the MS Windows platform, the configuration file is created in the hidden application data directory in your user home. The specific path depends on your operating system version. (The path is qeried via a system API.)CaveatsCurrently only one pattern list for color highlighting is supported. Hence different highlighting for different file types can only be done by choosing different configuration files when starting trowser (see the–rcfileoption.)Vim compatibility: Not all vim navigation commands are implemented; Command repetition is supported only for a small sub-set of commands; Some commands behave slightly differently from vim (most notably the bookmark related commands.) vim’s range and selection commands are not supported at all.Search repetition by pressing “Next” or “Previous” or the search history dialog is currently not interruptable and may take quite a while if the next match is several MB away. (This can be avoided by repeating the search via the entry field’s internal search history, i.e./andUp)Searching with regular expressions is very slow in large files. This is unfortunately a property of the “text” Tk widget. Thus use of regular expressions for highlighting is not recommended. (As a work-around, trowser automatically falls back to plain string search if there are no control characters in the search expression.)Some GUI activity (e.g. selecting a range on text with the mouse) will render active background tasks uninteruptable, i.e. the GUI will become unresponsive until the background task has completed.File store and load dialogs do not maintain a history of previously used files or directories. (This is so because it’s expected that these features will not be used very often.)The pipe load and search result list dialogs are not designed very well yet (i.e. even more so than the other dialogs). Suggestions for improvements are welcome.Some configuration options cannot be modified via the GUI and require manually editing the configuration file.