Temporary Forum Oddities
#81
(06-22-2023, 11:39 PM)TerryRitchie Wrote:
(06-22-2023, 05:01 PM)RhoSigma Wrote:
(06-22-2023, 03:41 PM)TerryRitchie Wrote: Just that nagging slight misalignment.

That's interresting, that would imply it's already missaligned by the code formatter in the IDE as I only insert bbcode on what the IDE gives me, but you're sure it's well aligned right before you export it?
Huh
Yes, everything is aligned.

Could you share the original code then (but as attachement .zip, not in a codebox) so I have the original state of alignment to experiment/check with. Because copying from the codebox takes over the misalignment.
Reply
#82
(06-23-2023, 06:55 AM)RhoSigma Wrote:
(06-22-2023, 11:39 PM)TerryRitchie Wrote:
(06-22-2023, 05:01 PM)RhoSigma Wrote: That's interresting, that would imply it's already missaligned by the code formatter in the IDE as I only insert bbcode on what the IDE gives me, but you're sure it's well aligned right before you export it?
Huh
Yes, everything is aligned.

Could you share the original code then (but as attachement .zip, not in a codebox) so I have the original state of alignment to experiment/check with. Because copying from the codebox takes over the misalignment.
Sure, attached below.


Attached Files
.zip   Subs_Functions.zip (Size: 1.09 KB / Downloads: 14)
Software and cathedrals are much the same — first we build them, then we pray.
QB64 Tutorial
Reply
#83
(06-23-2023, 01:41 PM)TerryRitchie Wrote:
(06-23-2023, 06:55 AM)RhoSigma Wrote:
(06-22-2023, 11:39 PM)TerryRitchie Wrote: Yes, everything is aligned.

Could you share the original code then (but as attachement .zip, not in a codebox) so I have the original state of alignment to experiment/check with. Because copying from the codebox takes over the misalignment.
Sure, attached below.

Thanks Terry, so my tests show the exports go well aligned from the IDE into the clipboard and remain aligned when pasted into the post. I checked that by pasting the export into this post and then immediately copied it back from here into a text file and compared to the original export. This was my first guess, that the clipboard is messing up things, because the IDE uses ANSI mode for the clipboard while the browser is using UNICODE mode and the clipboard usually autoconverts between both as needed. So that's not the problem, however as soon as you save a post and display it, any multi-space sequence e.g. 0x20202020 is converted to 0xa020a020, hence every 1st space is converted into a non-breaking space. If this already happens while saving the post (i.e. the converted version gets saved in the forum database) or just happens on the fly on a later recalls of the post for display or further edits (i.e. the DB entry would be correct and just wrong recalled) that only @grymmjack can find out.

However, why a non-breaking space vs. a regular space causes different alignment is another mystery to me. IMO both should simply display the same width space.
Reply
#84
What I've found guys, is that by pasting and saving the post with source edit mode enabled CTRL-SHIFT-S then paste, then save. It honors whitespace as-is.
grymmjack (gj!)
GitHubYouTube | Soundcloud | 16colo.rs
Reply
#85
(06-24-2023, 02:53 PM)grymmjack Wrote: What I've found guys, is that by pasting and saving the post with source edit mode enabled CTRL-SHIFT-S then paste, then save. It honors whitespace as-is.

Is that before using the IDE File Export (copy to clipboard) or before pasting clipboard into Forum editor?
b = b + ...
Reply
#86
Is there any way to have code forum posts preserve all ASCII characters in the 32 to 255 range? For example, often times in my code I'll comment depictions of formulas as ASCII art in my code. I usually embed extended ASCII characters in them for readability. The code box below shows the result of this, versus the picture I included showing what it actually looks like.

Code: (Select All)
SUB Rotate (vec AS Type_Vector2, angleDeg AS SINGLE, origin AS Type_Vector2)
    ' Rotate a point around an origin using linear transformations.
    '
    '                                                       Rotating from (x,y) to (x',y')          |
    ' |                    (x',y')                            : L = R cosé                          | All of this shows how to get to this
    ' |                      ù                              : A = x'                              |                          -----------
    ' |                      /.\                              : B = L cosè = R cosè cosé = x cosé    |                                |
    ' |                    / .è\                            : (note - * opposite angles are equal) |                                |
    ' |                    /  .  \                            : C = R siné                          |                          +----+
    ' |                  /  .  \                          : D = C sinè = R sinè siné = y siné    |                          |
    ' |                  /    .    \                          : Y = R sinè                          |                          |
    ' |                /    .    \C                        : X = r cosè                          |                          
    ' |                /      .      \                                    __                          |                  -----------------
    ' |              /      .      \  L stops            : x' = B - |AB| = X cosé - Y siné      |                          
    ' |              /        .        \  here
    ' |            /        .        \  |                All of this just to show how to get from x to x' using      (X cosé - Y siné)
    ' |            /          .          \  |                Use the same linear transformation methods to get y' using  (X siné + Y cosé)
    ' |          R/          .          \ |
    ' |          /            .¿    D      \                Change the origin point of all rotations to (0,0) by subtracting the current
    ' |        /            .------------âù_--ù (x,y)      origin point from the current vector length. Add it back when rotation is
    ' |        /              .        __--.  .            completed.
    ' |      /              . *  __--    .  .
    ' |      /                . __--        .  .
    ' |    /            L __--            .  .
    ' |    /            __--  .            .  .Y
    ' |  /        __--    * .            .  .
    ' |  /      __--          .            .  .
    ' | / é __--              .            .  .
    ' |/__-- è              â.            .  .
    ' ù-----------------------ù-------------ù---ù------------
    '                        A            B
    ' |------------------- X -------------------|
    DIM x AS SINGLE
    DIM y AS SINGLE
    DIM __cos AS SINGLE
    DIM __sin AS SINGLE
    DIM xPrime AS SINGLE
    DIM yPrime AS SINGLE
    x = vec.x - origin.x '                move rotation vector origin to 0
    y = vec.y - origin.y
    __cos = COS(_D2R(angleDeg)) '        get cosine and sine of angle
    __sin = SIN(_D2R(angleDeg))
    xPrime = (x * __cos) - (y * __sin) '  calculate rotated location of vector
    yPrime = (x * __sin) + (y * __cos)
    xPrime = xPrime + origin.x '          move back to original origin
    yPrime = yPrime + origin.y
    vec.x = xPrime '                      pass back rotated vector
    vec.y = yPrime
END SUB


Attached Files Image(s)
   
Software and cathedrals are much the same — first we build them, then we pray.
QB64 Tutorial
Reply
#87
(06-24-2023, 04:45 PM)TerryRitchie Wrote: Is there any way to have code forum posts preserve all ASCII characters in the 32 to 255 range? For example, often times in my code I'll comment depictions of formulas as ASCII art in my code. I usually embed extended ASCII characters in them for readability. The code box below shows the result of this, versus the picture I included showing what it actually looks like.

Code: (Select All)
SUB Rotate (vec AS Type_Vector2, angleDeg AS SINGLE, origin AS Type_Vector2)
    ' Rotate a point around an origin using linear transformations.
    '
    '                                                       Rotating from (x,y) to (x',y')          |
    ' |                    (x',y')                            : L = R cosé                          | All of this shows how to get to this
    ' |                      ù                              : A = x'                              |                          -----------
    ' |                      /.\                              : B = L cosè = R cosè cosé = x cosé    |                                |
    ' |                    / .è\                            : (note - * opposite angles are equal) |                                |
    ' |                    /  .  \                            : C = R siné                          |                          +----+
    ' |                  /  .  \                          : D = C sinè = R sinè siné = y siné    |                          |
    ' |                  /    .    \                          : Y = R sinè                          |                          |
    ' |                /    .    \C                        : X = r cosè                          |                          
    ' |                /      .      \                                    __                          |                  -----------------
    ' |              /      .      \  L stops            : x' = B - |AB| = X cosé - Y siné      |                          
    ' |              /        .        \  here
    ' |            /        .        \  |                All of this just to show how to get from x to x' using      (X cosé - Y siné)
    ' |            /          .          \  |                Use the same linear transformation methods to get y' using  (X siné + Y cosé)
    ' |          R/          .          \ |
    ' |          /            .¿    D      \                Change the origin point of all rotations to (0,0) by subtracting the current
    ' |        /            .------------âù_--ù (x,y)      origin point from the current vector length. Add it back when rotation is
    ' |        /              .        __--.  .            completed.
    ' |      /              . *  __--    .  .
    ' |      /                . __--        .  .
    ' |    /            L __--            .  .
    ' |    /            __--  .            .  .Y
    ' |  /        __--    * .            .  .
    ' |  /      __--          .            .  .
    ' | / é __--              .            .  .
    ' |/__-- è              â.            .  .
    ' ù-----------------------ù-------------ù---ù------------
    '                        A            B
    ' |------------------- X -------------------|
    DIM x AS SINGLE
    DIM y AS SINGLE
    DIM __cos AS SINGLE
    DIM __sin AS SINGLE
    DIM xPrime AS SINGLE
    DIM yPrime AS SINGLE
    x = vec.x - origin.x '                move rotation vector origin to 0
    y = vec.y - origin.y
    __cos = COS(_D2R(angleDeg)) '        get cosine and sine of angle
    __sin = SIN(_D2R(angleDeg))
    xPrime = (x * __cos) - (y * __sin) '  calculate rotated location of vector
    yPrime = (x * __sin) + (y * __cos)
    xPrime = xPrime + origin.x '          move back to original origin
    yPrime = yPrime + origin.y
    vec.x = xPrime '                      pass back rotated vector
    vec.y = yPrime
END SUB

Unfortunately not with Forum codeboxes or Wiki examples.

Why?

Because the IDE uses ANSI codepages, hence to get all chars displayed correctly in the Forum/Wiki webpages it would require the extended ASCII chars (128-255) to be encoded as UTF-8. That's actually what is done when exporting to a HTML/RTF document, as those are usually not copied back to the IDE.

However, doing that for the Forum/Wiki exports would actually display those chars correctly in the browser, but if someone uses the 'Select all' button to copy and paste the examples back into the IDE these UTF chars are not converted back to the IDE codepage representation, i.e. the chars would then be wrong in the IDE and could lead to syntax errors.

As the intention of codeboxes/wiki examples is, that people can easily copy/paste the code to try it out, I've waived to the UTF-8 encoding here, but that causes the chars to be displayed wrong in the browser. However, when selected and copied back into the IDE they are right again.
Reply
#88
(06-24-2023, 02:53 PM)grymmjack Wrote: What I've found guys, is that by pasting and saving the post with source edit mode enabled CTRL-SHIFT-S then paste, then save. It honors whitespace as-is.

That's absolutly right, but when you then edit the post and save it again, then it's messed up.
Reply
#89
(06-24-2023, 07:34 PM)RhoSigma Wrote:
(06-24-2023, 02:53 PM)grymmjack Wrote: What I've found guys, is that by pasting and saving the post with source edit mode enabled CTRL-SHIFT-S then paste, then save. It honors whitespace as-is.

That's absolutly right, but when you then edit the post and save it again, then it's messed up.

It seemed to work with my _Hypot code post, all the lines ended just right! I had edited out the first code post to try Ctrl+Shift+S.
https://staging.qb64phoenix.com/showthre...9#pid17129
b = b + ...
Reply
#90
(06-24-2023, 09:29 PM)bplus Wrote:
(06-24-2023, 07:34 PM)RhoSigma Wrote:
(06-24-2023, 02:53 PM)grymmjack Wrote: What I've found guys, is that by pasting and saving the post with source edit mode enabled CTRL-SHIFT-S then paste, then save. It honors whitespace as-is.

That's absolutly right, but when you then edit the post and save it again, then it's messed up.

It seemed to work with my _Hypot code post, all the lines ended just right! I had edited out the first code post to try Ctrl+Shift+S.
https://staging.qb64phoenix.com/showthre...9#pid17129

Ok, and what happens if you edit the post not touching the codebox, but just changing something in the regular post text and then save again?

That's what caused me misalignment in the code.
Reply




Users browsing this thread: 28 Guest(s)