OutdentModifier class
Removes one indent level when Backspace is pressed inside a line's leading whitespace — the "outdent on Backspace" that issue #21 asks for.
The trigger is a deletion rather than a typed character, so this registers as a deletion modifier: see CodeModifier.deletesChar. It keys on the space the backspace removes, which is what a caret inside the leading whitespace always sits behind. Without that registration no modifier could ever fire on a backspace, which is the gap issue #21 reports.
Outside the leading whitespace it returns null and the ordinary one-character delete stands, because a backspace that removes real code should remove one character rather than reindent the line.
Its semantics are deliberately narrower than
CodeController.outdentSelection's, the Shift+Tab command: that command
also strips tabs and trims whatever indent is left when it is not a
multiple of tabSpaces (trimLeft), while this modifier declines over a
tab and empties a partial indent exactly (clamp) — the Backspace gesture
stays conservative where the command is free to reindent.
- Inheritance
-
- Object
- CodeModifier
- OutdentModifier
Constructors
- OutdentModifier()
-
const
Properties
- char → String
-
The character whose insertion this modifier reacts to.
finalinherited
- deletesChar → String?
-
The character whose deletion this modifier reacts to, or null when this is
an insertion-only modifier.
finalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
replace(
String text, int start, int end, String str) → TextEditingValue -
Helper to insert
strintextbetweenstartandendinherited -
toString(
) → String -
A string representation of this object.
inherited
-
updateString(
String text, TextSelection sel, EditorParams params) → TextEditingValue? -
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited