Skip to content

Commit

Permalink
can now save current todo.txt file with the 'w' key, resolves issue #6
Browse files Browse the repository at this point in the history
  • Loading branch information
AnthonyDiGirolamo committed Jul 27, 2014
1 parent c57add1 commit b4962d9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ Key Bindings

? - display this help message
q, ctrl-c - quit
w - save current todo file

### Movement

Expand Down
1 change: 1 addition & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ General

? - display this help message
q, ctrl-c - quit
w - save current todo file

Movement
~~~~~~~~
Expand Down
11 changes: 10 additions & 1 deletion todotxt_machine/screen.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ def __init__(self, todo, readline_editing_mode='vi'):
self.todo = todo
self.sorting_names = ["Unsorted", "Ascending ", "Descending"]
self.sorting = 0
self.saved_message = ""
self.clear_search_term()
self.readline_editing_mode = readline_editing_mode
self.update_todos(todo)
Expand Down Expand Up @@ -136,7 +137,11 @@ def update(self):
else:
right_header = " {0} ".format(
self.todo.file_path[:].replace(os.environ['HOME'], '~')
).rjust(columns-left_header_size)[:columns-left_header_size]
)
if len(self.saved_message) > 0:
right_header = self.saved_message + right_header
self.saved_message = ""
right_header = right_header.rjust(columns-left_header_size)[:columns-left_header_size]

term.output( term.clear_formatting() )
term.move_cursor(1, 1)
Expand Down Expand Up @@ -317,6 +322,7 @@ def display_help(self):
? - display this help message
q, ctrl-c - quit
w - save current todo file
### Movement
Expand Down Expand Up @@ -434,6 +440,9 @@ def main_loop(self):
if c != "":
if c == "?":
self.display_help()
elif c == "w":
self.todo.save()
self.saved_message = "Saved!"
elif c == "j":
self.move_selection_down()
elif c == "k":
Expand Down

0 comments on commit b4962d9

Please sign in to comment.