Skip to content

Commit eaa6676

Browse files
committed
chore: update version to 10.3.0; modify CHANGELOG and README for new fixes
1 parent 523f320 commit eaa6676

7 files changed

Lines changed: 204 additions & 209 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,4 +419,8 @@ This release establishes **CodeForge** as a powerful, production-ready code edit
419419
- FEATURE: Added chinese and spanish translation on README
420420

421421
## 10.2.0
422-
- FIX: [#45](https://github.com/heckmon/code_forge/issues/45)
422+
- FIX: [#45](https://github.com/heckmon/code_forge/issues/45)
423+
424+
## 10.3.0
425+
- FIX: [#45](https://github.com/heckmon/code_forge/issues/45)
426+
- FIX: Code action bulb icon placement issue.

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,9 @@
4848
>
4949
> code_forge does **not** support Flutter web, as it relies on `dart:io` for core functionality. Use [code_forge_web](https://pub.dev/packages/code_forge_web) for web support.
5050
51-
## What's new in 10.2.0:
51+
## What's new in 10.3.0:
5252
- FIX: [#45](https://github.com/heckmon/code_forge/issues/45)
53+
- FIX: Code action bulb icon placement issue.
5354

5455

5556
> [!NOTE]
@@ -132,7 +133,7 @@ To see working examples of all CodeForge features including AI Code Completion,
132133

133134
```yaml
134135
dependencies:
135-
code_forge: ^10.2.0
136+
code_forge: ^10.3.0
136137
```
137138
3 . Add `await RustLib.init();` in your main function:
138139
```dart

lib/code_forge/code_area.dart

Lines changed: 55 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1689,7 +1689,8 @@ class _CodeForgeState extends State<CodeForge> with TickerProviderStateMixin {
16891689
// Enter, etc. here would edit the document a second time
16901690
// and desync from the IME (e.g. a backspaced letter
16911691
// reappearing).
1692-
if (_controller.isComposingActive) {
1692+
if (_controller
1693+
.isComposingActive) {
16931694
return KeyEventResult.ignored;
16941695
}
16951696
final isCtrlAltPressed =
@@ -4191,6 +4192,7 @@ class _CodeFieldRenderer extends RenderBox implements MouseTrackerAnnotation {
41914192
bool _selectionActive = false, _isDragging = false;
41924193
bool _draggingStartHandle = false, _draggingEndHandle = false;
41934194
bool _showBubble = false, _draggingCHandle = false, _readOnly;
4195+
bool _openedLspActionFromBulbTap = false;
41944196
bool _isDeferringLayout = false, _hasCachedHeight = false;
41954197
bool _isCachedHeightExact = false;
41964198
bool _caretSyncAfterLayoutScheduled = false;
@@ -8043,7 +8045,7 @@ class _CodeFieldRenderer extends RenderBox implements MouseTrackerAnnotation {
80438045
),
80448046
);
80458047

8046-
if (lspActionNotifier.value != null && lspConfig != null) {
8048+
if (lspConfig != null && lspActionNotifier.value != null) {
80478049
final actions = lspActionNotifier.value!.cast<Map<String, dynamic>>();
80488050
if (actions.any((item) {
80498051
try {
@@ -8062,6 +8064,8 @@ class _CodeFieldRenderer extends RenderBox implements MouseTrackerAnnotation {
80628064
return false;
80638065
}
80648066
})) {
8067+
final lineText = controller.getLineText(i);
8068+
final hasLeadingIndent = _measureLeadingIndentColumns(lineText) > 0;
80658069
final icon = Icons.lightbulb_outline;
80668070
final actionBulbPainter = TextPainter(
80678071
text: TextSpan(
@@ -8077,17 +8081,35 @@ class _CodeFieldRenderer extends RenderBox implements MouseTrackerAnnotation {
80778081
);
80788082
actionBulbPainter.layout();
80798083

8080-
final bulbX = isRTL
8081-
? (isMobile
8082-
? offset.dx + size.width - actionBulbPainter.width - 4
8083-
: offset.dx + size.width - _gutterWidth + 4)
8084-
: (isMobile
8085-
? offset.dx +
8086-
_gutterWidth -
8087-
actionBulbPainter.width -
8088-
(baseLineNumberStyle.fontSize ?? 14) +
8089-
4
8090-
: offset.dx + 4);
8084+
final contentStartX = isRTL
8085+
? offset.dx +
8086+
size.width -
8087+
_gutterWidth -
8088+
(innerPadding?.right ?? 0) -
8089+
_effectiveHScroll
8090+
: offset.dx +
8091+
_gutterWidth +
8092+
(innerPadding?.left ?? 0) -
8093+
(lineWrap ? 0 : _effectiveHScroll);
8094+
8095+
final bulbX = hasLeadingIndent
8096+
? (isRTL
8097+
? contentStartX - actionBulbPainter.width - 4
8098+
: contentStartX + 4)
8099+
: (isRTL
8100+
? (isMobile
8101+
? offset.dx +
8102+
size.width -
8103+
actionBulbPainter.width -
8104+
4
8105+
: offset.dx + size.width - _gutterWidth + 4)
8106+
: (isMobile
8107+
? offset.dx +
8108+
_gutterWidth -
8109+
actionBulbPainter.width -
8110+
(baseLineNumberStyle.fontSize ?? 14) +
8111+
4
8112+
: offset.dx + 4));
80918113
final bulbY =
80928114
offset.dy +
80938115
(innerPadding?.top ?? 0) +
@@ -10910,6 +10932,7 @@ class _CodeFieldRenderer extends RenderBox implements MouseTrackerAnnotation {
1091010932
}
1091110933

1091210934
if (event is PointerDownEvent && event.buttons == kPrimaryButton) {
10935+
_openedLspActionFromBulbTap = false;
1091310936
_onetap.addPointer(event);
1091410937
try {
1091510938
suggestionNotifier.value = null;
@@ -10924,6 +10947,7 @@ class _CodeFieldRenderer extends RenderBox implements MouseTrackerAnnotation {
1092410947
if (lspActionNotifier.value != null && _actionBulbRects.isNotEmpty) {
1092510948
for (final entry in _actionBulbRects.entries) {
1092610949
if (entry.value.contains(localPosition)) {
10950+
_openedLspActionFromBulbTap = true;
1092710951
suggestionNotifier.value = null;
1092810952
lspActionOffsetNotifier.value = event.localPosition;
1092910953
return;
@@ -10968,6 +10992,11 @@ class _CodeFieldRenderer extends RenderBox implements MouseTrackerAnnotation {
1096810992
};
1096910993

1097010994
_onetap.onTap = () {
10995+
if (_openedLspActionFromBulbTap) {
10996+
_openedLspActionFromBulbTap = false;
10997+
return;
10998+
}
10999+
1097111000
if (hoverNotifier.value != null && !isHoveringPopup.value) {
1097211001
hoverNotifier.value = null;
1097311002
hoverContentNotifier.value = null;
@@ -11040,6 +11069,11 @@ class _CodeFieldRenderer extends RenderBox implements MouseTrackerAnnotation {
1104011069
_dragStartOffset = textOffset;
1104111070
final isAltClick = HardwareKeyboard.instance.isAltPressed;
1104211071
_onetap.onTap = () {
11072+
if (_openedLspActionFromBulbTap) {
11073+
_openedLspActionFromBulbTap = false;
11074+
return;
11075+
}
11076+
1104311077
if (suggestionNotifier.value != null) {
1104411078
suggestionNotifier.value = null;
1104511079
}
@@ -11228,6 +11262,14 @@ class _CodeFieldRenderer extends RenderBox implements MouseTrackerAnnotation {
1122811262

1122911263
@override
1123011264
MouseCursor get cursor {
11265+
if (_actionBulbRects.isNotEmpty) {
11266+
for (final rect in _actionBulbRects.values) {
11267+
if (rect.contains(_currentPosition)) {
11268+
return SystemMouseCursors.click;
11269+
}
11270+
}
11271+
}
11272+
1123111273
final isInGutter = isRTL
1123211274
? _currentPosition.dx > size.width - _gutterWidth
1123311275
: _currentPosition.dx >= 0 && _currentPosition.dx < _gutterWidth;
@@ -11258,14 +11300,6 @@ class _CodeFieldRenderer extends RenderBox implements MouseTrackerAnnotation {
1125811300
return SystemMouseCursors.click;
1125911301
}
1126011302

11261-
if (_actionBulbRects.isNotEmpty) {
11262-
for (final rect in _actionBulbRects.values) {
11263-
if (rect.contains(_currentPosition)) {
11264-
return SystemMouseCursors.click;
11265-
}
11266-
}
11267-
}
11268-
1126911303
return MouseCursor.defer;
1127011304
}
1127111305

0 commit comments

Comments
 (0)