Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/src/code/reg_exp.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
class RegExps {
static final wordSplit = RegExp('[^_a-zA-Z0-9]+');
static final wordSplit =
RegExp(r'[^_a-zA-Z0-9\u0600-\u06FF\u0750-\u077F\u08A0-\u08FF]+');
}
36 changes: 21 additions & 15 deletions lib/src/code_field/code_field.dart
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ class CodeField extends StatefulWidget {
final Color? background;
final EdgeInsets padding;
final Decoration? decoration;
final TextDirection? textDirection;
final TextSelectionThemeData? textSelectionTheme;
final FocusNode? focusNode;

Expand All @@ -196,6 +197,7 @@ class CodeField extends StatefulWidget {
this.smartQuotesType = SmartQuotesType.disabled,
this.padding = EdgeInsets.zero,
GutterStyle? gutterStyle,
this.textDirection,
this.enabled,
this.readOnly = false,
this.cursorColor,
Expand Down Expand Up @@ -234,7 +236,7 @@ class _CodeFieldState extends State<CodeField> {

FocusNode? _focusNode;
String? lines;
String longestLine = '';
var longestLine = '';
Size? windowSize;
late TextStyle textStyle;
Color? _backgroundCol;
Expand Down Expand Up @@ -434,6 +436,7 @@ class _CodeFieldState extends State<CodeField> {
maxLines: widget.maxLines,
expands: widget.expands,
scrollController: _codeScroll,
textDirection: widget.textDirection ?? Directionality.of(context),
decoration: const InputDecoration(
isCollapsed: true,
contentPadding: EdgeInsets.symmetric(vertical: 16),
Expand Down Expand Up @@ -464,17 +467,20 @@ class _CodeFieldState extends State<CodeField> {
return FocusableActionDetector(
actions: widget.controller.actions,
shortcuts: _shortcuts,
child: Container(
decoration: widget.decoration,
color: _backgroundCol,
key: _codeFieldKey,
padding: const EdgeInsets.only(left: 8),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (widget.gutterStyle.showGutter) _buildGutter(),
Expanded(key: _editorKey, child: editingField),
],
child: Directionality(
textDirection: widget.textDirection ?? Directionality.of(context),
child: Container(
padding: const EdgeInsetsDirectional.only(start: 8),
decoration: widget.decoration,
color: _backgroundCol,
key: _codeFieldKey,
child: Row(
Comment thread
iskepr marked this conversation as resolved.
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (widget.gutterStyle.showGutter) _buildGutter(),
Expanded(key: _editorKey, child: editingField),
],
),
),
),
);
Expand Down Expand Up @@ -540,11 +546,11 @@ class _CodeFieldState extends State<CodeField> {
}

double _getCaretHeight(TextPainter textPainter) {
final double? caretFullHeight = textPainter.getFullHeightForCaret(
final double caretFullHeight = textPainter.getFullHeightForCaret(
widget.controller.selection.base,
Rect.zero,
);
return caretFullHeight ?? 0;
return caretFullHeight;
}

double _getPopupLeftOffset(TextPainter textPainter) {
Expand Down Expand Up @@ -603,7 +609,7 @@ class _CodeFieldState extends State<CodeField> {

OverlayEntry _buildSearchOverlay() {
final colorScheme = Theme.of(context).colorScheme;
final borderColor = _getTextColorFromTheme() ?? colorScheme.onBackground;
final borderColor = _getTextColorFromTheme() ?? colorScheme.onSurface;
return OverlayEntry(
builder: (context) {
return Positioned(
Expand Down