aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2025-07-18 01:59:46 +0300
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2025-07-18 01:59:46 +0300
commitcf7e3bc51731ea4be786ec163532a63d7f93af87 (patch)
tree3810d36f390a36f00838c318273565aa4b9f65d6
parent5d4368584ecd447b953e8853dbeaee4282700970 (diff)
downloadsciteco-cf7e3bc51731ea4be786ec163532a63d7f93af87.tar.gz
<nEL> (set EOL mode) now sets the buffer's dirty flag
* While it doesn't directly change the buffer's contents in bytes, a subsequent write would result in a different file on disk, so it is consequent to remind the user of saving or discarding changes. * Will also fix :EX after changing the EOL mode.
-rw-r--r--TODO4
-rw-r--r--src/core-commands.c7
2 files changed, 7 insertions, 4 deletions
diff --git a/TODO b/TODO
index 930dd3a..016973e 100644
--- a/TODO
+++ b/TODO
@@ -420,10 +420,6 @@ Features:
byte offsets. This would mainly be useful in ^E\^E.
* EL command could also be used to convert all EOLs in the current
buffer.
- * nEL should perhaps dirtify the buffer, at least when automatic
- EOL translation is active, or always (see above).
- The dirty flag exists to remind users to save their buffers and
- nEL changes the result of a Save.
* exclusive access to all opened files/buffers (locking):
SciTECO will never be able to notice when a file has been
changed externally. Also reversing a file write will overwrite
diff --git a/src/core-commands.c b/src/core-commands.c
index ae51ecc..287a9a3 100644
--- a/src/core-commands.c
+++ b/src/core-commands.c
@@ -2337,6 +2337,13 @@ teco_state_ecommand_eol(teco_machine_main_t *ctx, GError **error)
undo__teco_interface_ssm(SCI_SETEOLMODE,
teco_interface_ssm(SCI_GETEOLMODE, 0, 0), 0);
teco_interface_ssm(SCI_SETEOLMODE, eol_mode, 0);
+
+ /*
+ * While the buffer contents were not changed,
+ * the result of saving the file may differ,
+ * so we still dirtify the buffer.
+ */
+ teco_ring_dirtify();
} else if (teco_machine_main_eval_colon(ctx) > 0) {
const gchar *eol_seq = teco_eol_get_seq(teco_interface_ssm(SCI_GETEOLMODE, 0, 0));
teco_expressions_push(eol_seq);