Skip to content
This repository has been archived by the owner on Jul 12, 2024. It is now read-only.

Commit

Permalink
Fix: Ensure note view is passed correctly to NoteDeleter
Browse files Browse the repository at this point in the history
Update the `NoteDeleteCommand` to correctly pass the `note_view` to the `NoteDeleter` callback, ensuring proper deletion handling.
  • Loading branch information
RedAtman committed Jul 10, 2024
1 parent 3e8b92e commit ca4bfb9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions simplenotecommands.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,16 +98,16 @@ def flush_saves():
sublime.set_timeout(flush_saves, debounce_time)

def on_load(self, view: sublime.View):
logger.info(view)
# logger.info(view)
view_filepath = view.file_name()
assert isinstance(view_filepath, str), "view_filepath is not a string: %s" % type(view_filepath)
note = Note.get_note_from_filepath(view_filepath)
assert isinstance(note, Note), "note is not a Note: %s" % type(note)
logger.info(("note", note))
# logger.info(("note", note))
SETTINGS = sublime.load_settings(SIMPLENOTE_SETTINGS_FILE)
note_syntax = SETTINGS.get("note_syntax")
assert isinstance(note_syntax, str)
logger.info(("note_syntax", note_syntax))
# logger.info(("note_syntax", note_syntax))
if note and note_syntax:
view.set_syntax_file(note_syntax)

Expand Down Expand Up @@ -155,7 +155,7 @@ def run(self):
sublime.active_window().show_quick_panel(
self.list__title,
self.on_select,
# flags=sublime.KEEP_OPEN_ON_FOCUS_LOST,
flags=sublime.KEEP_OPEN_ON_FOCUS_LOST,
# on_highlight=self.on_select,
placeholder="Select Note press key 'enter' to open",
)
Expand Down Expand Up @@ -205,7 +205,7 @@ def run(self):
note = Note.get_note_from_filepath(view_filepath)
assert isinstance(note, Note), "note must be a Note"
note_deleter = NoteDeleter(note=note, sm=sm)
note_deleter.set_callback(self.handle_deletion, {"note_view": note_view})
note_deleter.set_callback(self.handle_deletion, {"view": note_view})
OperationManager().add_operation(note_deleter)


Expand Down

0 comments on commit ca4bfb9

Please sign in to comment.