Package limn.components.text
Record Class TextEditModel.LineDamage
java.lang.Object
java.lang.Record
limn.components.text.TextEditModel.LineDamage
- Enclosing class:
TextEditModel
public static record TextEditModel.LineDamage(int firstLine, int oldLastLine, int newLastLine)
extends Record
The lines edits have replaced: lines
[firstLine, oldLastLine] of the text as it
stood at the last TextEditModel.clearLineDamage() became lines [firstLine, newLastLine]
of the text as it stands now. Lines before firstLine are untouched; lines after
oldLastLine are untouched too, shifted down to follow newLastLine.
Exists for a view deriving per-line state from this buffer — a soft-wrap
row map is the one that forced it. TextEditModel.textVersion() says that the text moved;
for a per-line derivation that answer alone means re-deriving every line, and re-deriving a
line means re-shaping it, so a keystroke in a long document would re-shape the document
(the cliff ADR 031 §8.2 measured at 22 ms per character typed). This says
which lines, which turns the keystroke back into work proportional to the edit.
-
Constructor Summary
ConstructorsConstructorDescriptionLineDamage(int firstLine, int oldLastLine, int newLastLine) Creates an instance of aLineDamagerecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.intReturns the value of thefirstLinerecord component.final inthashCode()Returns a hash code value for this object.intReturns the value of thenewLastLinerecord component.intReturns the value of theoldLastLinerecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
LineDamage
public LineDamage(int firstLine, int oldLastLine, int newLastLine) Creates an instance of aLineDamagerecord class.- Parameters:
firstLine- the value for thefirstLinerecord componentoldLastLine- the value for theoldLastLinerecord componentnewLastLine- the value for thenewLastLinerecord component
-
-
Method Details
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='. -
firstLine
public int firstLine()Returns the value of thefirstLinerecord component.- Returns:
- the value of the
firstLinerecord component
-
oldLastLine
public int oldLastLine()Returns the value of theoldLastLinerecord component.- Returns:
- the value of the
oldLastLinerecord component
-
newLastLine
public int newLastLine()Returns the value of thenewLastLinerecord component.- Returns:
- the value of the
newLastLinerecord component
-