Skip to content

Latest commit

 

History

History
42 lines (36 loc) · 1.89 KB

wstext.org

File metadata and controls

42 lines (36 loc) · 1.89 KB

wstext module

Description

Text editing functions on a string variable. This way the text does not have to be corrected if something is deleted what should not have been deleted and every cursor movement does not have to ask for permission before moving.

Another advantage is that wsline, wsedit, main will not have to defin their own methods and wsline scroll would be easier to implement, as well as fullscreen scroll. An important advantage is that it won’t be difficult to add right border line markers in wsedit modes.

Using wstext module it would not be difficult anymore to show new lines in wsline as something different and still be able to copy the text with correct newlines. Displaying <B> and <K> and be sure that cursor movement, insertions and deletions will act the way they are supposed to, will also be much easier.

Functions in the module

Functions:

  • next / previous word (position text: position)
  • next / previous sentence (position text: position)
  • next / previous paragraph (position text: postion)
  • delete character left / right (position textvar: position)
  • delete word left / right / whole (position textvar: position)
  • delete line left / right / whole (position textvar: position)
  • delete sentence left / right / whole (position textvar: position)
  • delete paragraph left / right / whole (position textvar: position)
  • get position of a line (line: position)
  • get length of a line (line: length)
  • get line of a position (position: line)
  • insert (position string textvar: position)

Delete and insert functions modify the original text.

More Information

The keybindings will work on the text in the variable whose name is in $wstext_textvar. It can change, for example, when switching from main mode to wsline mode. Modes can redefine or hide some keybindings or functions. After text modification a function, whose name is in $wstext_updfnvar will be called.