Consume until end of document if there is no newline when removing from (dart-lang/yaml_edit#76)

block map.

Fixes dart-lang/yaml_edit#55.
diff --git a/pkgs/yaml_edit/lib/src/map_mutations.dart b/pkgs/yaml_edit/lib/src/map_mutations.dart
index 07a2c54..32f47b3 100644
--- a/pkgs/yaml_edit/lib/src/map_mutations.dart
+++ b/pkgs/yaml_edit/lib/src/map_mutations.dart
@@ -188,6 +188,9 @@
       // because there is no value (e.g. `key: \n`). Because [valueNode.span] in
       // such cases point to the colon `:`.
       end = nextNewLine;
+    } else {
+      // Remove everything until the end of the document, if there is no newline
+      end = yaml.length;
     }
     return SourceEdit(start, end - start, '{}');
   }
@@ -201,6 +204,9 @@
   final nextNewLine = yaml.indexOf(lineEnding, end);
   if (nextNewLine != -1) {
     end = nextNewLine + lineEnding.length;
+  } else {
+    // Remove everything until the end of the document, if there is no newline
+    end = yaml.length;
   }
 
   final nextNode = getNextKeyNode(map, keyNode);
diff --git a/pkgs/yaml_edit/test/remove_test.dart b/pkgs/yaml_edit/test/remove_test.dart
index cdb195c..4742b56 100644
--- a/pkgs/yaml_edit/test/remove_test.dart
+++ b/pkgs/yaml_edit/test/remove_test.dart
@@ -217,6 +217,30 @@
 c: 3
 '''));
     });
+
+    test('issue #55 reopend', () {
+      final doc = YamlEditor('''name: sample
+version: 0.1.0
+environment:
+  sdk: ^3.0.0
+dependencies:
+  retry: ^3.1.2
+dev_dependencies:
+  retry:''');
+      doc.remove(['dev_dependencies']);
+    });
+
+    test('issue #55 reopend, variant 2', () {
+      final doc = YamlEditor('''name: sample
+version: 0.1.0
+environment:
+  sdk: ^3.0.0
+dependencies:
+  retry: ^3.1.2
+dev_dependencies:
+  retry:''');
+      doc.remove(['dev_dependencies', 'retry']);
+    });
   });
 
   group('flow map', () {