Folding support

Revision as of 08:11, 23 May 2006 by Sanakan (Talk | contribs) (overview, adt & testing added)


Overview

The aim of this project is to enhance Vision with a RichText control that supports folding. The goal is to make this surface in the editor windows of EiffelStudio.

Introduction

While using an editor like the one provided by EiffelStudio the actual area in a text, in thsi case source code, that is actually being edited is restricted to a small part of the entire document. Therefor being able to remove text sequences from the display without changing the actual text sequence could increase productivity. One such approach is to use folding, which is a line-based technique that "folds" a block of lines into a single line that is then displayed in addition to a special symbol that marks the line as actually being a "pile" of lines, and which also serves as the interface to unfold the passage back into it's original state (and subsequent fold/unfold operations).

The Goal

The goal of this project was to implement folding support for the EiffelStudio editor in order to be able to fold semantic blocks of code such as entire features or loop blocks. The source text should however not be modified by this procedure in the sense that folding or unfolding a text should not change the AST. In addition folding should also not have any affects on any print output. A search for specific parts of code should also be able to enter folded text areas. It is also critical that folded areas are always displayed to the user correctly. Nested folding (e.g. a loop body in a feature, nested loops etc...) should also be possible.

ADT

(note: to be revised)

Types

FOLDING_WIDGET, TEXT_BLOCK, INTEGER, BOOLEAN,

Features

new -> FOLDING_WIDGET definearea: FOLDING_WIDGET X HIGHLIGHTED_TEXT_BLOCK -> FOLDING_WIDGET from: FOLDING_WIDGET -> INTEGER to: FOLDING_WIDGET -> INTEGER folded: FOLDING_WIDGET -> BOOLEAN fold: FOLDING_WIDGET -> FOLDING_WIDGET unfold: FOLDING_WIDGET -> FOLDING_WIDGET content: FOLDING_WIDGET -> BLOCK numberoflines: FOLDING_WIDGET -> INTEGER


Prerequisites

none

Axioms

for all w,v :: FOLDING_WIDGET, tb :: TEXT_BLOCK


from(definearea(w,tb)) = firstline(tb) to(definearea(w,tb) = lastline(tb) content(new) = NULL content(definearea(w,tb)) = tb numberoflines(new) = 0 numberoflines(definearea(w,tb)) = to(definearea(w,tb)) - from(definearea(w,tb)) folded(new) = false folded(fold(w)) = true

Classes

(note: to be revised)

FOLDING_CONTROLLER FOLDING_WIDGET

Testing

The following testcases have been propsed: - write a small application (source code to be provided by author) that includes multiple features, loops and nested loops to check the correct creation and display of folded areas (ncl. nested folds).

- print the source code of the application mentioned above with and without folding support. The output should be identical.

- compile and run both the source code with and without folding support. The applications behaviour should be identical.

- search for specific words and text segments within folded areas of the source. The search should find such segments.


TO DO

  • be familiar with ES' way of implementing the AST


done

  • (half) ADT specified
  • some specifications

Links

What is a folding editor?

How to implement an AST?

What's the Visitor Design-Pattern?

Team

Everyone intrested in this project is welcome to join our mailinglist es-ui-fold@origo.ethz.ch