Loading ...
Sorry, an error occurred while loading the content.

Is GetParagraph misbehaving?

Expand Messages
  • Mark B.
    GetParagraph seems to be misbehaving. When this clip ^!Info [L]^$GetParagraph$ is tried on this text One Two Three the third paragraph isn t returned if it is
    Message 1 of 8 , Sep 1, 2006
    • 0 Attachment
      GetParagraph seems to be misbehaving. When this clip

      ^!Info [L]^$GetParagraph$

      is tried on this text

      One
      Two
      Three

      the third paragraph isn't returned if it is followed by a new line.
      When the paragraphs are separated like this

      One

      Two

      Three

      none of them is returned accurately.
      NoteTab Std 5.1
    • Sheri
      Hmn, it does look like a problem. And look what happens if the cursor is on an empty line at the bottom. It returns all the text. If the cursor is on an empty
      Message 2 of 8 , Sep 1, 2006
      • 0 Attachment
        Hmn, it does look like a problem. And look what happens if the
        cursor is on an empty line at the bottom. It returns all the text.
        If the cursor is on an empty line between paragraphs, looks like it
        returns all the text below the current position.

        OTH it looks like this behavior has been around for a long while,
        the same thing happens in 4.95 Light.

        Here's what I would do as a workaround:

        H="My GetParagraph"
        ^!Set %mywrap%=^$IsWordWrap$
        ^!SetWordWrap Off
        ^!Set %start%=^$GetRowStart$:^$GetColStart$
        ^!Set %end%=^$GetRowEnd$:^$GetColEnd$
        ^!Jump Line_Start
        ^!Select EOL
        ^!Info ^$GetSelection$
        ;or use ^!Info ^$GetSelection$^%NL%
        ;or set a variable if that's what's needed
        ^!SetCursor ^%start%
        ^!SelectTo ^%end%
        ^!SetWordWrap ^%mywrap%
        ^!ClearVariable %mywrap%
        ^!ClearVariable %start%
        ^!ClearVariable %end%
        ;end of clip

        Regards,
        Sheri

        --- In ntb-clips@yahoogroups.com, "Mark B." <breaumark@...> wrote:
        >
        > GetParagraph seems to be misbehaving. When this clip
        >
        > ^!Info [L]^$GetParagraph$
        >
        > is tried on this text
        >
        > One
        > Two
        > Three
        >
        > the third paragraph isn't returned if it is followed by a new line.
        > When the paragraphs are separated like this
        >
        > One
        >
        > Two
        >
        > Three
        >
        > none of them is returned accurately.
        > NoteTab Std 5.1
        >
      • Jody
        Hi Mark, I find that 4.95 and 5.1 work the same. It depends on where your cursor is to what is returned. My guess is you selected text forward in one test and
        Message 3 of 8 , Sep 1, 2006
        • 0 Attachment
          Hi Mark,

          I find that 4.95 and 5.1 work the same. It depends on where your
          cursor is to what is returned. My guess is you selected text
          forward in one test and backwards in another.

          >GetParagraph seems to be misbehaving. When this clip
          >
          >^!Info [L]^$GetParagraph$
          >
          >is tried on this text
          >
          >One
          >Two
          >Three
          >
          >the third paragraph isn't returned if it is followed by a new line.
          >When the paragraphs are separated like this
          >
          >One
          >
          >Two
          >
          >Three
          >
          >none of them is returned accurately.
          >NoteTab Std 5.1



          Happy Clip'n!
          Jody

          All Lists: http://www.fookes.us/maillist.htm
          Convert your eMail programs... Aid4Mail: http://www.fookes.us/aid4mail

          Freeware and Shareware; some seamleesly integrates with NoteTab:
          http://www.sojourner.us/software

          See ya in the funnies!-) http://www.clean-funnies.com
        • Mark B.
          ... Hi, Sheri. As far as I know, GetLine is always correct. So, I guess, whenever it is acceptable to turn off word wrap, GetLine will serve. --Mark
          Message 4 of 8 , Sep 1, 2006
          • 0 Attachment
            --- In ntb-clips@yahoogroups.com, "Sheri" <silvermoonwoman@...> wrote:
            >
            > Hmn, it does look like a problem. And look what happens if the
            > cursor is on an empty line at the bottom. It returns all the text.
            > If the cursor is on an empty line between paragraphs, looks like it
            > returns all the text below the current position.
            >
            > OTH it looks like this behavior has been around for a long while,
            > the same thing happens in 4.95 Light.
            >
            > Here's what I would do as a workaround:
            >
            > H="My GetParagraph"
            > ^!Set %mywrap%=^$IsWordWrap$
            > ^!SetWordWrap Off
            > ^!Set %start%=^$GetRowStart$:^$GetColStart$
            > ^!Set %end%=^$GetRowEnd$:^$GetColEnd$
            > ^!Jump Line_Start
            > ^!Select EOL
            > ^!Info ^$GetSelection$
            > ;or use ^!Info ^$GetSelection$^%NL%
            > ;or set a variable if that's what's needed
            > ^!SetCursor ^%start%
            > ^!SelectTo ^%end%
            > ^!SetWordWrap ^%mywrap%
            > ^!ClearVariable %mywrap%
            > ^!ClearVariable %start%
            > ^!ClearVariable %end%
            > ;end of clip
            >
            > Regards,
            > Sheri

            Hi, Sheri.
            As far as I know, GetLine is always correct. So, I guess, whenever it
            is acceptable to turn off word wrap, GetLine will serve.

            --Mark
          • Don - HtmlFixIt.com
            ... Hi Mark, It is almost always acceptable to turn off word wrap. Turn it off, run the clip, turn it back on. You simply record the state at the beginning
            Message 5 of 8 , Sep 1, 2006
            • 0 Attachment
              > Hi, Sheri.
              > As far as I know, GetLine is always correct. So, I guess, whenever it
              > is acceptable to turn off word wrap, GetLine will serve.
              >
              > --Mark

              Hi Mark,

              It is almost always acceptable to turn off word wrap. Turn it off, run
              the clip, turn it back on. You simply record the state at the beginning
              and return it to the pre-clip state when you are done.

              You can use this:
              ;use at top of clip
              ^!Set %word_wrap%=^$IsWordWrap$
              ^!SetWordWrap off

              ;use this at end of clip
              ^!SetWordWrap ^%word_wrap%

              Hope that is helpful,

              Don
            • Sheri
              ... I don t think that s true for shared clips where clip compatibility with earlier versions, and between Pro, Standard and Light is wanted. I know that
              Message 6 of 8 , Sep 1, 2006
              • 0 Attachment
                --- In ntb-clips@yahoogroups.com, "Mark B." <breaumark@...> wrote:
                > Hi, Sheri.
                > As far as I know, GetLine is always correct. So, I guess, whenever it
                > is acceptable to turn off word wrap, GetLine will serve.
                >
                > --Mark
                >

                I don't think that's true for shared clips where clip compatibility
                with earlier versions, and between Pro, Standard and Light is wanted.
                I know that ^$GetLine$ gave a different result between Pro and Light
                in earlier versions and that there was a change in ^$GetLine$ in 5.1
                Standard (which I haven't looked into yet).

                Regards,
                Sheri
              • Mark B.
                ... I don t think that s true for shared clips where clip compatibility ... Ok (but sheesh). Thanks. On the topic of compatibility and shared clips, I notice
                Message 7 of 8 , Sep 1, 2006
                • 0 Attachment
                  --- In ntb-clips@yahoogroups.com, "Sheri" <silvermoonwoman@...> wrote:
                  >
                  I don't think that's true for shared clips where clip compatibility
                  > with earlier versions, and between Pro, Standard and Light is wanted.
                  > I know that ^$GetLine$ gave a different result between Pro and Light
                  > in earlier versions and that there was a change in ^$GetLine$ in 5.1
                  > Standard (which I haven't looked into yet).
                  >
                  > Regards,
                  > Sheri

                  Ok (but sheesh). Thanks. On the topic of compatibility and shared
                  clips, I notice that ^$GetLibraryPath$ points to Libraries in the
                  install folder even when the libraries are in Application Data.
                • Sheri
                  ... In the new 5+ multiuser setup, libraries exist in both locations. ^$GetLibraryPath$ returns the one under the AppPath and ^$GetLibraryUserPath$ returns the
                  Message 8 of 8 , Sep 1, 2006
                  • 0 Attachment
                    --- In ntb-clips@yahoogroups.com, "Mark B." <breaumark@...> wrote:

                    >
                    > Ok (but sheesh). Thanks. On the topic of compatibility and shared
                    > clips, I notice that ^$GetLibraryPath$ points to Libraries in the
                    > install folder even when the libraries are in Application Data.

                    In the new 5+ multiuser setup, libraries exist in both locations.
                    ^$GetLibraryPath$ returns the one under the AppPath and
                    ^$GetLibraryUserPath$ returns the one under the DataPath. If you use
                    clipedit to edit one from the AppPath area, it gets saved in the
                    DataPath and is subsequently read from there. ^$GetLibraryPath
                    ("SampleCode")$ would tell you where the "live" version is (under
                    AppPath if unedited. under DataPath if user-edited and saved).

                    Regards,
                    Sheri

                    PS, ^!SelectLine also used to and (may still) work differently
                    between Std/Light and Pro.
                  Your message has been successfully submitted and would be delivered to recipients shortly.