Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Permanently disable line wrapping in Stata 16 do-file editor

    We recently got Stata 16 installed on our server (a shared Linux box running Red Hat 7), and the new line-wrapping feature in the do-file editor is driving me crazy. There is almost no circumstance when I would want a code-editor to automatically wrap lines--even with very long commands, I'd much rather create manual line breaks (either with "///" or "#delimit ;") so that I can manage white-space and keep the code readable.

    The problem is that I can't get line wrapping to stay turned off. I can uncheck "Wrap lines" under the View menu, but then something will trigger the lines to wrap again. Oddly, opening up the Edit menu causes it to toggle back again. I've gone into the preferences menu (Edit>Preferences) and unchecked word wrapping there, but it doesn't seem to stick from one Stata session to the next (and even with line wrapping unchecked in preferences and the View menu, still sometimes it will toggle on briefly).

    Is there any way to set this behavior permanently off, perhaps in my user profile?
    Last edited by Ryan Sandler; 11 Dec 2019, 08:41.

  • #2
    In the Do File Editor -> Edit -> Preferences -> uncheck Wrap Lines. Restart Stata. This works as a permanent solution on my local machine, but maybe there's something special about a server installation?

    While I can appreciate that you find this behaviour annoying, from a practical perspective, lines that spill over beyond the visible area of the window are seldom helpful for debugging and hard to read. If you are already in the habit of writing code to flow over multiple lines (using /**/ comments, the /// syntax or changing the delimiter), then does there necessarily need to be a permanent solution? I myself do the same so that no line is longer than about 100 characters, which leaves me fully readable text even when my do-file editor occupies half of my screen area, and I've never had to encounter the wrapped line before.

    Comment


    • #3
      There previously was a bug that caused the line wrapping menu item to be toggled when the edit menu was opened, likely leading to your issue. This bug should be fixed as of Nov 05, 2019. Can you type
      Code:
      update query
      in your Stata session and verify that you have the latest update? I'm unable to reproduce the issue on our latest version.

      Note, the menu item in the view menu is for the current document, where the preferences dialog is global and is what's saved.

      Best,
      Chris Hassell

      Comment


      • #4
        Chris,

        Thanks for the response. It looks like our installation was last updated September 30 (I think that's when Stata 16 was installed on our system in the first place). Good to know the issue has been fixed; I'll follow up with my IT folks to see if we can get the latest update installed.

        Comment


        • #5
          Wanted to follow up on this. The crazy toggling of line wrapping was fixed by the version update recommended by Chris Hassell above (thanks Chris!) However, Stata still defaults to having line wrapping on every time I open up a new do-file editor. Not a huge issue, since at least once I turn it off it stays off, but I still would prefer to never have line wrapping turned on in my do-file editor. Is there a way to do this?

          Comment


          • #6
            Do you have a profile.do file? My guess is you could put the command in there.
            -------------------------------------------
            Richard Williams, Notre Dame Dept of Sociology
            StataNow Version: 19.5 MP (2 processor)

            EMAIL: [email protected]
            WWW: https://www3.nd.edu/~rwilliam

            Comment


            • #7
              Originally posted by Ryan Sandler View Post
              Wanted to follow up on this. The crazy toggling of line wrapping was fixed by the version update recommended by Chris Hassell above (thanks Chris!) However, Stata still defaults to having line wrapping on every time I open up a new do-file editor. Not a huge issue, since at least once I turn it off it stays off, but I still would prefer to never have line wrapping turned on in my do-file editor. Is there a way to do this?
              Is the global preference for line wrapping in Edit->Preferences toggled off? Any new editors you open will use that preference.

              Comment


              • #8
                Originally posted by Chris Hassell (StataCorp) View Post

                Is the global preference for line wrapping in Edit->Preferences toggled off? Any new editors you open will use that preference.
                Yes, I keep turning it off under Edit->Preferences, but every time I open a new session, it's back on. That's why I was hoping there was something I could put into my profile to make it consistent.

                Comment


                • #9
                  @Ryan, and you are hitting "Apply" after making that change? Do you have a fully updated copy of Stata (-update query-) ? This works for me on Windows with Stata 16.

                  Comment


                  • #10
                    Originally posted by Ryan Sandler View Post

                    Yes, I keep turning it off under Edit->Preferences, but every time I open a new session, it's back on. That's why I was hoping there was something I could put into my profile to make it consistent.
                    There are two possibilities that come to mind for why this may not be working:

                    First, we allow for different preference maps based on how you're connecting to your Unix machine. Can you do an ls in your .stata16 directory? Something like ls ~/.stata16/ should work. You should see :1/ and .user_prefs/. If you have more than a few directories there, then something may not be right in detecting what display you're connecting from.

                    What I would consider the more common case is as follows below:

                    When you turn the global preference off and hit 'Ok' or 'Apply', it applies the preference to all editors in that Stata session. Those preferences aren't saved to be used by future Stata sessions until you close the Stata session you changed the preference in. This can cause issues when you have multiple session open, because the last Stata session you close will overwrite any changed preferences from previous sessions.

                    Can you try these steps, specifically in this order:
                    1. Close all Stata sessions
                    2. Open one Stata session
                    3. Navigate to the do-file editor's preference dialog and change the "Wrap Lines" preference to unchecked/off
                    4. Click "Ok" and verify that it did toggle it off in your do-file editor session
                    5. Close your Stata session entirely
                    6. Open a new Stata session
                    7. Open a new do-file editor and verify that line wrapping is still off

                    Hope this helps,
                    Chris Hassell

                    Comment

                    Working...
                    X