commit afafc4969aea2b896c7e3bd54f6c08f42f072052
parent 1d4d50c339403022e8a1699eeb2d1fcd577dcd6b
Author: Shawn Axsom <shawn.axsom@rooksecurity.com>
Date: Sat, 25 Apr 2015 18:40:22 -0400
Fixed issue where note changes weren't saved when editing using Gedit
Diffstat:
2 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/simplenote_cli/sncli.py b/simplenote_cli/sncli.py
@@ -1082,8 +1082,8 @@ def cli_note_edit(self, key):
if not content:
return
- md5_old = md5.new(note['content']).digest()
- md5_new = md5.new(content).digest()
+ md5_old = md5.new(self.encode_utf_8(note['content'])).digest()
+ md5_new = md5.new(self.encode_utf_8(content)).digest()
if md5_old != md5_new:
self.log(u'Note updated')
diff --git a/simplenote_cli/temp.py b/simplenote_cli/temp.py
@@ -37,9 +37,8 @@ def tempfile_name(tf):
return ''
def tempfile_content(tf):
- tf.seek(0)
- lines = []
- for line in tf:
- lines.append(line)
- return lines
-
+ # This seems like a hack. When editing with Gedit, tf file contents weren't getting
+ # updated in memory, even though it successfully saved on disk.
+ updated_tf_contents = open(tf.name, 'r').read()
+ tf.write(updated_tf_contents)
+ return updated_tf_contents