minor string tweaks

This commit is contained in:
Filip Krawczyk 2022-08-05 10:17:21 +02:00
parent 3c274adee7
commit 08831afbcf
1 changed files with 3 additions and 2 deletions

View File

@ -55,7 +55,7 @@ class MarkdownFormatter extends TextInputFormatter {
newValue.text.lineBefore(newValue.selection.baseOffset - 2); newValue.text.lineBefore(newValue.selection.baseOffset - 2);
TextEditingValue listContinuation(String listChar, TextEditingValue tev) { TextEditingValue listContinuation(String listChar, TextEditingValue tev) {
final regex = RegExp('(\\s*)${RegExp.escape(listChar)} '); final regex = RegExp(r'(\s*)' '${RegExp.escape(listChar)} ');
final match = regex.matchAsPrefix(lineBefore); final match = regex.matchAsPrefix(lineBefore);
if (match == null) { if (match == null) {
return tev; return tev;
@ -67,7 +67,8 @@ class MarkdownFormatter extends TextInputFormatter {
TextEditingValue numberedListContinuation( TextEditingValue numberedListContinuation(
String afterNumberChar, TextEditingValue tev) { String afterNumberChar, TextEditingValue tev) {
final regex = RegExp('(\\s*)(\\d+)${RegExp.escape(afterNumberChar)} '); final regex =
RegExp(r'(\s*)(\d+)' '${RegExp.escape(afterNumberChar)} ');
final match = regex.matchAsPrefix(lineBefore); final match = regex.matchAsPrefix(lineBefore);
if (match == null) { if (match == null) {
return tev; return tev;