previous Chapter II.3

Cursor movement and controlling the environment

Under construction

next


Introduction

An interesting question is how to make the structure of a document transparent inside a wysiwyg editor and how to give the user full control over this structure. This question is mainly a psychological one: the user has to feel the structure in a way which is closest to his mental representation and he has to have the impression that he has optimal control over his document.

From our point of view, showing an ASCII text which represents the document in coded form is not necessarily optimal for both of these purposes. Indeed, an expression like

    \frac{1}{\alpha_1+\frac{1}{\alpha_2+\frac{1}{alpha_3+\ddots}}}
  
is not clearer from a structural point of view than its graphical representation after running TeX. Similarly, the user does not necessarily have optimal control: what about inserting a new column in a complex TeX table?

Of course, there are also examples where the structure of the document is a priori more transparent and controllable in its coded form. A good example is the piece of code

    Some \textbf{\blue{bold blue}} text.
  
In a wysiwyg editor, it is not clear whether the text ``bold blue'' is bold and blue or blue and bold. Furthermore, how to put the cursor in a position where it is possible to type bold but not blue text?

In the TeXmacs implementation, we were guided by the opinion that the global structure of a document is clear from its graphical appearance, and that the only place where we need more information about the structure is at the current cursor position. Consequently, the footer of the editor both displays the physical and logical properties of the text at the current position. To a lesser extent, the shape and color of the cursor itself indicate some structural properties.

Cursor positioning

TeXmacs implements a graphically natural (and not structurally natural, like many other wysiwyg technical editors) cursor movement. In other words, if you press on the right arrow key, then your cursor may be expected to go to the right. More precisely, when moving the cursor around, the user modifies the position of a so called ghost cursor which may be any position on the screen. The real cursor is chosen as close as possible to the ghost cursor, in a way that ``makes sense''.

The cursor position is determined by an x and a y coordinate as well as an infinitesimal horizontal ``delta-coordinate'', which allows the user to position the cursor in a very precise way in presence of structural markup. The figure below illustrates the use of this coordinate in the above example of bold blue text. We start with the cursor being positioned after the `e' in `Some' and show what happens if one pushes thrice the right cursor key.

Double environment changes (step 1) Double environment changes (step 2)
Double environment changes (step 3) Double environment changes (step 4)

Similarly, the following figure illustrates what happens when the cursor is initially positioned after the `u' in `blue:

Double environment changes (step 1) Double environment changes (step 2)
Double environment changes (step 3) Double environment changes (step 4)


previous next


Copyright (C) 1999, 2000 by Joris van der Hoeven.

This webpage is part of GNU TeXmacs and the larger GNU project. Verbatim copying and distribution of it is permitted in any medium, provided this notice is preserved. For more information or questions, please contact Joris van der Hoeven.

Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA