Old 07-02-2019, 04:28 AM   #1
Dafarkias
Human being with feelings
 
Dafarkias's Avatar
 
Join Date: Feb 2019
Location: England
Posts: 293
Default How to change the ReaScript Compiler indent amount?

Just a quick question:

One one or two of my scripts, when I edit them in the ReaScript compiler, I press 'tab' and the indent amount is double the usual amount. I actually like it. I'm thinking that I probably accidentally hit some combination of keys that increased the indent percentage, and I would like to be able to duplicate this action.

Any help would be great!

Signed,

Dafarkias Wominus Maxipadus (the 3rd)
Dafarkias is offline   Reply With Quote
Old 07-02-2019, 12:44 PM   #2
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 1,646
Default

Can you send me those scripts? I'll look into that and see, if I canfind that out...
__________________
Ultraschall-API - a Lua-functions-library4Reaper: https://forum.cockos.com/showthread....98#post2067798
Reaper Internals - Developerdocs4Reaper: https://forum.cockos.com/showthread.php?t=207635
mespotine is offline   Reply With Quote
Old 07-02-2019, 02:05 PM   #3
Dafarkias
Human being with feelings
 
Dafarkias's Avatar
 
Join Date: Feb 2019
Location: England
Posts: 293
Default

Quote:
Originally Posted by mespotine View Post
Can you send me those scripts? I'll look into that and see, if I canfind that out...
Sure!

I wish I had details I could provide you with, but unfortunately I don't...

The script I've included is one of the scripts I have where when I press the 'tab' key, it creates an indent equivalent to two normal 'tab' presses in ReaScript. I have no idea if this behavior will follow the script over to you upon download, but I could always record a ultra-short video displaying this behavior--I just kinda assumed a more experienced REAPER scripter might have encountered this before.
Dafarkias is offline   Reply With Quote
Old 07-02-2019, 02:17 PM   #4
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 1,646
Default

On which most recent Reaper-version could you find this behavior?
__________________
Ultraschall-API - a Lua-functions-library4Reaper: https://forum.cockos.com/showthread....98#post2067798
Reaper Internals - Developerdocs4Reaper: https://forum.cockos.com/showthread.php?t=207635
mespotine is offline   Reply With Quote
Old 07-02-2019, 02:20 PM   #5
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 1,646
Default

Confirmed, works here as well!

I see, if I can nail it down. Probably some kind of UTF8-thingy...
__________________
Ultraschall-API - a Lua-functions-library4Reaper: https://forum.cockos.com/showthread....98#post2067798
Reaper Internals - Developerdocs4Reaper: https://forum.cockos.com/showthread.php?t=207635
mespotine is offline   Reply With Quote
Old 07-02-2019, 02:24 PM   #6
Dafarkias
Human being with feelings
 
Dafarkias's Avatar
 
Join Date: Feb 2019
Location: England
Posts: 293
Default

Quote:
Originally Posted by mespotine View Post
On which most recent Reaper-version could you find this behavior?
On the newest non-beta--5.979.

It was also doing it with the last two versions though... Only for the certain scripts (like the one I sent you) but never any others. That's why I kinda just assumed that I had accidentally pressed some kinda key-combination that changes the indent-strength of ReaScript.

Quote:
Originally Posted by mespotine View Post
Confirmed, works here as well!

I see, if I can nail it down. Probably some kind of UTF8-thingy...
That's wild! I actually kinda assumed it wouldn't carry over.. I'm glad it did though..
Dafarkias is offline   Reply With Quote
Old 07-02-2019, 02:26 PM   #7
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 1,646
Default

Do you always use the built-in-IDE? Or do you also use another editor?
__________________
Ultraschall-API - a Lua-functions-library4Reaper: https://forum.cockos.com/showthread....98#post2067798
Reaper Internals - Developerdocs4Reaper: https://forum.cockos.com/showthread.php?t=207635
mespotine is offline   Reply With Quote
Old 07-02-2019, 02:32 PM   #8
Dafarkias
Human being with feelings
 
Dafarkias's Avatar
 
Join Date: Feb 2019
Location: England
Posts: 293
Default

Quote:
Originally Posted by mespotine View Post
Do you always use the built-in-IDE? Or do you also use another editor?
For a while I was using Notepad++, which I think is better overall, but lately I've just been using the ReaScript compiler, I think it's kinda convenient.

Really, probably one of my top gripes for the built-in IDE would be the small indent size, which is why I thought it would be cool if it could be figured out to how change it's default amount.

I can't remember if I ever used the Notepad++ on the specific script I included in this post, I think that I probably would have.
Dafarkias is offline   Reply With Quote
Old 07-02-2019, 02:35 PM   #9
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 1,646
Default

Ok, my current finding: it has something to do, with the way the file was encoded.

The following part

Quote:

--Find the point/position (sample) in which multiple audio tracks conjunctively contain the lowest signal point in a time selection of audio
(which will hereafter be reffered to as the "zero-cross"). The script can either end after this step, or continue on to the next portion
at the user's leisure.
triggers this effect, if it's stored in NotePad++
Means, I deleted as much as I could from the file and somewhere in these lines, the trigger is existing.
It's lost, when I copy these lines into a new script.

Will look further into the binary-representation of the files.
__________________
Ultraschall-API - a Lua-functions-library4Reaper: https://forum.cockos.com/showthread....98#post2067798
Reaper Internals - Developerdocs4Reaper: https://forum.cockos.com/showthread.php?t=207635
mespotine is offline   Reply With Quote
Old 07-02-2019, 02:40 PM   #10
Dafarkias
Human being with feelings
 
Dafarkias's Avatar
 
Join Date: Feb 2019
Location: England
Posts: 293
Default

Quote:
Originally Posted by mespotine View Post
Ok, my current finding: it has something to do, with the way the file was encoded.

The following part



triggers this effect, if it's stored in NotePad++
Means, I deleted as much as I could from the file and somewhere in these lines, the trigger is existing.
It's lost, when I copy these lines into a new script.

Will look further into the binary-representation of the files.
Huh!

You are incredible. I feel like a caveman with a stick when I use a computer.
Dafarkias is offline   Reply With Quote
Old 07-02-2019, 02:45 PM   #11
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 1,646
Default

Ok, here's my theory.

Reaper itself stores tabs using two spaces. But if Reaper finds a normal tab in there, it will alter the way the tab-key works to four spaces.

I think it has probably something to do with the basic features of the IDE to make indenting text easy to do in the style the code was written with an earlier editor. Two spaces when completely written using solely the ReaScript-IDE, or 4 spaces, when written with another editor supporting tabs.

That means: add a tab(using NotePad++) into the script and re-load it in ReaScript.
Voila: Tab is 4 spaces long, not 2.

Edit: experiment with the attached file. Should work.
Attached Files
File Type: lua testtab.lua (10 Bytes, 11 views)
__________________
Ultraschall-API - a Lua-functions-library4Reaper: https://forum.cockos.com/showthread....98#post2067798
Reaper Internals - Developerdocs4Reaper: https://forum.cockos.com/showthread.php?t=207635
mespotine is offline   Reply With Quote
Old 07-02-2019, 02:47 PM   #12
Dafarkias
Human being with feelings
 
Dafarkias's Avatar
 
Join Date: Feb 2019
Location: England
Posts: 293
Default

Quote:
Originally Posted by mespotine View Post
Ok, here's my theory.

Reaper itself stores tabs using two spaces. But if Reaper finds a normal tab in there, it will alter the way the tab-key works to four spaces.

I think it has probably something to do with the basic features of the IDE to make indenting text easy to do in the style the code was written with an earlier editor.

That means: add a tab(using NotePad++) into the script and re-load it in ReaScript.
Voila: Tab is 4 spaces long, not 2.

Edit: experiment with the attached file. Should work.
Ha! Thank you!

You are a genius.
Dafarkias is offline   Reply With Quote
Old 07-02-2019, 02:50 PM   #13
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 1,646
Default

Thanks to you for pointing this out. Didn't know that of the IDE in the first place.
Might be helpful for others as well.
__________________
Ultraschall-API - a Lua-functions-library4Reaper: https://forum.cockos.com/showthread....98#post2067798
Reaper Internals - Developerdocs4Reaper: https://forum.cockos.com/showthread.php?t=207635
mespotine is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 05:37 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.