ghalkes:~# command line tools

The Tilde Text Editor

Development

Git Repositories

Development of Tilde and the Tilde Terminal Toolkit libraries is at Github. The repositories can be found here.

To clone all the repositories, first clone the t3shared repository (git). In this repository you will find the init script, which clones all the other repositories.

After cloning all the repositories, make sure you have the required development packages installed (libsigc++, libpcre, libunistring, libtranscript, libxcb and of course libncurses). Then by running:

$ ./t3shared/doall make -C src

from the directory containing the repositories, you can compile all the libraries and Tilde in a single go.

Design Principles

The development of Tilde is guided by the following design principles:

  • Tilde should use the same short-cuts and idoms as mainstream GUI editors. If this is not possible, due to limitations of the terminal, it should provide a reasonable substitute.
  • All actions should be available through the menus, where the short-cut (if any) must be listed. This will allow users to 1) find the action and 2) learn the short-cut. The only exception to this rule are the cursor motion and shift-selection actions.
  • All configuration options should be available through the menus.
  • Tilde should integrate with the environment as much as possible. An example of this is the X11 integration, which allows copy/paste interaction with X11 programs if Tilde is run in an X11 environment.
  • Tilde is not meant to replace GUI editors, or be an IDE. It is meant to be an easy to use fallback for GUI editors, when none are available. This is not to say that it should not provide a good set of features, but it does mean that advanced features more commonly associated with IDEs are not in the development roadmap.

Code Style

This section lists the code style used in Tilde and it's libraries. It is at present incomplete. Please look at the existing code for more guidance.

Indentation

Indentation is done with tabs. When breaking lines, one extra tab must be used, unless the next line will be indented relative to the current line, in which case two extra tabs are required.

An extra level of indentation must be observed when opening a new block; for the conditional statements in an for/if/while/do, if they are not enclosed in a block; all statments following a case.

For aligning items on different lines, for example for multi-line comments, use as many tabs as the previous line, and subsequently align with spaces.

Line Length

The maximum line length is 140 characters. Longer lines should be broken at an appropriate point. Good points for breaking are && and ||, or after a comma.

Spacing Around Operators etc.

Each operator must be surrounded by a single space on each side, with the exception of the pre- and post-increment operators and pointer dereference and address-of operator. No spaces are allowed around parenthesis, with the exception that there must be a single space between the for/if/while/do and the condition, and between the condition and the opening brace (if present).

No space may be present between a comma or semi-colon and the preceding code. If there is more code after the comma or semi-colon, there must be exactly one space.

Code blocks

The opening brace for a new block is on the same line as the function header or conditional or loop statement. The only exception is when the line is broken, in which case the opening brace is on a line by itself, indented as far as the function header or conditional or loop statement.

Conditions

Checking pointers for NULL must be done by an explicit comparison with NULL. Similarly, comparing an integer or floating point value for zero must be done by an explicit comparison with 0.

Empty Statements

If an empty statement is desired for a for or while loop, use {} on the same line as the for or while.

Fallthrough in a Switch

A fallthrough in a switch statement must be marked with a /* FALLTHROUGH */ comment, except if there is no code following the case statement.

Variable Declarations

Pointers are declared by prepending the name of the variable with an asterisk, not by suffixing the type with an asterisk. The same holds for the ampersant for declaring references.