#NEWLINE# def update_selected_note_data( self , note ) : #NEWLINE# #INDENT# "\n        Update currently selected note's data.\n\n        This is called when the user triggers a per-note sync and a newer\n        note comes back, but also when the search string changes, and the\n        currently selected note gets a newer version due to background or\n        foreground syncing.\n\n        We take care only to update the note content if it has actually\n        changed, to minimise visual glitches.\n        " #NEWLINE# self . mute_note_data_changes ( ) #NEWLINE# current_content = self . get_text ( ) #NEWLINE# new_content = note . get ( 'content' , '' ) #NEWLINE# if ( new_content != current_content ) : #NEWLINE# #INDENT# cursor_pos = self . text_note . index ( tk . INSERT ) #NEWLINE# ( first , last ) = self . text_note . yview ( ) #NEWLINE# self . set_note_data ( note , reset_undo = False ) #NEWLINE# self . text_note . yview ( 'moveto' , first ) #NEWLINE# self . text_note . mark_set ( tk . INSERT , self ) #NEWLINE# self . activate_links ( ) #NEWLINE# self . activate_search_string_highlights ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . set_note_data ( note , reset_undo = False , content_unchanged = True ) #NEWLINE# #UNINDENT# self . unmute_note_data_changes ( )