Giter VIP home page Giter VIP logo

wrapping-editor's People

Contributors

ta0kira avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

wrapping-editor's Issues

Add getting/setting absolute edit position within the document.

For example, allow referring to the current cursor position in terms of absolute paragraph and absolute character within that paragraph. This would be somewhat separate from the cursor display position, since the latter has no effect on data integrity.

Support scrolling viewport vertically without affecting cursor location.

It's often useful to scroll to another part of the document to check on something without losing the cursor position. Right now this isn't possible with FixedWidthEditor and FixedWidthViewer.

I think the implementation would be something like this:

  • Add a new function to FixedFontViewer for actions to change the view, e.g., move up or down by n lines.
  • The getCursor return probably needs to be made Maybe (Int,Int) to disable its display.
  • In the implementation of Document:
    • Add a Maybe (Preview c b) field, where data Preview is just a line zipper containing the whole doc.
    • If the preview exists, use that for visible lines, and don't show the cursor.
    • If edits happen or if the cursor is moved (to include width resizing), set the preview to Nothing.

Cursor ends up past right edge when at the end of a full-length line.

Horizontal cursor movement assumes an "insert" cursor, i.e., there are n+1 cursor positions on a line of length n. This is primarily to allow you to insert/delete at the end of the line without having to move to the following line first.

This is a problem when the cursor cannot be rendered past the last horizontal character, however.

Possible solutions:

  1. Add a "cursor mode" to FixedFontEditor to choose between n and n+1 cursor positions. If the mode is selectable, don't forget to update reparseParaTail, since it restores the cursor position using sequential MoveNext, and thus adds one operation per line change. Another edge-case is for lines that are empty. So, there needs to be max 1 n cursor positions.

  2. Recommend that applications that cannot support n+1 cursor positions set the viewport size to one less than the available width. Or, since the wrapping policy is actually the one setting line length, maybe just implement a version that subtracts one from the requested width. This could even be a generic adapter that can be applied to any policy.

`langHyphen` adds an extra hyphen to certain already-hyphenated words.

Specifically, this occurs when the Hyphenator splits the word at exactly the hyphen. This seems non-trivial to fix because BreakWords doesn't allow the WordSplitter to specify the line-break type.

It seems like the options are:

  • Update WordSplitter to allow a non-hyphen split. For example, return Maybe [Segment] from splitWord, with something like data Segment = WordSplit Int | WordEnd Int.
  • Remove DashPunctuation from LangHyphen.wordChars so that splits happen automatically. The disadvantage here is that it will cause hyphens to be at the front of the next line in certain situations.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.