From 8c5720c34b26e354c4fa610f0077890e474857bd Mon Sep 17 00:00:00 2001
From: Vishesh Handa <me@vhanda.in>
Date: Mon, 27 Jan 2020 23:11:42 +0100
Subject: [PATCH] Note Rename: Do not let it be renamed to a non markdown file

Otherwise it disappears from the listing as we only show files which end
with a '.md'.
---
 lib/state_container.dart | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/state_container.dart b/lib/state_container.dart
index 8c86c3d9..cf185366 100644
--- a/lib/state_container.dart
+++ b/lib/state_container.dart
@@ -151,6 +151,11 @@ class StateContainerState extends State<StateContainer> {
   }
 
   void renameNote(Note note, String newFileName) async {
+    // Do not let the user rename it to a non-markdown file
+    if (!newFileName.toLowerCase().endsWith('.md')) {
+      newFileName += '.md';
+    }
+
     var oldNotePath = note.filePath;
     note.rename(newFileName);