From be1432fa33fed316587feb33bc6bb1f5cc7fdb4e Mon Sep 17 00:00:00 2001 From: Vansh Negi Date: Fri, 6 Mar 2026 21:43:45 +0000 Subject: [PATCH 1/8] fix: added checks to disable autocomplete options inside macro editor --- src/Edit/Interface/edit_source.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Edit/Interface/edit_source.cpp b/src/Edit/Interface/edit_source.cpp index 85c632710b..7d2b827943 100644 --- a/src/Edit/Interface/edit_source.cpp +++ b/src/Edit/Interface/edit_source.cpp @@ -13,6 +13,7 @@ #include "connect.hpp" #include "dictionary.hpp" #include "edit_interface.hpp" +#include "tm_buffer.hpp" #include "hashset.hpp" #include "iterator.hpp" #include "merge_sort.hpp" @@ -30,6 +31,17 @@ void edit_interface_rep::source_complete_try () { bool is_source = (get_env_string ("mode") == "src"); bool is_source_mode= (get_env_string ("preamble") == "true"); + + // Disable autocomplete in the macro editor + string buf_name= as_string (buf->buf->name); + if ((starts(buf_name, "tmfs://aux/edit-") + && buf_name != "tmfs://aux/edit-comment" + && buf_name != "tmfs://aux/edit-shortcuts") + || buf_name == "tmfs://aux/macro-editor" + ) { + return; + } + if (is_source && (!is_source_mode)) { completion_style= get_preference ("completion style"); if (completion_style != "popup") { From cbbffd11f09e24be96a9356dacb3f3c594394a86 Mon Sep 17 00:00:00 2001 From: Vansh Negi Date: Fri, 6 Mar 2026 21:58:37 +0000 Subject: [PATCH 2/8] added developer document 201_94.md --- devel/201_94.md | 58 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 devel/201_94.md diff --git a/devel/201_94.md b/devel/201_94.md new file mode 100644 index 0000000000..42626c90d7 --- /dev/null +++ b/devel/201_94.md @@ -0,0 +1,58 @@ +# [201_94] Disable autocomplete in macro editor + +### What +Disabled autocomplete suggestions in the macro editor when in command/source mode. This prevents unwanted completion popups from interfering with macro definition editing, especially for special commands like `\` (backslash). + +### Why +When editing macros in the macro editor, autocomplete suggestions would: +- Trigger unexpectedly while defining macro source code +- Corrupt S-expression structures with unintended completions +- Create confusion between macro syntax and insertion behavior +- Interfere with precise command definitions (e.g., symbol mode commands like `\`) + +The macro editor requires pristine source editing without interference from language-aware completions. + +### How +In `src/Edit/Interface/edit_source.cpp`: + +Modified the `source_complete_try()` function to detect and skip autocomplete in macro editor buffers: + +1. **Detect macro editor buffers** by checking buffer URL patterns: + - `tmfs://aux/edit-` - Individual macro editors (e.g., `edit-strong`, `edit-emphasis`) + - `tmfs://aux/macro-editor` - General macro editor widget + +2. **Exclude unrelated auxiliary editors** to only affect macro editing: + - NOT `tmfs://aux/edit-comment` (comment editor should keep autocomplete) + - NOT `tmfs://aux/edit-shortcuts` (shortcuts editor should keep autocomplete) + +3. **Early return** from `source_complete_try()` when in a macro editor, skipping all completion logic. + +Added logic: +```cpp +// Disable autocomplete in the macro editor +string buf_name = as_string(buf->buf->name); +if ((starts(buf_name, "tmfs://aux/edit-") + && buf_name != "tmfs://aux/edit-comment" + && buf_name != "tmfs://aux/edit-shortcuts") + || buf_name == "tmfs://aux/macro-editor") { + return; +} +``` + +### How to test +1. Open Mogan Editor. +2. Open the macro editor: + - Via menu: Source → Edit macro → (select a macro like "strong") + - Or press the macro edit button in the macro panel +3. Begin editing the macro source code: + - Try typing a prefix like `st`, `str`, etc. + - **Verify**: No autocomplete popup appears +4. Exit the macro editor and return to regular document editing: + - Try typing a prefix like `st` + - **Verify**: Autocomplete popup works normally in source mode +5. Test with command mode: + - In macro editor, try entering command symbols like `\` + - **Verify**: No unwanted completions interfere +6. Test other auxiliary editors remain unaffected: + - Open comment editor if available + - **Verify**: Autocomplete still functions in comment editor From 838b24007568211291a57ce5782766a0e410ca76 Mon Sep 17 00:00:00 2001 From: Vansh Negi Date: Fri, 6 Mar 2026 22:05:16 +0000 Subject: [PATCH 3/8] updated the developer document devel/201_94.md --- devel/201_94.md | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/devel/201_94.md b/devel/201_94.md index 42626c90d7..65db53ab32 100644 --- a/devel/201_94.md +++ b/devel/201_94.md @@ -1,16 +1,10 @@ -# [201_94] Disable autocomplete in macro editor +# [201_86] Disable autocomplete in macro editor ### What -Disabled autocomplete suggestions in the macro editor when in command/source mode. This prevents unwanted completion popups from interfering with macro definition editing, especially for special commands like `\` (backslash). +Disabled autocomplete suggestions in the macro editor when in command/source mode. ### Why -When editing macros in the macro editor, autocomplete suggestions would: -- Trigger unexpectedly while defining macro source code -- Corrupt S-expression structures with unintended completions -- Create confusion between macro syntax and insertion behavior -- Interfere with precise command definitions (e.g., symbol mode commands like `\`) - -The macro editor requires pristine source editing without interference from language-aware completions. +The macro editor requires source editing without interference from language-aware completions. ### How In `src/Edit/Interface/edit_source.cpp`: @@ -42,17 +36,7 @@ if ((starts(buf_name, "tmfs://aux/edit-") ### How to test 1. Open Mogan Editor. 2. Open the macro editor: - - Via menu: Source → Edit macro → (select a macro like "strong") - - Or press the macro edit button in the macro panel -3. Begin editing the macro source code: - - Try typing a prefix like `st`, `str`, etc. - - **Verify**: No autocomplete popup appears -4. Exit the macro editor and return to regular document editing: - - Try typing a prefix like `st` - - **Verify**: Autocomplete popup works normally in source mode -5. Test with command mode: + - Via menu: Tools → Macros → New Macro or Edit Macros +3. Test with command mode: - In macro editor, try entering command symbols like `\` - **Verify**: No unwanted completions interfere -6. Test other auxiliary editors remain unaffected: - - Open comment editor if available - - **Verify**: Autocomplete still functions in comment editor From 4da32b2f071b3f5efc2dad83452f87f3c20824ff Mon Sep 17 00:00:00 2001 From: Vansh Negi Date: Sat, 7 Mar 2026 06:37:15 +0000 Subject: [PATCH 4/8] formatted the code and updated the developer document devel/201.94.md --- devel/201_94.md | 4 ++-- src/Edit/Interface/edit_source.cpp | 11 +++++------ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/devel/201_94.md b/devel/201_94.md index 65db53ab32..8b595de0d6 100644 --- a/devel/201_94.md +++ b/devel/201_94.md @@ -1,4 +1,4 @@ -# [201_86] Disable autocomplete in macro editor +# [201_94] Disable autocomplete in macro editor ### What Disabled autocomplete suggestions in the macro editor when in command/source mode. @@ -39,4 +39,4 @@ if ((starts(buf_name, "tmfs://aux/edit-") - Via menu: Tools → Macros → New Macro or Edit Macros 3. Test with command mode: - In macro editor, try entering command symbols like `\` - - **Verify**: No unwanted completions interfere + - **Verify**: No unwanted completions interfere but the macros still work diff --git a/src/Edit/Interface/edit_source.cpp b/src/Edit/Interface/edit_source.cpp index 7d2b827943..5f0d8fb357 100644 --- a/src/Edit/Interface/edit_source.cpp +++ b/src/Edit/Interface/edit_source.cpp @@ -13,12 +13,12 @@ #include "connect.hpp" #include "dictionary.hpp" #include "edit_interface.hpp" -#include "tm_buffer.hpp" #include "hashset.hpp" #include "iterator.hpp" #include "merge_sort.hpp" #include "observers.hpp" #include "preferences.hpp" +#include "tm_buffer.hpp" #include "tree_observer.hpp" #include @@ -34,11 +34,10 @@ edit_interface_rep::source_complete_try () { // Disable autocomplete in the macro editor string buf_name= as_string (buf->buf->name); - if ((starts(buf_name, "tmfs://aux/edit-") - && buf_name != "tmfs://aux/edit-comment" - && buf_name != "tmfs://aux/edit-shortcuts") - || buf_name == "tmfs://aux/macro-editor" - ) { + if ((starts (buf_name, "tmfs://aux/edit-") && + buf_name != "tmfs://aux/edit-comment" && + buf_name != "tmfs://aux/edit-shortcuts") || + buf_name == "tmfs://aux/macro-editor") { return; } From 7de46daf5ef1389ff13ecf7f4a4e19704f5291d2 Mon Sep 17 00:00:00 2001 From: Vansh Negi Date: Sat, 7 Mar 2026 07:04:59 +0000 Subject: [PATCH 5/8] trigger ci recheck From 55c22c74d6e14e5ae70c1eed0382352afbd3cb1d Mon Sep 17 00:00:00 2001 From: Vansh Negi Date: Mon, 9 Mar 2026 08:38:11 +0000 Subject: [PATCH 6/8] refactored the logic to disable \ from entering command mode inside macro editor, updated developer document devel/201_94.md --- TeXmacs/progs/generic/generic-kbd.scm | 2 +- devel/201_94.md | 46 ++++++++++----------------- src/Edit/Interface/edit_source.cpp | 10 ------ 3 files changed, 17 insertions(+), 41 deletions(-) diff --git a/TeXmacs/progs/generic/generic-kbd.scm b/TeXmacs/progs/generic/generic-kbd.scm index 0d5db61f69..a47beb5005 100644 --- a/TeXmacs/progs/generic/generic-kbd.scm +++ b/TeXmacs/progs/generic/generic-kbd.scm @@ -42,7 +42,7 @@ ("]" (make-bracket-close "]" "[")) ("{" (make-bracket-open "{" "}")) ("}" (make-bracket-close "}" "{")) - ("\\" (if (or (inside? 'hybrid) (in-prog?)) (insert "\\") (make-hybrid))) + ("\\" (if (or (inside? 'hybrid) (in-prog?) (has-style-package? "macro-editor")) (insert "\\") (make-hybrid))) ("\\ var" "\\") ("\\ var var" "") ("$" (make 'math)) diff --git a/devel/201_94.md b/devel/201_94.md index 8b595de0d6..80b669db97 100644 --- a/devel/201_94.md +++ b/devel/201_94.md @@ -1,42 +1,28 @@ -# [201_94] Disable autocomplete in macro editor +# [201_94] Disable hybrid command mode in macro editor ### What -Disabled autocomplete suggestions in the macro editor when in command/source mode. +Disabled the hybrid command mode (the `⟨\⟩` tag) in the macro editor. This prevents the `\` key from triggering command mode and its associated autocomplete suggestions. ### Why -The macro editor requires source editing without interference from language-aware completions. +The macro editor is used for source editing of macros. In this context, the backslash character `\` should be treated as a literal character rather than a trigger for the hybrid command mode, which introduces distracting autocomplete suggestions and decorative brackets. ### How -In `src/Edit/Interface/edit_source.cpp`: +Modified `TeXmacs/progs/generic/generic-kbd.scm`: -Modified the `source_complete_try()` function to detect and skip autocomplete in macro editor buffers: +Updated the backslash `\` key binding to check if the current buffer is the macro editor using `(has-style-package? "macro-editor")`. If true, it inserts a literal backslash instead of calling `make-hybrid`. -1. **Detect macro editor buffers** by checking buffer URL patterns: - - `tmfs://aux/edit-` - Individual macro editors (e.g., `edit-strong`, `edit-emphasis`) - - `tmfs://aux/macro-editor` - General macro editor widget - -2. **Exclude unrelated auxiliary editors** to only affect macro editing: - - NOT `tmfs://aux/edit-comment` (comment editor should keep autocomplete) - - NOT `tmfs://aux/edit-shortcuts` (shortcuts editor should keep autocomplete) - -3. **Early return** from `source_complete_try()` when in a macro editor, skipping all completion logic. - -Added logic: -```cpp -// Disable autocomplete in the macro editor -string buf_name = as_string(buf->buf->name); -if ((starts(buf_name, "tmfs://aux/edit-") - && buf_name != "tmfs://aux/edit-comment" - && buf_name != "tmfs://aux/edit-shortcuts") - || buf_name == "tmfs://aux/macro-editor") { - return; -} +```scheme +("\\" (if (or (inside? 'hybrid) (in-prog?) (has-style-package? "macro-editor")) + (insert "\\") (make-hybrid))) ``` ### How to test 1. Open Mogan Editor. -2. Open the macro editor: - - Via menu: Tools → Macros → New Macro or Edit Macros -3. Test with command mode: - - In macro editor, try entering command symbols like `\` - - **Verify**: No unwanted completions interfere but the macros still work +2. Open the macro editor via **Tools → Macros → New macro** or **Tools → Macros → Edit macro** +3. Inside the macro editor press the `\` key. +4. **Verify**: + - A literal `\` is inserted. + - No `⟨\⟩` bracketed tag appears. + - No autocomplete suggestion popup appears. +5. Test in a normal document: + - **Verify**: The `\` key still triggers the hybrid command mode correctly. diff --git a/src/Edit/Interface/edit_source.cpp b/src/Edit/Interface/edit_source.cpp index 5f0d8fb357..463e1fc047 100644 --- a/src/Edit/Interface/edit_source.cpp +++ b/src/Edit/Interface/edit_source.cpp @@ -18,7 +18,6 @@ #include "merge_sort.hpp" #include "observers.hpp" #include "preferences.hpp" -#include "tm_buffer.hpp" #include "tree_observer.hpp" #include @@ -32,15 +31,6 @@ edit_interface_rep::source_complete_try () { bool is_source = (get_env_string ("mode") == "src"); bool is_source_mode= (get_env_string ("preamble") == "true"); - // Disable autocomplete in the macro editor - string buf_name= as_string (buf->buf->name); - if ((starts (buf_name, "tmfs://aux/edit-") && - buf_name != "tmfs://aux/edit-comment" && - buf_name != "tmfs://aux/edit-shortcuts") || - buf_name == "tmfs://aux/macro-editor") { - return; - } - if (is_source && (!is_source_mode)) { completion_style= get_preference ("completion style"); if (completion_style != "popup") { From ad5560a0cd77e85c997667db28759eafaee68f56 Mon Sep 17 00:00:00 2001 From: Vansh Negi Date: Tue, 10 Mar 2026 08:57:02 +0000 Subject: [PATCH 7/8] fix: disable hybrid command mode (\) in macro editor using current-buffer check --- TeXmacs/progs/generic/generic-kbd.scm | 8 +++++- devel/201_94.md | 28 ------------------- devel/201_95.md | 40 +++++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 29 deletions(-) delete mode 100644 devel/201_94.md create mode 100644 devel/201_95.md diff --git a/TeXmacs/progs/generic/generic-kbd.scm b/TeXmacs/progs/generic/generic-kbd.scm index a47beb5005..9813308840 100644 --- a/TeXmacs/progs/generic/generic-kbd.scm +++ b/TeXmacs/progs/generic/generic-kbd.scm @@ -25,6 +25,12 @@ (texmacs texmacs tm-print) (doc help-funcs))) +(tm-define (inside-macro-editor?) + (with u (url->string (current-buffer)) + (or (== u "tmfs://aux/macro-editor") + (and (string-starts? u "tmfs://aux/edit-") + (not (== u "tmfs://aux/edit-shortcuts")))))) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; General shortcuts for all modes ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -42,7 +48,7 @@ ("]" (make-bracket-close "]" "[")) ("{" (make-bracket-open "{" "}")) ("}" (make-bracket-close "}" "{")) - ("\\" (if (or (inside? 'hybrid) (in-prog?) (has-style-package? "macro-editor")) (insert "\\") (make-hybrid))) + ("\\" (if (or (inside? 'hybrid) (in-prog?) (inside-macro-editor?)) (insert "\\") (make-hybrid))) ("\\ var" "\\") ("\\ var var" "") ("$" (make 'math)) diff --git a/devel/201_94.md b/devel/201_94.md deleted file mode 100644 index 80b669db97..0000000000 --- a/devel/201_94.md +++ /dev/null @@ -1,28 +0,0 @@ -# [201_94] Disable hybrid command mode in macro editor - -### What -Disabled the hybrid command mode (the `⟨\⟩` tag) in the macro editor. This prevents the `\` key from triggering command mode and its associated autocomplete suggestions. - -### Why -The macro editor is used for source editing of macros. In this context, the backslash character `\` should be treated as a literal character rather than a trigger for the hybrid command mode, which introduces distracting autocomplete suggestions and decorative brackets. - -### How -Modified `TeXmacs/progs/generic/generic-kbd.scm`: - -Updated the backslash `\` key binding to check if the current buffer is the macro editor using `(has-style-package? "macro-editor")`. If true, it inserts a literal backslash instead of calling `make-hybrid`. - -```scheme -("\\" (if (or (inside? 'hybrid) (in-prog?) (has-style-package? "macro-editor")) - (insert "\\") (make-hybrid))) -``` - -### How to test -1. Open Mogan Editor. -2. Open the macro editor via **Tools → Macros → New macro** or **Tools → Macros → Edit macro** -3. Inside the macro editor press the `\` key. -4. **Verify**: - - A literal `\` is inserted. - - No `⟨\⟩` bracketed tag appears. - - No autocomplete suggestion popup appears. -5. Test in a normal document: - - **Verify**: The `\` key still triggers the hybrid command mode correctly. diff --git a/devel/201_95.md b/devel/201_95.md new file mode 100644 index 0000000000..582ba9bb33 --- /dev/null +++ b/devel/201_95.md @@ -0,0 +1,40 @@ +# [201_95] Disable hybrid command mode in macro editor + +### What +Disabled the hybrid command mode (the `⟨\⟩` tag) in the macro editor. This prevents the `\` key from triggering command mode and its associated autocomplete suggestions. + +### Why +The macro editor is used for source editing of macros. In this context, the backslash character `\` should be treated as a literal character rather than a trigger for the hybrid command mode, which introduces distracting autocomplete suggestions and decorative brackets. + +### How +Modified `TeXmacs/progs/generic/generic-kbd.scm`: + +1. Defined a new helper function `(inside-macro-editor?)` that explicitly checks the URL of `(current-buffer)` to see if it matches the macro editor's auxiliary buffer paths (`tmfs://aux/macro-editor` or `tmfs://aux/edit-*` excluding `tmfs://aux/edit-shortcuts`). + +```scheme +(tm-define (inside-macro-editor?) + (with u (url->string (current-buffer)) + (or (== u "tmfs://aux/macro-editor") + (and (string-starts? u "tmfs://aux/edit-") + (not (== u "tmfs://aux/edit-shortcuts")))))) +``` + +2. Updated the backslash `\` key binding to use the new `(inside-macro-editor?)` predicate. If true, it inserts a literal backslash instead of calling `make-hybrid`. + +```scheme +("\\" (if (or (inside? 'hybrid) (in-prog?) (inside-macro-editor?)) + (insert "\\") (make-hybrid))) +``` + +### How to test +1. Open Mogan Editor. +2. Open the macro editor via **Tools → Macros → New macro or Edit macros**. +4. Press the `\` key. +5. **Verify**: + - A literal `\` is inserted. + - No `⟨\⟩` bracketed tag appears. + - No autocomplete suggestion popup appears. +6. Test in a normal document: + - **Verify**: The `\` key still triggers the hybrid command mode completely. +7. Test in search/replace window: + - **Verify**: The `\` key still triggers the hybrid command mode completely inside the search input buffer. From dceff3393625131594f2163e1bb239778c6b0f4d Mon Sep 17 00:00:00 2001 From: Vansh Negi Date: Tue, 10 Mar 2026 13:12:24 +0000 Subject: [PATCH 8/8] fix: restore hybrid command mode but disable autocomplete in macro editor --- TeXmacs/progs/generic/generic-kbd.scm | 8 +--- devel/201_95.md | 53 ++++++++++++--------------- src/Edit/Interface/edit_source.cpp | 10 +++++ 3 files changed, 35 insertions(+), 36 deletions(-) diff --git a/TeXmacs/progs/generic/generic-kbd.scm b/TeXmacs/progs/generic/generic-kbd.scm index 9813308840..0d5db61f69 100644 --- a/TeXmacs/progs/generic/generic-kbd.scm +++ b/TeXmacs/progs/generic/generic-kbd.scm @@ -25,12 +25,6 @@ (texmacs texmacs tm-print) (doc help-funcs))) -(tm-define (inside-macro-editor?) - (with u (url->string (current-buffer)) - (or (== u "tmfs://aux/macro-editor") - (and (string-starts? u "tmfs://aux/edit-") - (not (== u "tmfs://aux/edit-shortcuts")))))) - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; General shortcuts for all modes ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -48,7 +42,7 @@ ("]" (make-bracket-close "]" "[")) ("{" (make-bracket-open "{" "}")) ("}" (make-bracket-close "}" "{")) - ("\\" (if (or (inside? 'hybrid) (in-prog?) (inside-macro-editor?)) (insert "\\") (make-hybrid))) + ("\\" (if (or (inside? 'hybrid) (in-prog?)) (insert "\\") (make-hybrid))) ("\\ var" "\\") ("\\ var var" "") ("$" (make 'math)) diff --git a/devel/201_95.md b/devel/201_95.md index 582ba9bb33..4f62929a5c 100644 --- a/devel/201_95.md +++ b/devel/201_95.md @@ -1,40 +1,35 @@ -# [201_95] Disable hybrid command mode in macro editor +# [201_95] Disable autocomplete options in macro editor ### What -Disabled the hybrid command mode (the `⟨\⟩` tag) in the macro editor. This prevents the `\` key from triggering command mode and its associated autocomplete suggestions. +Disabled the autocomplete popup suggestions in the macro editor while keeping the `\` hybrid command mode functional. ### Why -The macro editor is used for source editing of macros. In this context, the backslash character `\` should be treated as a literal character rather than a trigger for the hybrid command mode, which introduces distracting autocomplete suggestions and decorative brackets. +The macro editor is used for source editing of macros. In this context, autocomplete suggestions for macros popup unexpectedly and interfere with typing command names. However, the `\` key itself should still trigger the hybrid command mode `⟨\⟩`. As the search/replace buffers and other auxiliary windows rely on standard autocomplete behavior, the fix must explicitly target only the macro editor buffers. ### How -Modified `TeXmacs/progs/generic/generic-kbd.scm`: - -1. Defined a new helper function `(inside-macro-editor?)` that explicitly checks the URL of `(current-buffer)` to see if it matches the macro editor's auxiliary buffer paths (`tmfs://aux/macro-editor` or `tmfs://aux/edit-*` excluding `tmfs://aux/edit-shortcuts`). - -```scheme -(tm-define (inside-macro-editor?) - (with u (url->string (current-buffer)) - (or (== u "tmfs://aux/macro-editor") - (and (string-starts? u "tmfs://aux/edit-") - (not (== u "tmfs://aux/edit-shortcuts")))))) -``` - -2. Updated the backslash `\` key binding to use the new `(inside-macro-editor?)` predicate. If true, it inserts a literal backslash instead of calling `make-hybrid`. - -```scheme -("\\" (if (or (inside? 'hybrid) (in-prog?) (inside-macro-editor?)) - (insert "\\") (make-hybrid))) +Modified `src/Edit/Interface/edit_source.cpp`: + +Updated `source_complete_try()` to return early when the current buffer (`buf->buf->name`) is identified as a macro editor buffer. The check properly matches `tmfs://aux/macro-editor` or specific `tmfs://aux/edit-*` URLs while explicitly exempting `edit-shortcuts` and `edit-comment` to avoid unintentionally disabling their autocomplete. + +```cpp +// Disable autocomplete options in the macro editor +string buf_name= as_string (buf->buf->name); +if ((starts (buf_name, "tmfs://aux/edit-") && + buf_name != "tmfs://aux/edit-shortcuts" && + !starts (buf_name, "tmfs://aux/edit-comment")) || + buf_name == "tmfs://aux/macro-editor") { + return; +} ``` ### How to test 1. Open Mogan Editor. 2. Open the macro editor via **Tools → Macros → New macro or Edit macros**. -4. Press the `\` key. -5. **Verify**: - - A literal `\` is inserted. - - No `⟨\⟩` bracketed tag appears. - - No autocomplete suggestion popup appears. -6. Test in a normal document: - - **Verify**: The `\` key still triggers the hybrid command mode completely. -7. Test in search/replace window: - - **Verify**: The `\` key still triggers the hybrid command mode completely inside the search input buffer. +3. Press the `\` key and begin typing. +4. **Verify**: + - The `⟨\⟩` bracketed tag (hybrid command mode) appears correctly. + - *No* autocomplete suggestion popup appears while typing. +5. Test in a normal document: + - **Verify**: The `\` key triggers the hybrid command mode completely, and autocomplete functions as normal. +6. Test in search/replace window: + - **Verify**: The `\` key triggers the hybrid command mode completely, and autocomplete functions as normal. diff --git a/src/Edit/Interface/edit_source.cpp b/src/Edit/Interface/edit_source.cpp index 463e1fc047..dd8485f8ae 100644 --- a/src/Edit/Interface/edit_source.cpp +++ b/src/Edit/Interface/edit_source.cpp @@ -18,6 +18,7 @@ #include "merge_sort.hpp" #include "observers.hpp" #include "preferences.hpp" +#include "tm_buffer.hpp" #include "tree_observer.hpp" #include @@ -31,6 +32,15 @@ edit_interface_rep::source_complete_try () { bool is_source = (get_env_string ("mode") == "src"); bool is_source_mode= (get_env_string ("preamble") == "true"); + // Disable autocomplete options in the macro editor + string buf_name= as_string (buf->buf->name); + if ((starts (buf_name, "tmfs://aux/edit-") && + buf_name != "tmfs://aux/edit-shortcuts" && + !starts (buf_name, "tmfs://aux/edit-comment")) || + buf_name == "tmfs://aux/macro-editor") { + return; + } + if (is_source && (!is_source_mode)) { completion_style= get_preference ("completion style"); if (completion_style != "popup") {