# Edit mode destroys source code (Windows 10/11)

**URL:** <https://forum.cabbageaudio.com/t/edit-mode-destroys-source-code-windows-10-11/3769>\
**Category:** Cabbage Stew\
**Created:** [29 June 2023 13:17 UTC](https://forum.cabbageaudio.com/t/edit-mode-destroys-source-code-windows-10-11/3769 "2023-06-29T13:17:56Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![stefanv](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/stefanv/32/4755_2.png) [@stefanv](https://forum.cabbageaudio.com/u/stefanv)\
**Post date:** [29 June 2023 13:17 UTC](https://forum.cabbageaudio.com/t/edit-mode-destroys-source-code-windows-10-11/3769/1 "2023-06-29T13:17:56Z")

</div>

When using Edit mode, to move or resize widgets, each movement of the respective widget adds new text to the source code, making it more or less unreadable (and perhaps unusable? Did not try that).

Of course, I can resize or position the widgets manually using coordinates in the source code, but doing it graphically could be a bit easier…

Am I doing something wrong?

 ![Editor](https://forum.cabbageaudio.com/uploads/default/original/2X/2/2076805dad72af52b193cbf9fa28b1c35abac1a7.jpeg)

---

<div class="post-metadata">

**Author:** ![rorywalsh](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/rorywalsh/32/165_2.png) [@rorywalsh](https://forum.cabbageaudio.com/u/rorywalsh)\
**Post date:** [30 June 2023 08:10 UTC](https://forum.cabbageaudio.com/t/edit-mode-destroys-source-code-windows-10-11/3769/2 "2023-06-30T08:10:44Z")

</div>

I think there is a rogue identifier that is causing the issue here. If you create a new instrument and add some controls it works fine right? I wonder if you can identifier what causes the formatting issue to take place? Btw, are you using the latest beta version? Or are you using 2.9?

---

<div class="post-metadata">

**Author:** ![stefanv](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/stefanv/32/4755_2.png) [@stefanv](https://forum.cabbageaudio.com/u/stefanv)\
**Post date:** [30 June 2023 15:21 UTC](https://forum.cabbageaudio.com/t/edit-mode-destroys-source-code-windows-10-11/3769/3 "2023-06-30T15:21:21Z")

</div>

I still use 2.9.0.

Indeed, edit mode works fine for new instruments, but not for pre-existing ones. Good to know.

Willl try to find out, whether the is an entry, that confuses cabbage.

---

<div class="post-metadata">

**Author:** ![hdale94](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/hdale94/32/6371_2.png) [@hdale94](https://forum.cabbageaudio.com/u/hdale94)\
**Post date:** [30 June 2023 16:36 UTC](https://forum.cabbageaudio.com/t/edit-mode-destroys-source-code-windows-10-11/3769/4 "2023-06-30T16:36:29Z")

</div>

I’ve experienced this many times, and have stopped using the Edit mode because of this. Only using `bounds()` at the moment.

IMO, the Cabbage-section should be as strict as Csound when detecting syntax errors, but @rorywalsh might disagree 🙈

---

<div class="post-metadata">

**Author:** ![stefanv](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/stefanv/32/4755_2.png) [@stefanv](https://forum.cabbageaudio.com/u/stefanv)\
**Post date:** [2 July 2023 15:47 UTC](https://forum.cabbageaudio.com/t/edit-mode-destroys-source-code-windows-10-11/3769/5 "2023-07-02T15:47:01Z")

</div>

Could nail the problem down a bit. Started with a new project, added some code and when I added this, the problem occured:

```
#define SLIDER1 textColour ( 0, 0, 0), trackerColour (170, 170, 170)    
rslider $SLIDER1 bounds ( 12, 14, 105, 101), channel ("att"), range (0.01, 20, 1, 1, 0.01), text ("Attack")

```

Same situation with this:

```
#define COMBO1 colour (170, 170, 170), fontColour (0, 0, 0)
combobox $COMBO1 bounds ( 20, 160, 200, 30), channel ("pol"), items("0", "2", "4", "6"), text ("Off", "2", "4", "6"), value(1)

```

Even if I remove the #define (i.e. use the default colours), the problem persists. Something wrong with the rslider or combobox definition?

On the other side - this works fine:

```
#define LABEL1 textColour ( 0, 0, 0), fontColour (0, 0, 0)
label $LABEL1 bounds(50, 164, 250, 30), text ("HPF Filter Poles:")
```

---

<div class="post-metadata">

**Author:** ![giovannibedetti](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/giovannibedetti/32/4146_2.png) [@giovannibedetti](https://forum.cabbageaudio.com/u/giovannibedetti)\
**Post date:** [2 July 2023 16:14 UTC](https://forum.cabbageaudio.com/t/edit-mode-destroys-source-code-windows-10-11/3769/6 "2023-07-02T16:14:50Z")

</div>

I am seeing the same destructive behaviour using curly brackets to create groups, the following gets destroyed badly when trying to move things:

```
image bounds (0, 0, 270, 170)
{
    image bounds(10, 10, 250, 50) colour(0, 255, 255, 255)
    {
        hslider bounds(0, 10, 240, 50) channel("band") range(0.0010, 1.5, .17, 1, 0.001) align("top") 
        label bounds(0, -8, 250, 30) text("FREQ SPREAD") fontSize(12) align ("centre")
        label bounds(0, 10, 250, 20) text("Focused <-------------------> Diffuse") fontSize(10) align ("centre")
    }
    image bounds(10, 60, 250, 50) colour(100, 255, 255, 255)
    {
        hslider bounds(0, 10, 240, 50) channel("dur") range(0.01, 2.5, 0.17, 1, 0.001)
        label bounds(0, -8, 250, 30) text("DURATION") fontSize(12) align ("centre")
        label bounds(0, 10, 250, 20) text("Short <-------------------> Long") fontSize(10) align ("centre")
    }
    image bounds(10, 110, 250, 50) colour(200, 255, 255, 255)
    {
        hslider bounds(0, 10, 250, 50) channel("rate") range(0.1, 2, 0.17, 1, 0.001)
        label bounds(0, -8, 250, 30) text("RATE") fontSize(12) align ("centre")
        label bounds(0, 10, 250, 20) text("Fast <-------------------> Slow") fontSize(10) align ("centre")
    }
}
```

---

<div class="post-metadata">

**Author:** ![rorywalsh](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/rorywalsh/32/165_2.png) [@rorywalsh](https://forum.cabbageaudio.com/u/rorywalsh)\
**Post date:** [3 July 2023 08:27 UTC](https://forum.cabbageaudio.com/t/edit-mode-destroys-source-code-windows-10-11/3769/7 "2023-07-03T08:27:33Z")

</div>

Thanks guys I’ll take a look when I get a chance 👍

---

<div class="post-metadata">

**Author:** ![rorywalsh](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/rorywalsh/32/165_2.png) [@rorywalsh](https://forum.cabbageaudio.com/u/rorywalsh)\
**Post date:** [6 July 2023 09:05 UTC](https://forum.cabbageaudio.com/t/edit-mode-destroys-source-code-windows-10-11/3769/8 "2023-07-06T09:05:07Z")

</div>

> [@stefanv](#):
>
> #define SLIDER1 textColour ( 0, 0, 0), trackerColour (170, 170, 170) rslider $SLIDER1 bounds ( 12, 14, 105, 101), channel (“att”), range (0.01, 20, 1, 1, 0.01), text (“Attack”)

Hi @stefanv, I’m jut getting around to looking at this now. I don’t doubt that there is a problem here but I can’t seem to recreate it. Check the screengrab below. Note I obviously have to hit save after I enter the text in order to make it appear.

Would you mind posting a video, or explicitly outlining the steps I need to take in order to recreate the problem. Thanks.

---

<div class="post-metadata">

**Author:** ![rorywalsh](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/rorywalsh/32/165_2.png) [@rorywalsh](https://forum.cabbageaudio.com/u/rorywalsh)\
**Post date:** [6 July 2023 09:07 UTC](https://forum.cabbageaudio.com/t/edit-mode-destroys-source-code-windows-10-11/3769/9 "2023-07-06T09:07:53Z")

</div>

> [@giovannibedetti](#):
>
> I am seeing the same destructive behaviour using curly brackets to create groups, the following gets destroyed badly when trying to move things:

I just noticed now that you have sub groups in this. The dynamic syntax system was never really designed to handle this kind of complexity. ☹

---

<div class="post-metadata">

**Author:** ![rorywalsh](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/rorywalsh/32/165_2.png) [@rorywalsh](https://forum.cabbageaudio.com/u/rorywalsh)\
**Post date:** [6 July 2023 09:08 UTC](https://forum.cabbageaudio.com/t/edit-mode-destroys-source-code-windows-10-11/3769/10 "2023-07-06T09:08:33Z")

</div>

> [@hdale94](#):
>
> I’ve experienced this many times, and have stopped using the Edit mode because of this. Only using `bounds()` at the moment.

Any chance you could describe to me the simplest way I can recreate the problem on my end?

---

<div class="post-metadata">

**Author:** ![hdale94](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/hdale94/32/6371_2.png) [@hdale94](https://forum.cabbageaudio.com/u/hdale94)\
**Post date:** [6 July 2023 14:43 UTC](https://forum.cabbageaudio.com/t/edit-mode-destroys-source-code-windows-10-11/3769/11 "2023-07-06T14:43:08Z")

</div>

I use curly brackets (Plants), with a label as the container, and with slider inside. Try to move the widget in GUI-editor with this example. It will do all sorts of odd stuff.

```
<Cabbage>
form caption("Untitled") size(400, 300), guiMode("queue"), pluginId("def1")
keyboard bounds(8, 158, 381, 95)
 
label bounds(0, 78, 80, 16) channel("label10002") {
    rslider channel("rslider10001") channel("rslider10001") range(0, 1, 0, 1, 0.001)
}
</Cabbage>
<CsoundSynthesizer>
<CsOptions>
-n -d -+rtmidi=NULL -M0 --midi-key-cps=4 --midi-velocity-amp=5
</CsOptions>
<CsInstruments>
; Initialize the global variables. 
ksmps = 32
nchnls = 2
0dbfs = 1

;instrument will be triggered by keyboard widget
instr 1
kEnv madsr .1, .2, .6, .4
aOut vco2 p5, p4
outs aOut*kEnv, aOut*kEnv
endin

</CsInstruments>
<CsScore>
;causes Csound to run for about 7000 years...
f0 z
</CsScore>
</CsoundSynthesizer>
```

---

<div class="post-metadata">

**Author:** ![rorywalsh](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/rorywalsh/32/165_2.png) [@rorywalsh](https://forum.cabbageaudio.com/u/rorywalsh)\
**Post date:** [6 July 2023 15:53 UTC](https://forum.cabbageaudio.com/t/edit-mode-destroys-source-code-windows-10-11/3769/12 "2023-07-06T15:53:44Z")

</div>

Yup, that does the trick alright 🤣 this isn’t going to be easy but I’ll try to find a fix for it.

---

<div class="post-metadata">

**Author:** ![stefanv](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/stefanv/32/4755_2.png) [@stefanv](https://forum.cabbageaudio.com/u/stefanv)\
**Post date:** [8 July 2023 11:54 UTC](https://forum.cabbageaudio.com/t/edit-mode-destroys-source-code-windows-10-11/3769/13 "2023-07-08T11:54:03Z")

</div>

What I do, is very simple:

1. open a new file
2. add **“size(600, 500), colour(200, 200, 200), textColour (0,0,0)”** to the caption
3. add the following lines to the cabbage part:  
**#define SLIDER1 textColour ( 0, 0, 0), trackerColour (170, 170, 170)**  
**#define LABEL1 textColour ( 0, 0, 0), fontColour (0, 0, 0)**  
**#define COMBO1 colour (170, 170, 170), fontColour (0, 0, 0)**  
**rslider $SLIDER1 bounds ( 12, 14, 105, 101), channel (“att”), range (0, 20, 0.1, 1, 0.01), text (“Attack”)**  
**rslider $SLIDER1 bounds (114, 14, 105, 101), channel (“dec”), range (0, 20, 0.5, 1, 0.01), text (“Decay”)**  
**rslider $SLIDER1 bounds (218, 14, 105, 101), channel (“sus”), range (0, 1, 0.5, 0.5, 0.01), text (“Sustain”)**  
**rslider $SLIDER1 bounds (322, 14, 105, 101), channel (“rel”), range (0, 20, 0.7, 1, 0.01), text (“Release”)**
4. say “Run” to bring the GUI up
5. say “Stop”
6. enter edit mode
7. move a slider.

Result: garbage.

That’s all.

---

<div class="post-metadata">

**Author:** ![rorywalsh](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/rorywalsh/32/165_2.png) [@rorywalsh](https://forum.cabbageaudio.com/u/rorywalsh)\
**Post date:** [13 July 2023 11:02 UTC](https://forum.cabbageaudio.com/t/edit-mode-destroys-source-code-windows-10-11/3769/14 "2023-07-13T11:02:34Z")

</div>

> [@hdale94](#):
>
> ```csound
> 
> label bounds(0, 78, 80, 16) channel("label10002") {
> rslider channel("rslider10001") channel("rslider10001") range(0, 1, 0, 1, 0.001)
> }
> 
> ```

Two things here seems to break things. 1) The tab indentation, and 2) the fact you have no bounds set for the label.

---

<div class="post-metadata">

**Author:** ![rorywalsh](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/rorywalsh/32/165_2.png) [@rorywalsh](https://forum.cabbageaudio.com/u/rorywalsh)\
**Post date:** [13 July 2023 11:11 UTC](https://forum.cabbageaudio.com/t/edit-mode-destroys-source-code-windows-10-11/3769/15 "2023-07-13T11:11:21Z")

</div>

> [@stefanv](#):
>
> Result: garbage.

I can’t seem to recreate this here? Can you spot anything I’m not doing? It does add a few colour identifiers, but that’s not so bad.

---

<div class="post-metadata">

**Author:** ![stefanv](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/stefanv/32/4755_2.png) [@stefanv](https://forum.cabbageaudio.com/u/stefanv)\
**Post date:** [13 July 2023 11:34 UTC](https://forum.cabbageaudio.com/t/edit-mode-destroys-source-code-windows-10-11/3769/16 "2023-07-13T11:34:28Z")

</div>

Very strange…

I used the built-in windows recorder, so I can show only the cabbage window, not the plugin…

…and now the video is too big. Pls. find the link to the video here (valid for one week):

> **[Cabbage C\_\_Users\_stefan\_Documents\_Musik\_CSound und PureData\_Cabbage...](https://wetransfer.com/downloads/6280fa717a9d1814d8e82058bd060d5e20230713113238/c1a36b)**
>
> 1 file sent via WeTransfer, the simplest way to send your files around the world

---

<div class="post-metadata">

**Author:** ![rorywalsh](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/rorywalsh/32/165_2.png) [@rorywalsh](https://forum.cabbageaudio.com/u/rorywalsh)\
**Post date:** [13 July 2023 11:57 UTC](https://forum.cabbageaudio.com/t/edit-mode-destroys-source-code-windows-10-11/3769/17 "2023-07-13T11:57:31Z")

</div>

Thanks @stefanv, can you remove the tabs at the start of each line and try again?

---

<div class="post-metadata">

**Author:** ![stefanv](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/stefanv/32/4755_2.png) [@stefanv](https://forum.cabbageaudio.com/u/stefanv)\
**Post date:** [13 July 2023 12:04 UTC](https://forum.cabbageaudio.com/t/edit-mode-destroys-source-code-windows-10-11/3769/18 "2023-07-13T12:04:43Z")

</div>

Great - that does the trick! Problem solved!!!

(But does not improve raedability… ☹ )

---

<div class="post-metadata">

**Author:** ![rorywalsh](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/rorywalsh/32/165_2.png) [@rorywalsh](https://forum.cabbageaudio.com/u/rorywalsh)\
**Post date:** [13 July 2023 14:22 UTC](https://forum.cabbageaudio.com/t/edit-mode-destroys-source-code-windows-10-11/3769/19 "2023-07-13T14:22:08Z")

</div>

> [@stefanv](#):
>
> But does not improve raedability

No, but at least we know now what is causing the issue. I have some place to start ☺

---

<div class="post-metadata">

**Author:** ![rorywalsh](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/rorywalsh/32/165_2.png) [@rorywalsh](https://forum.cabbageaudio.com/u/rorywalsh)\
**Post date:** [14 July 2023 10:58 UTC](https://forum.cabbageaudio.com/t/edit-mode-destroys-source-code-windows-10-11/3769/20 "2023-07-14T10:58:22Z")

</div>

I pushed a fix for this now. While some of the use cases above still result in issues ([1](https://forum-next.cabbageaudio.com/t/edit-mode-destroys-source-code-windows-10-11/3769/13), [2](https://forum-next.cabbageaudio.com/t/edit-mode-destroys-source-code-windows-10-11/3769/9)), adding spaces or tabs to the starts of lines in order to create a better formatted document should no longer results in garbage. 👍 So @stefanv, you should be free to add as many tabs/spaces as you like from now on.

[Next page](https://forum.cabbageaudio.com/t/edit-mode-destroys-source-code-windows-10-11/3769.md?page=2)
