public interface LineWrapPositionStrategy
One possible use case for such functionality is a situation when user opens document with lines that are wider that editor's visible area. We can represent such long strings in multiple visual line then and need to know the best place to insert such virtual wrap.
Modifier and Type | Method and Description |
---|---|
int |
calculateWrapPosition(Document document,
Project project,
int startOffset,
int endOffset,
int maxPreferredOffset,
boolean allowToBeyondMaxPreferredOffset,
boolean isSoftWrap)
Allows to calculate the most appropriate position to wrap target line.
|
int calculateWrapPosition(Document document, Project project, int startOffset, int endOffset, int maxPreferredOffset, boolean allowToBeyondMaxPreferredOffset, boolean isSoftWrap)
document
- target document which text is being processedproject
- target projectstartOffset
- start offset to use with the given text holder (exclusive)endOffset
- end offset to use with the given text holder (exclusive)maxPreferredOffset
- this method is expected to do its best to return offset that belongs to
(startOffset; maxPreferredOffset]
interval. However, it's allowed
to return value from (maxPreferredOffset; endOffset)
interval
unless 'allowToBeyondMaxPreferredOffset'
if 'false'
allowToBeyondMaxPreferredOffset
- indicates if it's allowed to return value from
(maxPreferredOffset; endOffset]
interval in case of inability to
find appropriate offset from (startOffset; maxPreferredOffset]
intervalisSoftWrap
- identifies if current request is for isSoftWrap wrap position(startOffset; endOffset)
interval where
target line should be wrapped OR -1
if no wrapping should be performed