Results 1 to 7 of 7
Like Tree1Likes
  • 1 Post By pbrockway2

Thread: lines truncated in code formatting

  1. #1
    zweibieren is offline Senior Member
    Join Date
    Aug 2009
    Location
    Pittsburgh, PA
    Posts
    284
    Rep Power
    6

    Default lines truncated in code formatting

    When I view posts with code lines, they are truncated on the right.
    I can copy/paste to see the entire line, but this is not a general solution.

    Have I missed an option setting?

    Fred Hansen

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default Re: lines truncated in code formatting

    I think that this is a constraint (feature?) of the forum software, and so you probably can't change this by futzing with some setting.

    -----
    But on the other hand, if your line is that long, shouldn't it be broken up anyway if just for readability if not to also conform with Java coding standards?

  3. #3
    zweibieren is offline Senior Member
    Join Date
    Aug 2009
    Location
    Pittsburgh, PA
    Posts
    284
    Rep Power
    6

    Default Re: lines truncated in code formatting

    The problem occurs when I try to READ posts. I can fix the posts I write; but fixing those I read is another story. I've only read a dozen posts and the problem occurred in at least two of them.

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default Re: lines truncated in code formatting

    Quote Originally Posted by zweibieren View Post
    The problem occurs when I try to READ posts. I can fix the posts I write; but fixing those I read is another story. I've only read a dozen posts and the problem occurred in at least two of them.
    If you copy the code and paste it into a basic word processor, code editor (i.e., Notepad++), or IDE, you'll see that the truncated lines still exist and can be seen and manipulated. I know that it's a kludge, but until there's a better solution, I think that this is the best option we've got.

  5. #5
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,423
    Rep Power
    25

    Default Re: lines truncated in code formatting

    Try your browser's zoom out (CTRL -). Making the font smaller makes more of the text viewable.

  6. #6
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,565
    Rep Power
    12

    Default Re: lines truncated in code formatting

    I can make the code wrap by putting the following line

    Java Code:
    .syntaxhighlighter .line {white-space: normal !important;}
    into the file %APPDATA%\Mozilla\Firefox\Profiles\<some string>.default\chrome\userContent.css

    The file didn't exist: I had to put it there based on the example .css which was in that folder. Following a restart FF displayed an oversized code post with wrapping.

    I have never had to mess with the browser's stylesheet before, but I imagine something similar can be done with other browsers. In fact I use Chrome mostly, but FF had more easily found instructions about how to do this. Someone cleverer than me could probably come up with a version that is site specific, but I'm guessing ".syntaxhighlighter .line" won't be encountered much. And if it is it will be syntax highlighted code where I *want* normal wrapping behaviour.
    DarrylBurke likes this.

  7. #7
    zweibieren is offline Senior Member
    Join Date
    Aug 2009
    Location
    Pittsburgh, PA
    Posts
    284
    Rep Power
    6

    Default Re: lines truncated in code formatting

    After too many restarts of Firefox:

    Using zoom-out makes the hidden trailing text visible, but, alas, unreadably small. Besides the goal should not be to fix me. Rather, it is preferable to solve the problem for all users by fixing the interaction between syntaxhighlighter and the code that decides to justify the text to a short line width. (When a post is short, justification is avaoided and the syntax highlighter does not truncate lines.)

    The Chrome/CSS hack worked a little. Lines were truncated, but a trailing end was on the overflow line. The trailing end did NOT include all the truncated text. And when lines wrapped, the line numbers got out of sync.

    I was once able to change the background color with css (for .syntaxhighlighter .line.alt1). But then this stopped working.

    I appreciate the responders efforts to solve the problem for me, but I am not the only user.

Similar Threads

  1. Code formatting Issue
    By camickr in forum Suggestions & Feedback
    Replies: 21
    Last Post: 10-08-2011, 04:19 PM
  2. Formatting Java Code
    By DoubleDee in forum Advanced Java
    Replies: 5
    Last Post: 09-18-2010, 10:33 PM
  3. Need help formatting output and some code
    By A5i19 in forum New To Java
    Replies: 6
    Last Post: 11-09-2009, 04:58 AM
  4. Unify these 3 lines of code
    By ulykidjoe in forum Advanced Java
    Replies: 4
    Last Post: 07-13-2007, 01:15 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •