ta0kira / wrapping-editor Goto Github PK
View Code? Open in Web Editor NEWGeneric Haskell text-editor logic and Brick widget for use with fixed-width fonts.
License: Apache License 2.0
Generic Haskell text-editor logic and Brick widget for use with fixed-width fonts.
License: Apache License 2.0
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.
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:
FixedFontViewer
for actions to change the view, e.g., move up or down by n
lines.getCursor
return probably needs to be made Maybe (Int,Int)
to disable its display.Document
:
Maybe (Preview c b)
field, where data Preview
is just a line zipper containing the whole doc.Nothing
.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:
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.
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.
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:
WordSplitter
to allow a non-hyphen split. For example, return Maybe [Segment]
from splitWord
, with something like data Segment = WordSplit Int | WordEnd Int
.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.They should use WEditor
from the cloned repo instead, in case there is a breaking change to WEditor
. Otherwise, such changes would need to be pushed to Hackage before committing corresponding changes to WEditorHyphen
and WEditorBrick
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.