Last modified 13 years ago Last modified on 05/07/09 17:10:39

Error: Macro BackLinksMenu(None) failed
compressed data is corrupt

Error: Macro TicketQuery(summary=TEXT_INPLACE_EDITOR_R0, format=table, col=summary|owner|status|type|component|priority|effort|importance, rows=description|analysis_owners|analysis_reviewers|analysis_score|design_owners|design_reviewers|design_score|implementation_owners|implementation_reviewers|implementation_score|test_owners|test_reviewers|test_score|) failed
current transaction is aborted, commands ignored until end of transaction block


This task should describe the requirements for editing the text the place where it is. The user should be able to do all possible text manipulation like:

  • typing text
  • deletging text
  • selectging text
  • oprerations over selected text
  • navigating through the text :
    • by word
    • by line
    • by paragraph
    • by what you can imagine
    • to the end of the text
    • to the beggining of the text
    • etc...


In this first revision only simple text navigation and editing will be implemented :

  • input characters
  • delete characters
  • navigation by characters
  • navigation by words
  • move to the beginnig of the text
  • move to the end of the text

Task requirements

Make a desing and implementation for the following functionality :

  • user can insert a character
  • user can delete a character
  • user can navigate through characters by pressing left/right arrow keys
  • user can navigate through words by pressing ctrl + left/right arrow keys
  • user can jump to the begginig of the text by pressing ctrl + home
  • user can jump to the end of the text by pressing ctrl + end

Task result

The result should be code

Implementation idea

Define an interaction map and interaction logic using LogicR3 framework


How to demo

  • Start Sophie 2/0
  • Type some text
  • Delete some of the typed text
  • Demonstrate the navigation


New module will be created - org.sophie2.main.func.text, where the functionality about HotText will reside.

In order to present text interaction an interaction map will be defined. Because it is part of the skin, it will be defined in defineSkin method HotTextContentView class. the interaction map will containt entries about :

  • user inputs a character
  • user presses backspace key
  • user presses left/right arrow - to move character left/right
  • user presses ctrl + left/right arrow - to jump previous/next word
  • user pressed ctr + home - to jump to the beginning of the text
  • user pressed ctrl + end - to jump to the end of the text

A class that supports text interaction functionality will be added. In our case an enumeration that implements org.sophie2.core.mvc.OperationDef. In in there will be three constants (instances) :

  • INPUT_CHAR - when the user presses a key it will be added to the text
  • DELETE_CHAR - then the user presses backspace the character will be removed from the text
  • USER_GO_OPERATION - when the user presses some of the keyboard commands for navigation this constant (instance) will be invoked. GO operations are indefinite (you can make different operations - go left, go right, go to next paragraph, go to next error, go to next warning, etc) so there will be only one GO operation defined but with different parameters. Currently the parameters will be - LEFT, RIGHT, PREV_WORD, NEXT_WORD, DOC_HOME, DOC_END. Also to jump to different places in the text we need a flexible way to describe positions. So a new interface will be added - Break, with two methods. One for the positions before the current break position (the defined that the implementors will define) and one for the position before it. For now this interface will be implemented by classes that define what is a word break - we need to jump only through word for now



Implementation is done according to the design, however logic implementations are in two enums - HotTextLogic (for typing text) and HotTextPlaceLogic (for events with Place argument)

Changesets :

Merged to trunk in changeset [2427].

Known bugs:

  • The caret is not drawn when it is in the end of the text - this is related to the layout and that the caret is drawn by the Atom itself
  • When end/home/arrow keys are pressed events reach the work area - may be events should be consumed in the logic implementation
  • Sometimes when jumping throught the words, when reaching the last one, and pressing Ctrl + Right Arrow, the caret is positioned in the previous word
  • When typing if you press Enter key many times Sophie 2.0 crashes - this is related to the layout. The exception is IndexOutOfBounds


(Place the testing results here.)


(Write comments for this or later revisions here.)