diff options
| author | Robin Haberkorn <rhaberkorn@fmsbw.de> | 2026-11-20 01:45:55 +0100 |
|---|---|---|
| committer | Robin Haberkorn <rhaberkorn@fmsbw.de> | 2026-11-20 01:45:55 +0100 |
| commit | b283996b6ecffc3a1d05c52df02c89ec86cafa96 (patch) | |
| tree | 4981e3fdd838ba824d4533669edda2220a8b3e2c | |
| parent | f0237c8e01fc3aa004660cf52258c871522175c6 (diff) | |
fixed rubbing out Q-reg string appends (:Xq or :^Uq)master-fmsbw-ci
I was trying to get the current position within the Q-register
before it was loaded into the view - so we'd get the previous
register's position instead (usually 0).
Still, we cannot assume the position to be at the end of the
register before an append operation, so we must get the size
of the string instead (SCI_GETLENGTH).
Has been broken since e371b5fc710c597e175e6b7d7645b3a224a731a1.
| -rw-r--r-- | src/qreg.c | 8 | ||||
| -rw-r--r-- | tests/testsuite.at | 2 |
2 files changed, 7 insertions, 3 deletions
@@ -199,9 +199,6 @@ teco_qreg_plain_append_string(teco_qreg_t *qreg, const gchar *str, gsize len, GE teco_doc_undo_edit(&teco_qreg_current->string); teco_doc_undo_reset(&qreg->string); - - sptr_t pos = teco_view_ssm(teco_qreg_view, SCI_GETCURRENTPOS, 0, 0); - undo__teco_view_ssm(teco_qreg_view, SCI_DELETERANGE, pos, len); } if (teco_qreg_current) @@ -209,6 +206,11 @@ teco_qreg_plain_append_string(teco_qreg_t *qreg, const gchar *str, gsize len, GE teco_doc_edit(&qreg->string, teco_default_codepage()); + if (qreg->flags.must_undo) { // FIXME + sptr_t pos = teco_view_ssm(teco_qreg_view, SCI_GETLENGTH, 0, 0); + undo__teco_view_ssm(teco_qreg_view, SCI_DELETERANGE, pos, len); + } + teco_view_ssm(teco_qreg_view, SCI_APPENDTEXT, len, (sptr_t)str); if (teco_qreg_current) diff --git a/tests/testsuite.at b/tests/testsuite.at index 3f55e15..b0a3c55 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -736,6 +736,8 @@ AT_CLEANUP AT_SETUP([Rub out string append]) TE_CHECK_CMDLINE([[@I/XXX/ H:Xa{-4D} :Qa-0"N(0/0)']], 0, ignore, stderr) AT_FAIL_IF([$GREP "^Error:" stderr]) +TE_CHECK_CMDLINE([[@^Ua/ABC/ :@^Ua/012/{-10D} :@EN/ABC/^EQa/"F(0/0)']], 0, ignore, stderr) +AT_FAIL_IF([$GREP "^Error:" stderr]) AT_CLEANUP AT_SETUP([Rub out of empty forward kill]) |
