[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Nano-devel] [BUG] Undo and the 'modified' state issue
From: |
Brand Huntsman |
Subject: |
Re: [Nano-devel] [BUG] Undo and the 'modified' state issue |
Date: |
Mon, 18 Dec 2017 00:12:27 -0700 |
On Mon, 18 Dec 2017 14:16:28 +0800
Liu Hao <address@hidden> wrote:
> 1. Create an empty file.
> 2. Type `aaa` in then press <Enter>. The indicator in the upper right
> corner now says 'Modified'.
> 3. Press ^O and save the file somewhere, for example, `/dev/null`. The
> indicator disappears.
> 4. Type `bbb` in, The indicator says 'Modified' again.
> 5. Press M-U. This undoes the input and effectively restores the file
> to its last saved state, *but the indicator still says 'Modified'*.
> 6. Press M-U repeatedly until there are no more characters in the
> editing area. This restores the file to the state when it was
> opened. The indicator disappears, *but it shouldn't*.
I didn't press ENTER after 'aaa', saved, typed 'bbb' and then the undo removed
the entire 'aaabbb'. The file was empty and 'Modified' was gone, which was
incorrect. Saves should prevent text from joining into a single undo. Maybe set
a last_saved_undo variable to the current undo entry when file is saved. Then
undo/redo sets modified = (current_undo != last_saved_undo). And if
current_undo == last_saved_undo, create a new undo entry instead of adding text
to current_undo.