Skip to content

Commit 76ee007

Browse files
committed
feat: Update version to 9.6.0, enhance CHANGELOG and README, and improve default highlight grammar
1 parent 1b65399 commit 76ee007

6 files changed

Lines changed: 23 additions & 22 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,4 +372,7 @@ This release establishes **CodeForge** as a powerful, production-ready code edit
372372
## 9.5.0
373373
- FIX: [#57](https://github.com/heckmon/code_forge/issues/57)
374374
- FIX: [#58](https://github.com/heckmon/code_forge/issues/58)
375-
375+
376+
## 9.6.0
377+
- FIX: [#60](https://github.com/heckmon/code_forge/issues/60)
378+
- FEATURE: Empty `Mode` as default highlight grammar instead of dart grammar as requested in [#59](https://github.com/heckmon/code_forge/discussions/59)

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@
3838
> 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.
3939
4040

41-
### What's new in 9.5.0
42-
- FIX: [#57](https://github.com/heckmon/code_forge/issues/57)
43-
- FIX: [#58](https://github.com/heckmon/code_forge/issues/58)
41+
### What's new in 9.6.0
42+
- FIX: [#60](https://github.com/heckmon/code_forge/issues/60)
43+
- FEATURE: Empty `Mode` as default highlight grammar instead of dart grammar as requested in [#59](https://github.com/heckmon/code_forge/discussions/59)
4444

4545
## Why CodeForge?
4646
**Feature demos:** [CodeForge Features Showcase](https://heckmon.github.io/code_forge_demo/)
@@ -115,7 +115,7 @@ Add CodeForge to your `pubspec.yaml`:
115115

116116
```yaml
117117
dependencies:
118-
code_forge: ^9.5.0
118+
code_forge: ^9.6.0
119119
```
120120
121121
Then run:

lib/code_forge/code_area.dart

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import 'dart:io';
33
import 'dart:math';
44
import 'dart:ui' as ui;
55

6+
import 'package:re_highlight/styles/lightfair.dart';
7+
68
import '../LSP/lsp.dart';
79
import 'controller.dart';
810
import 'find_controller.dart';
@@ -12,8 +14,6 @@ import 'syntax_highlighter.dart';
1214
import 'undo_redo.dart';
1315

1416
import 'package:re_highlight/re_highlight.dart';
15-
import 'package:re_highlight/styles/vs2015.dart';
16-
import 'package:re_highlight/languages/dart.dart';
1717
import 'package:markdown_widget/markdown_widget.dart';
1818
import 'package:flutter/foundation.dart';
1919
import 'package:flutter/gestures.dart';
@@ -334,8 +334,8 @@ class _CodeForgeState extends State<CodeForge> with TickerProviderStateMixin {
334334
_hscrollController =
335335
widget.horizontalScrollController ?? ScrollController();
336336
_vscrollController = widget.verticalScrollController ?? ScrollController();
337-
_editorTheme = widget.editorTheme ?? vs2015Theme;
338-
_language = widget.language ?? langDart;
337+
_editorTheme = widget.editorTheme ?? lightfairTheme;
338+
_language = widget.language ?? Mode();
339339
_suggestionNotifier = _controller.suggestionsNotifier;
340340
_prevSnippetTextLength = _controller.text.length;
341341
_diagnosticsNotifier = _controller.diagnosticsNotifier;
@@ -5423,9 +5423,16 @@ class _CodeFieldRenderer extends RenderBox implements MouseTrackerAnnotation {
54235423

54245424
final hasActiveFolds = _hasActiveFolds;
54255425
final targetY = _getLineYOffset(line, hasActiveFolds);
5426+
final targetLineHeight = lineWrap
5427+
? _getWrappedLineHeight(line)
5428+
: _lineHeight;
5429+
final topPadding = innerPadding?.top ?? 0;
5430+
final bottomPadding = innerPadding?.bottom ?? 0;
54265431
final viewportHeight = vscrollController.position.viewportDimension;
5432+
final visibleHeight = max(0.0, viewportHeight - topPadding - bottomPadding);
5433+
final centerHeight = visibleHeight > 0 ? visibleHeight : viewportHeight;
54275434
final maxScroll = vscrollController.position.maxScrollExtent;
5428-
double scrollTarget = targetY - (viewportHeight / 2) + (_lineHeight / 2);
5435+
double scrollTarget = targetY + (targetLineHeight / 2) - (centerHeight / 2);
54295436

54305437
scrollTarget = scrollTarget.clamp(0.0, maxScroll);
54315438

lib/code_forge/controller.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -620,8 +620,6 @@ class CodeForgeController implements DeltaTextInputClient {
620620
_updateMultiCursorsFromList(updated);
621621
}
622622

623-
/// Replaces the secondary-cursor list with [positions], deduplicating
624-
/// against the primary cursor and against duplicate entries.
625623
void _updateMultiCursorsFromList(
626624
List<({int line, int character})> positions,
627625
) {

lib/code_forge/find_controller.dart

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ class FindController extends ChangeNotifier {
108108
if (_isActive == value) return;
109109
_isActive = value;
110110
if (_isActive) {
111-
// Small delay to ensure widget is built before focusing, prevents focus to replace input.
112111
Future.microtask(() => findInputFocusNode.requestFocus());
113112
if (_lastQuery.isNotEmpty) {
114113
_reperformSearch();
@@ -293,20 +292,14 @@ class FindController extends ChangeNotifier {
293292
final match = _matches[_currentMatchIndex];
294293
final matchLine = _codeController.getLineAtOffset(match.start);
295294
_codeController.setSelectionSilently(
296-
TextSelection(baseOffset: match.start, extentOffset: match.end),
295+
TextSelection.collapsed(offset: match.start),
297296
);
298-
_codeController.selectionOnly = true;
299-
_codeController.notifyListeners();
300297

301-
// Ensure find navigation keeps the active result centered in view.
302298
try {
303299
_codeController.scrollToLine(matchLine);
304300
} on StateError {
305-
// Ignore when editor is not attached yet.
301+
//
306302
}
307-
308-
// removes selection
309-
_codeController.setSelectionSilently(TextSelection.collapsed(offset: 0));
310303
}
311304
}
312305

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: code_forge
22
description: "A sophisticated code editor package with AI completion, LSP support, syntax highlighting, and advanced editing capabilities."
3-
version: 9.5.0
3+
version: 9.6.0
44
homepage: https://github.com/heckmon/code_forge
55

66
environment:

0 commit comments

Comments
 (0)