[kupfer] notes: Insert newlines after a new note's title



commit 2a2a8cc0f9799ffa46cb55c1bfadd0319ddbbf10
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date:   Thu Apr 7 19:34:51 2011 +0200

    notes: Insert newlines after a new note's title
    
    When creating a note from a single line (so title only), append two
    newlines to put the cursor at the natural start of the body to be
    written.
    
    Launchpad-bug: https://bugs.launchpad.net/kupfer/+bug/748991

 kupfer/plugin/notes.py |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/kupfer/plugin/notes.py b/kupfer/plugin/notes.py
index 2ac0278..71e000e 100644
--- a/kupfer/plugin/notes.py
+++ b/kupfer/plugin/notes.py
@@ -117,10 +117,13 @@ class AppendToNote (Action):
 		return "list-add"
 
 def _prepare_note_text(text):
+	## split the text into a title + newline + rest of the text
+	## if we only get the title, put in two helpful newlines
 	title, body = textutils.extract_title_body(text)
 	if body.lstrip():
 		return u"%s\n%s" % (title, body)
-	return title
+	else:
+		return u"%s\n\n" % (title,)
 
 class CreateNote (Action):
 	def __init__(self):



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]