Skip to content

Commit

Permalink
Fix label problems
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeDoctorDE committed Jan 2, 2024
1 parent 38e06f8 commit abd4dba
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 13 deletions.
12 changes: 6 additions & 6 deletions app/android/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ GEM
artifactory (3.0.15)
atomos (0.1.3)
aws-eventstream (1.3.0)
aws-partitions (1.870.0)
aws-sdk-core (3.190.0)
aws-partitions (1.876.0)
aws-sdk-core (3.190.1)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.651.0)
aws-sigv4 (~> 1.8)
jmespath (~> 1, >= 1.6.1)
aws-sdk-kms (1.75.0)
aws-sdk-core (~> 3, >= 3.188.0)
aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.141.0)
aws-sdk-s3 (1.142.0)
aws-sdk-core (~> 3, >= 3.189.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.8)
Expand Down Expand Up @@ -64,7 +64,7 @@ GEM
faraday-retry (1.0.3)
faraday_middleware (1.2.0)
faraday (~> 1.0)
fastimage (2.2.7)
fastimage (2.3.0)
fastlane (2.217.0)
CFPropertyList (>= 2.3, < 4.0.0)
addressable (>= 2.8, < 3.0.0)
Expand Down Expand Up @@ -159,7 +159,7 @@ GEM
naturally (2.2.1)
optparse (0.1.1)
os (1.1.4)
plist (3.7.0)
plist (3.7.1)
public_suffix (5.0.4)
rake (13.1.0)
representable (3.2.0)
Expand Down Expand Up @@ -217,4 +217,4 @@ DEPENDENCIES
screengrab

BUNDLED WITH
2.4.12
2.5.3
21 changes: 14 additions & 7 deletions app/lib/handlers/label.dart
Original file line number Diff line number Diff line change
Expand Up @@ -427,10 +427,13 @@ class LabelHandler extends Handler<LabelTool>
final start =
replace ? lastValue.composing.start : lastValue.selection.start;
final length = replace ? null : lastValue.selection.end - start;
final newIndex =
lastValue.selection.end - lastValue.text.length + value.length;
final currentText = value.substring(
start, value.length - lastValue.text.length + lastValue.composing.end);
final newIndex = replace
? lastValue.selection.end - lastValue.text.length + value.length
: start + value.length;
final currentText = replace
? value.substring(start,
value.length - lastValue.text.length + lastValue.composing.end)
: value;
_context = _context?.map(text: (e) {
final old = e.element;
if (old != null) {
Expand All @@ -444,7 +447,8 @@ class LabelHandler extends Handler<LabelTool>
),
start,
length)
: old.area.paragraph.replaceText(currentText, start, length, true);
: old.area.paragraph
.replaceText(currentText, start, length, replace);
final area = old.area.copyWith(
paragraph: paragraph,
);
Expand All @@ -466,8 +470,10 @@ class LabelHandler extends Handler<LabelTool>
);
}, markdown: (e) {
var text = e.text ?? '';
text = text.replaceRange(
start, lastValue.selection.end.clamp(0, text.length), value);
text = replace
? value
: text.replaceRange(
start, lastValue.selection.end.clamp(0, text.length), value);
return e.copyWith(
element: e.element?.copyWith(
text: text,
Expand All @@ -477,6 +483,7 @@ class LabelHandler extends Handler<LabelTool>
});
_bloc?.refresh();
if (_bloc != null) _refreshToolbar(_bloc!);
if (!replace) _updateEditingState();
}

@override
Expand Down
2 changes: 2 additions & 0 deletions fastlane/metadata/android/en-US/changelogs/87.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* Fix markdown label editing
* Fix not working new line

0 comments on commit abd4dba

Please sign in to comment.