# &app; &appversion; Manual

## Introduction

&app; is a binary (hex) editor, a program that enables you to edit files as sequences of bytes. It is written in C# and uses the Gtk# bindings for the GTK+ toolkit.

&app; provides the following features:

- Efficient editing of large data files.

- Multilevel undo - redo operations.

- Customizable data views.

- Fast data rendering on screen.

- Multiple tabs.

- Fast find and replace operations.

- A data conversion table.

- Advanced copy/paste capabilities.

- Highlighting of selection pattern matches in the file.

- Exporting to text and html.

- Extensibility with plugins.

## Building and Installing Bless

### &app; &appversion; requirements

The main target platform for &app; is GNU/Linux. However, all the libraries it uses are cross-platform, so &app; should be able to run without problems on all the major platforms (GNU/Linux, *BSD, Solaris, Win32).

To build and run &app; &appversion; you need:

- GTK+ >=2.8.x (Included in all modern GNU/Linux distributions, http://www.gtk.org)

- mono/.NET runtime and C# compiler >= 1.1.14 (http://www.mono-project.com)

- Gtk# >=2.8 bindings for GTK+ (http://gtk-sharp.sourceforge.net)

- pkg-config (Included in all modern GNU/Linux distributions)

- meson >=0.46

- nunit and nunit-console, if you want to build and run tests

- xsltproc and docbook stylesheet, if you want to produce HTML documentation

Development is done using the latest stable versions of the above libraries. Although using an older version may be OK, there is no guarantee that there will not be problems.

### Installation guide

If you downloaded bless as a distribution specific package (eg .rpm, .deb, .tgz) follow your distribution's instructions on how to install packages.

If you downloaded Bless from the git repo, or as a source .tar.gz or .tar.bz2 package you will need to build it and install it manually. The building and installation procedure is described below:

Overview: git clone https://github.com/afrantzis/bless, meson setup build (-Dopt=val --buildtype=type ...), ninja -C build, (ninja -C build install)

Step 1: Get the source

- To get the latest source:

  `git clone https://github.com/afrantzis/bless`

  For a compressed tarball use:

  `tar -xf bless-a.b.c.tar.gz`

Step 2: Configure the build

- Enter the directory created in the previous step (bless or bless-a.b.c). To configure the build and check that your system has all the required libraries use:

  `meson setup build (-Dopt=val --buildtype=type ...)`

  Use the `--prefix=`PREFIX`` option to set the installation directory prefix. By default the prefix is '/usr/local'.

  You can use the `--buildtype=release` option to build bless in release mode. By default the debug mode is built.

Step 3: Build the program

- Type `ninja -C build`. This will create `bless.exe` and the necessary libraries in the build/src directory. You can also use `ninja -C build test` to run some tests on various bless components. Note that running the tests requires the `nunit-console` binary.

Step 4: Install the program (optional)

- Become root and type `ninja -C build install`.

## Getting Started

### To Start &app;

You can start &app; in the following ways:

Applications menu

- Choose Programming/Development Bless Hex Editor .

Command line

- To start &app; from a command line, type the following command, then press Return:

  `bless` `filenames`

  where `filenames` are the names of the files you want to open. If you don't specify any files, &app; will try to load the previous session. If that fails &app; will open an empty file for you.

### When You Start &app;

When you start &app;, the following window is displayed.

#### &app; Start Up Window

Shows &app; main window. Contains titlebar, menubar, toolbar, display area, and scrollbars. Menubar contains File, View, Settings, and Help menus.

The &app; window contains the following elements:

Menubar

- The menus on the menubar contain all of the commands you need to work with files in &app;.

Toolbar

- Provides shortcuts to the commands that are most frequently used when working with files in &app;.

Data View

- The data view contains multiple tabs that display the data of the files you are editing.

Conversion Table

- The conversion table displays the bytes at the current file position converted to various formats.

Statusbar

- The statusbar displays information about current &app; activity and information about the current file.

## Using &app;

### Working with files

&app; supports multiple tabs in the Data View. Each tab contains data that belong to either an existing or a new file. In case the data is related to an existing file, the file's name is displayed on the tab label. Otherwise the tab is marked with a name of the form "Untitled `N`", where `N` is a number.

When a file has been modified since its last save, an asterisk "*" is displayed next to its name.

&app; can currently handle regular files and block device files (eg /dev/hda).

#### Creating a new file

To create a new file for editing use Ctrl N File New .

This action creates a new tab with an empty file.

#### Opening an existing file

To open an existing file for editing use Ctrl O File Open .

You may also open one or more existing files by dragging and dropping them into the &app; window.

This action normally creates a new tab containing the opened file. An exception to this happens when the tab that was active before opening the new file contained an empty file. In that case the old tab is replaced with the new one.

#### Saving a file

- To save a file make sure the tab that contains it is active and use Ctrl S File Save .

- To save a file under a different name or at another location, make sure the tab that contains it is active and use Shift Ctrl S File Save As .

If the data in a tab isn't related to an existing file (for example if it is a new file), the Save action actually performs a Save As action.

#### Closing a file

To close a file, make sure the tab that contains it is active and use Ctrl W File Close .

You can also close a file by clicking on the close icon on its tab label:

##### Closing a tab

Shows how to close a tab using the close icon on its tab label

If the file has changed since the previous save you will be prompted to save it.

#### Changing the active file

You can switch between tabs, therefore making the file the tab contains the active one, using a number of ways:

- By clicking on the tab label of the tab you want to switch to.

- By pressing Alt `N`, where `N` is the number of the tab you want to switch to. This method works for the first nine tabs. For example to switch to the second tab you should press Alt+2.

- By pressing Alt Left arrow or Alt Right arrow, you can switch to the tab immediately to the left or right of the currently active tab.

### Data View basics

The Data View is the part of &app; that displays the data of the files you are editing and enables you to manipulate them. It consists of (possibly) many tabs, each corresponding to a file you are editing. Each tab contains areas that display the file's data in various formats. An area can be one of the following types:

- Offset Area: Displays the offset of the first byte at the specified row.

- Separator Area: Displays a vertical separator line.

- Hexadecimal Area: Displays the data in hexadecimal number base.

- Decimal Area: Displays the data in decimal number base.

- Octal Area: Displays the data in octal number base.

- Binary Area: Displays the data in binary number base.

- Ascii Area: Displays the data as Ascii text.

The types and placement of the areas that each tab contains can be customized with layout files. See bless-customizing-layouts for more information on how to write and use layout files.

#### Selecting the active area

At any time only one of the areas accepts and handles editing events. This area is said to have the focus. All areas except Offset and Separator may have the focus.

##### Cursor in focused and not focused areas

Shows the difference in the cursor when an areas has the focus or not.

The cursor in the focused area consists of a horizontal line under the current byte and a vertical line just before the active digit of the current byte. In contrast, the cursor in a non-focused area consists of only the horizontal line beneath the current byte.

Changing the area that has the focus can be done in two ways:

- Using the TAB key cycles the focus among the available areas.

- Pressing or releasing the left mouse button in an area, or moving with the left mouse button pressed into an area, gives the focus to that area. If the area can't accept the focus (eg it is a Separator area), the focus remains unchanged.

#### Scrolling

If the file you are editing is big enough, only a small range of its data will be visible in the Data View. The size of the visible data is called a page and changes as the &app; window is resized.

To change the visible range of a file's data you should scroll the Data View. You can scroll the Data View in two ways:

- Using the scrollbar that is located at the right side of the Data View. The scrollbar is visible only if the file is too large to fit in one page.

- Using the wheel on your mouse, if it has one.

Scrolling the Data View does not change the cursor position.

### Editing a file

#### Basic editing operations

##### Changing the current cursor position

You can move the cursor in two ways:

Using the keyboard

- - Pressing the Up Arrow key moves the cursor to the byte just above the current one.
  - Pressing the Down Arrow key moves the cursor to the byte just below the current one.
  - Pressing the Left Arrow key moves the cursor to the previous digit of the current byte. If the cursor was at the first digit of a byte, it is moved to the last digit of the previous byte.
  - Pressing the Right Arrow key moves the cursor to the next digit of the current byte. If the cursor was at the last digit of a byte, it is moved to the first digit of next byte.
  - Pressing the Page Up key moves the cursor to the byte which is one page before the current position.
  - Pressing the Page Down key moves the cursor to the byte which is one page after the current position.
  - Pressing the Home key moves the cursor to the first byte in the file.
  - Pressing the End key moves the cursor one byte after the last byte in the file.

Using the mouse

- Clicking on a digit of a byte moves the cursor to that byte and digit.

If the new cursor position is outside the currently visible page of data, the view scrolls automatically so that the new cursor position is made visible.

##### Moving the cursor to a specific position

To access the Go to Offset Bar use: Ctrl G Search Go to Offset .

###### Go to Offset Bar

Go to Offset Bar

To move the cursor to a specific position in the file:

1. Type the offset in the Offset text entry (in the desired number format). if the typed offset starts with '0x' it is considered hexadecimal, if it starts with '0' it is considered octal, otherwise it is considered decimal.

2. Press the Go to Offset button

##### Selecting a range of data

There are three ways to select a range of data from the file you are editing:

Using the keyboard

- - Position the cursor at one end of the range you want to select.
  - Hold down the Shift key and move the cursor to the other end of the range using the keyboard. As you move the cursor, the currently selected data range will be highlighted.
  - Release the Shift key.

Using the mouse

- - Position the cursor at one end of the range you want to select.
  - Hold down the Left mouse button and move the cursor to the other end of the range using the mouse. As you move the cursor, the currently selected data range will be highlighted.
  - Release the Left mouse button.
  - ...alternatively, while pressing the Shift key, position the mouse pointer over the other end of the selection and click using the Left mouse button.

Using the Select Range Bar

- To access the Select Range Bar use: Ctrl Shift R Edit Select Range .

  ###### Select Range Bar

  Select Range Bar

  To select a range:

  1. Type the starting offset in the from text entry (in the desired number format). if the typed offset starts with '0x' it is considered hexadecimal, if it starts with '0' it is considered octal, otherwise it is considered decimal.

  2. Type the ending offset in the to text entry (in the desired number format). if the typed offset starts with '0x' it is considered hexadecimal, if it starts with '0' it is considered octal, otherwise it is considered decimal.

     Instead of specifying an absolute ending offset you can specify the length of the selection. To do this type the length in the to text entry, prepending it with either '+' or '-'. The '+' or '-' specify the direction of the selection: '+' means select towards the end of the file and '-' means select towards the beginning. The selected range always contains the starting offset.

Selecting a range of data has another useful effect: all the patterns matching the selected data in the file are highlighted, thus providing a quick way to find or emphasize patterns. The color of the highlighting can be changed using Layout files (see bless-customizing-layouts). This feature can be turned off in the Preferences Dialog (see bless-customizing-preferences-general).

The patterns matching the selected data are highlighted only if the selected data size is at most 1024 bytes.

##### Toggling Overwrite/Insert edit mode

By pressing the Insert key on the keyboard or by clicking on the edit mode statusbar, you can change the edit mode &app; is currently in. The edit mode determines what happens when you add new data to the file. There are two available modes:

Insert Mode

- The new data is inserted at the current cursor position. &app; automatically makes space for the new data.

Overwrite Mode

- The new data overwrites the old data, starting from the current cursor position.

###### Edit mode statusbar display

Shows the edit mode display in the statusbar

The current edit mode is displayed at the far right in the statusbar.

##### Changing the statusbar number base

You can change the number base of the information displayed in the statusbar (current offset, current selection). Clicking on the Offset or Selection information in the statusbar cycles among Hexadecimal, Decimal and Octal number bases. You can distinguish the current number base by checking the prefix of displayed numbers. A "0x" prefix denotes Hexadecimal, a "0" prefix denotes Octal and no prefix denotes Decimal.

###### Statusbar number base

Shows statusbar information in several number bases

##### Modifying the data

You can directly modify the data in a file by using the keyboard:

Inserting a new byte at a specific position

- - Make sure you are in Insert Mode.
  - Move the cursor to the first digit of desired position.
  - Press the keys which correspond to the digits of the desired byte. Each keypress automatically moves the cursor one position to the right.

Modifying an existing byte

- - Make sure you are in Overwrite Mode (only required if you want to modify the first digit of a byte).
  - Move the cursor to desired byte/digit position.
  - Press the keys which correspond to the digits of the desired byte. Each keypress automatically moves the cursor one position to the right.

Appending data to the end of the file

- - Move the cursor to the position just after the last byte in the file.
  - Press the keys which correspond to the digits of the desired byte. Each keypress automatically moves the cursor one position to the right.

Each area accepts only certain digits (eg the hexadecimal area accepts only 0-9 and A-F). If a key (representing a digit) is pressed in an area that doesn't accept it, the keypress is ignored.

#### Clipboard operations

Bless features an advanced system to handle clipboard operations.

##### Copy and Cut operations

To copy the selected data to the clipboard use: Ctrl C Edit Copy .

To cut the selected data from the file and copy it to the clipboard use: Ctrl X Edit Cut .

When copying or cutting data, that data becomes available to &app; and other applications as well. &app; can offer its data to other applications in two main formats:

Raw bytes

- &app; can offer the selected data as raw bytes to applications that can handle it, for example other hex editors. This is the format &app; uses when interacting with itself (for example when you copy from a tab and paste into another).

UTF-8 string

- &app; can offer a string representation of the selected data in various number bases or UTF-8 text. The number base is determined by the type of the area that has the focus at the end of the selection action for the cut/copied data. For example if that area is hexadecimal, the offered string will contain the hexadecimal string representation of the selected data. If the ending area is the text area, the offered string will contain the UTF-8 text represented by the selected data (if possible).

##### Paste operation

To paste data from the clipboard to the current cursor position use: Ctrl V Edit Paste .

The value of the Overwrite/Insert mode, affects the way paste operations function. If the mode is Insert, the pasted data is inserted at the current cursor position. If the mode is Overwrite, the pasted data overwrites the data from the cursor position and on, as needed.

Pasted data can originate from &app; itself or some other application. &app; can accept data in two formats:

Raw bytes

- This is the format &app; uses when interacting with itself (for example when you copy from a tab and paste into another). External applications that offer raw bytes are usually other hex editors.

UTF-8 string

- &app; can accept data as a UTF-8 string (for example, from a text editor). It tries to parse the data and convert it to raw bytes according to the type of the area that currently has the focus. For example if the focus is in an octal area, &app; will try to parse the string as a sequence of bytes represented in octal format. If the parse fails, the data will be inserted as UTF-8 text (as if they had been pasted into a text area).

##### Copy offset(s) operations

To copy the offset(s) of the current cursor position or the currently selected range use: Ctrl Shift C Edit Copy Offset(s) . This operation is also available in the pop-menu when right-clicking in the Data View.

If there is an active selection this operation copies the start and end offsets of the selection to the clipboard, separated by a comma. Otherwise, just the offset of the cursor position is copied to the clipboard.

The number base used for the offsets is determined by a plugin preference which can be set through the preferences dialog. See bless-customizing-layouts.

#### Undo/Redo operations

To undo previous actions use: Ctrl Z Edit Undo .

To redo previously undone actions use: Shift Ctrl Z Edit Redo .

### Searching and Replacing in files

#### Searching in files

To access the Search Bar use Ctrl F Search Find .

##### Search Bar

Search Bar

To search for a sequence of bytes:

1. Type the sequence in the Search for text entry (in the desired format).

2. Select the format of the typed sequence from the Interpret as option menu.

3. Press the Find Next or Find Previous button. If a match is found it will be highlighted in the Data View, otherwise an alert informing you that no match was found will be shown.

To hide the Search Bar press the Escape key while the bar has the focus or click on the close button located at the right side of the bar.

You can use the F3 Search Find Next and Shift F3 Search Find Previous commands to search without re-opening the Search Bar.

#### Replacing in files

To access the Replace Bar use Ctrl R Search Replace .

##### Replace Bar

Replace Bar

To replace a sequence of bytes with another sequence of bytes:

1. Type the search sequence in the Search for text entry (in the desired format).

2. Select the format of the search sequence from the first Interpret as option menu.

3. Type the replace sequence in the Replace with text entry (in the desired format).

4. Select the format of the replace sequence from the second Interpret as option menu.

5. Press the Replace button to replace the current match, the Replace All to replace all matches in the file or the Find button to skip the current match and go to the next match. If a match is found it will be highlighted in the Data View, otherwise an alert informing you that no match was found will be shown.

To hide the Replace Bar press the Escape key while the bar has the focus or click on the close button located at the right side of the bar.

To delete the matched search sequences, leave the Replace with text entry completely blank.

### Exporting Data

&app; features an advanced and customizable export system. It can currently export data to text or html files.

#### Export Patterns

The exporting is based on an export pattern. The pattern consists of string literals and special command strings. The literals are printed in the output file as they are whereas the command strings tell the exporter to do something. Commands strings are enclosed in '%'s and specify the command and its parameters. The command is specified by an uppercase letter and the parameters by lowercase letters. Each letter (whether it corresponds to a command or a parameter) may be followed by an argument enclosed in double quotes '"'.

Command | Description | Parameters [default]
Export (E) | Writes actual data. | E: the number of bytes to export ["1"] p: the prefix to write before each byte [""] s: the suffix to write after each byte [""] x: the separator to use between bytes [""] e: the string to use for not printed bytes (due to alignment) [" "] t: the type to export the byte(s) to (see below) ["H"]
Ignore (I) | Ignores data. | I: the number of bytes to ignore ["1"]
Offset (O) | Writes the current offset. | O: the number of digits to use for writing the offset ["8"] t: the type to write the offset in (see below) ["H"]

Export Type | Description
H | Hexadecimal with uppercase characters
h | Hexadecimal with lowercase characters
D | Decimal
O | Octal
B | Binary
A | Ascii

Command strings can be grouped together with square brackets '[',']'. After such a group of commands is executed the pointer which keeps track of the next byte to export is reset to the position it had just before the group was executed.

Some sample patterns and their output will make things much clearer:

%O"4"%: %E"4"p"0x"x" "% - %E"4"p"0x"x" "%\n

-     0000: 0x00 0x01 0x02 0x03 - 0x04 0x05 0x06 0x07
      0008: 0x08 0x09 0x0a 0x0b - 0x0c 0x0d 0x0e 0x0f
      0010: 0x10 0x11 0x12 0x13 - 0x14 0x15 0x16 0x17
      0018: 0x18 0x19 0x10 0x1a - 0x1b 0x1c 0x1d 0x1e
      0020: 0x1f                -

[%E"2"% %I"2"% %E"2"% %I"2"%] %I"2"% %E"2"% %I"2"% %E"2"%\n

-     0001  0405   0203  0607
      0809  0c0d   0a0b  0e0f
      1011  1415   1213  1617
      1819  1b1c   101a  1d1e
      1f

#### Export Dialog

Export Dialog

#### Export Dialog

Export to file

- The name of the file to export the data to.

Export type

- The type of file to export to. New types can be added with plugins.

Export pattern

- The pattern to use when exporting the file (see bless-usage-export-pattern). Use the save and delete buttons next to the pattern entry to manage the saved patterns.

Range

- The range of data to export.

### Performing bitwise operations

To access the Bitwise Operations Bar use Ctrl B Tools Bitwise Operations .

#### Bitwise Operations Bar

Bitwise Operations Bar

To apply a bitwise operation on a range of data:

1. Select the range to apply the operation on (see bless-usage-edit-basic-select). If no range is selected the operation will be performed on the current offset. The selected range is displayed at the far left of the bar. Clicking on the displayed range cycles the number base used to display it (Hexadecimal, Octal, Decimal).

2. Select the desired operation from the operations list. Available operations are AND, OR, XOR and NOT.

3. Type the data to use for the operation in the data text entry (if applicable).

4. Select the type of the data from the data type list.

5. Press the Execute button to perform the operation.

## Customizing &app;

### Configuration Files

&app; keeps its configuration files under `$XDG_CONFIG_HOME/bless` (usually `$HOME/.config/bless` on UNIX based systems and `C:\Documents and Settings\User Name\Application Data\bless` on MS Windows systems) in accordance to the XDG specification. This directory contains the following files and directories

###

export_patterns

- Keeps the list of saved export patterns.

history.xml

- Keeps the list of recently opened files.

last.session

- Keeps the state of &app; the last time it was closed. This includes the open files, the file offset and cursor offset in each file, the active file, the window dimensions etc.

preferences.xml

- Keeps the user preferences.

layouts/

- This directory holds the layout description files for each user. See bless-customizing-layouts.

### Preferences

You can edit the user preferences in the Preferences dialog. It can be accessed by using Edit Preferences... .

#### General Preferences

General Preferences

#### Default Layout

Layout File

- The layout file to use when opening a new tab. If it is left empty a default will be used.

Use layout of currently active tab if any

- If it is checked, &app; will try to use the layout of the currently active tab for new tabs. If there are no open tabs, &app; will use the file from the "Layout File" preference.

#### Misc

Default edit mode

- The edit mode new tabs will be placed in (Insert or Overwrite).

Temporary Directory

- The directory to save temporary files into (leave blank for default eg /tmp). When a file is saved, it is saved into this directory and then moved to its final position.

#### Undo Preferences

Undo Preferences

#### Undo Limit

Limit to X actions

- Limit the number of actions that can be undone to X actions.

Unlimited Undo

- Don't limit the number of actions that can be undone.

#### Keep Undo History After Save

Always

- Always keep undo history after a file is saved.

  When dealing with large amounts of undo data this option may fill up all memory and cause a severe degradation of system performance.

What fits in main memory

- Only keep the part of the history that fits in main memory (RAM).

Never

- Never keep undo history after a file is saved.

#### Session Preferences

Session Preferences

####

Load previous session on startup

- Whether the previous session (the state of Bless at the time of the last quit) should be loaded on startup. The state includes all open files, the focused tab, the focused area in each file, the cursor position in each file and the window geometry.

Ask before loading session

- Ask before loading session on startup.

Remember cursor position

- Whether &app; should remember and restore the position of the cursor in each of the loaded files when loading the previous session.

Remember window geometry

- Whether &app; should remember and restore the window size when loading the previous session.

### Layout Files

The way &app; presents the data is highly customizable. The configuration is done through layout description files. Currently there is no way to graphically edit the layouts but one is planned for a later version.

#### Selecting a layout

&app; searches for layout description files in the `$XDG_CONFIG_HOME/bless/layouts` directory (usually $HOME/.config/bless/layouts). You can preview and select the available layouts with the layout selection dialog, which can be accessed by using View Layouts .

#### Creating Layout Files

Layout description files are XML files ending with the .layout suffix. They consist of the <layout> tag which contains a series of <area> tags that describe each area in the layout. The <area> tag takes one attribute, type, which defines the type of the area. The valid values for type are:

Type | Description
hexadecimal | Displays the data in hexadecimal format.
decimal | Displays the data in decimal format.
octal | Displays the data in octal format.
binary | Displays the data in binary format.
ascii | Displays the data in ascii format.
offset | Displays the data offset.
separator | A vertical line that visually separates areas.

For example, the following simple layout file:

    <layout>
    	<area type="offset"></area>
    	<area type="hexadecimal"></area>
    	<area type="offset"></area>
    	<area type="separator"></area>
    	<area type="ascii"></area>
    </layout>

produces the standard offset-hex-ascii view with default colors:

##### Standard offset-hex-ascii view

Standard offset-hex-ascii view

Each area may include additional options about how to display the data. Some options are available to all areas whereas others are area-specific. The options that aren't explicitly defined assume their default values. Also if an option is specified for an area that doesn't support it, the option is just ignored.

Option | Values | Description | Areas
display | see below | The fonts and colors that should be used for the display. | all
case | upper|lower | Whether to display hexadecimal values using lowercase or uppercase. | offset, hexadecimal
grouping | #int | The number of bytes that should be grouped together in each column. | hexadecimal, decimal, octal, binary
bpr | #int | The number of bytes on each row in the area (see below for more information) | hexadecimal, decimal, octal, binary, ascii
bytes | #int | The number of bytes which will be used to display offsets (default 4) | offset

##### The bpr option

The <bpr> (bytes per row) option sets the (maximum) number of bytes that each row in an area can have. If it is not specified, the number of bytes on each row changes dynamically in order to fill the whole available width. If it is specified in at least one area in the layout all the areas in the layout conform to the specified restriction. In case of a conflict, for example when two areas specify different bprs, the smallest value is used. Finally, if there is a conflict between bpr and grouping values, the highest value that conforms to the grouping and is below the bpr is used (eg if bpr=5 and grouping=2 the bytes per row will be 4).

##### The display option

The <display> option is the most complicated of the lot and deserves additional explanation.

Bless distinguishes between even and odd rows, and even and odd columns. You can choose how to color each of the above items thus creating a visual result tailored to your needs. This is achieved by using the <display> tag. Note that the first row and column are numbered as 0 and are therefore considered even.

A <display> tag may contain a <font> tag which sets the font family and size to use for displaying data in the area (eg "Courier 10"). The font should be a monospaced font, otherwise the data in the area won't be displayed correctly. It is also advised to use same sized fonts in all the areas so that the data is correctly aligned.

A <display> tag may also contain a <evenrow> and a <oddrow> tag which describe how the even and odd rows will look like. Each of the <evenrow> and <oddrow> tags may contain a <evencolumn>, an <oddcolumn>, a <selectedcolumn> and a <patternmatchcolumn> tag. The first two describe the appearance of the respective columns under normal conditions (no highlighting). The <selectedcolumn> tag describes the appearance of selected bytes and the <patternmatchcolumn> tag the appearance of the highlighted bytes that match the selected bytes (see bless-usage-edit-basic-select). The description for all the above is accomplished by using the <foreground> and <background> tags which specify the foreground and background colors to use.

The colors can be specified either by name (eg dark blue) or by an RGB triad (eg #ff004e).

###### Display tag hierarchy

Display tag hierarchy

An example:

    <layout>
        <area type="offset">
            <display>
                <evenrow>
                    <evencolumn>
                        <foreground>dark red</foreground>
                    </evencolumn>
                </evenrow>
                <oddrow>
                    <evencolumn>
                        <foreground>dark red</foreground>
                    </evencolumn>
                </oddrow>
            </display>
        </area>

        <area type="separator">
            <display>
                <evenrow>
                    <evencolumn>
                        <foreground>dark green</foreground>
                        <background>white</background>
                    </evencolumn>
                </evenrow>
            </display>
        </area>

        <area type="hexadecimal">
            <grouping>2</grouping>
            <case>upper</case>
            <display>
                <evenrow>
                    <selectedcolumn>
                        <foreground>white</foreground>
                        <background>#8faec8</background>
                    </selectedcolumn>
                </evenrow>
                <oddrow>
                    <evencolumn>
                        <background>#eeeeee</background>
                    </evencolumn>
                    <oddcolumn>
                        <background>#eeeeee</background>
                    </oddcolumn>
                    <selectedcolumn>
                        <foreground>white</foreground>
                        <background>#7b96ac</background>
                    </selectedcolumn>
                </oddrow>
            </display>
        </area>

        <area type="separator">
            <display>
                <evenrow>
                    <evencolumn>
                        <foreground>dark green</foreground>
                        <background>white</background>
                    </evencolumn>
                </evenrow>
            </display>
        </area>

        <area type="decimal">
        </area>

        <area type="separator">
            <display>
                <evenrow>
                    <evencolumn>
                        <foreground>dark green</foreground>
                        <background>white</background>
                    </evencolumn>
                </evenrow>
            </display>
        </area>

        <area type="binary">
        </area>
    </layout>

The result is:

###### Example layout

Example layout screenshot

Not all font options are used in all areas. The hexadecimal, decimal, octal and binary areas use all options. The ascii, offset and separator areas do not use the <oddcolumn> tag.

The */evencolumn/background colors are considered the primary background colors for their respective row. They are used to paint all parts of the row that are not otherwise painted (eg space between columns). The evenrow/evencolumn/background color is also considered the main background color of the area and is used to paint the unused parts of the area.

### Extending with plugins

As of version 0.5.0 &app; can be extended by using plugins. Internally &app; uses plugins for almost all of its GUI. Currently the parts that can be extended by plugins are:

- The GUI
- The areas displayed inside the Data Views
- Export builders

See the developer documentation for more information on how to write plugins (TODO).

## Frequently Asked Questions

## Philosophical Questions

Why did you start Bless? Aren't there enough hex editors?

There aren't enough free (as in speech) graphical hex editors. The two main ones are khexedit and ghex. Khexedit hasn't been updated in years and ghex is moving very slowly.

So, why didn't you contribute to one of the existing projects?

I wanted to try out the mono/Gtk# combination for graphical applications and none such project existed.

What kind of name is Bless?

It is a wordplay on the word hex. Hex also means curse and a bless(ing) is the opposite of a curse.

## Technical Questions

How can I get the latest source of Bless?

Bless now uses Git as its version control system. After you install Git on your system use the following command to get the latest version of Bless into the bless directory (this might take some time):

`git clone https://github.com/afrantzis/bless`

If you already downloaded a previous version (using the above command, not source tarballs) and want to update to the latest version use:

`git pull`

from within the directory that contains the previous version.

I don't like the way Bless displays data. Can I change it?

Yes! Bless is highly customizable. See bless-customizing-layouts

I am trying to save a large file (under the same name) but while saving Bless complains that there is no space left! I was sure I had enough space! What's going on?

To be able to save a file under the same name (File->Save command) you need to have (temporarily) enough disk space to hold both the original and the new file. This happens because the new file is created in a temporary file directory (eg /tmp see bless-customizing-preferences-general) and then moved to its proper position. For example if you have a 20MB file and edit it so that it becomes 21MB and the new file is supposed to be saved in the same storage device as /tmp, you need to have 20+21=41MB free space in that storage device to be able to save it. After a successful save, the original file is deleted, in this case freeing 20MB.Although this can be a problem (when there is not enough disk space), it can also be seen as a safety measure in case something goes wrong when saving.

A notable exception to the above is when the size of the file to be saved has not been changed. In that case the file is saved in-place.

The data in the data areas isn't displayed correctly! What is wrong?

On some systems the data in the data areas are garbled. This is an issue with the font subsystem. What happens is that the font subsystem reports to Bless a different font width than the one that is actually used on screen. This bug should be fixed in current versions of Pango.

Anyway, the bug is now irrevelevant: since version 0.5.0 &app; uses a different way to measure the font width. Also, the temporary workaround with the FontWidthFix preference introduced in 0.4.1 is now disabled. If you are still experiencing such problems with versions >= 0.5.0 please file a bug report.

Where does Bless keep its configuration files?

See bless-customizing-config

## About &app;

&app; was written by Alexandros Frantzis (alf82 at freemail dot gr). To find more information about &app;, please visit the Bless Web page.

This program is distributed under the terms of the GNU General Public license as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. A copy of this license can be found at this link, or in the file COPYING included with the source code of this program.