Lines per "code" block

Found an issue with the phpBB system here at NESdev? Use this forum to report problems.

Moderator: Moderators

Post Reply
nocash
Posts: 1200
Joined: Fri Feb 24, 2012 12:09 pm
Contact:

Lines per "code" block

Post by nocash » Sun Jan 05, 2020 9:37 pm

The new theme is showing only 14 lines per "code" block, that's making it almost impossible to read the code without using an external text editor. Some ideas to fix that problem...

- show all code lines (as far as I remember the old theme worked that way)
- show 50 lines instead of 14 lines
- match number of lines to window height divided by font height (if that's possible)
- add an "expand" button to show all lines (might require java script though)
homepage - patreon - you can think of a bit as a bottle that is either half full or half empty

User avatar
rainwarrior
Posts: 7801
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Lines per "code" block

Post by rainwarrior » Sun Jan 05, 2020 10:31 pm

Yes, I agree that going back to showing all lines would be much more useful for this forum.

lidnariq
Posts: 9290
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: Lines per "code" block

Post by lidnariq » Sun Jan 05, 2020 11:14 pm

Here's a bookmarklet that will fix things on a page-by-page basis:

Code: Select all

javascript:(function(){for(var node of document.querySelectorAll(".codebox code")){node.style.maxHeight="100%";}})()
To instead fix the style, "content.css" has the following rule:

Code: Select all

.codebox code {
	overflow: auto;
	display: block;
	height: auto;
	max-height: 200px;
	padding: 10px 8px;
	font: 0.9em Monaco, "Andale Mono","Courier New", Courier, monospace;
	line-height: 1.3em;
}
and the "max-height" rule could just be removed.

User avatar
Quietust
Posts: 1551
Joined: Sun Sep 19, 2004 10:59 pm
Contact:

Re: Lines per "code" block

Post by Quietust » Mon Jan 06, 2020 6:41 pm

I'm not sure I see the problem - yes, it only displays 14 lines at once, but there's still a scrollbar at the right so you can see the rest of it (and there's a "SELECT ALL" so you can easily copy/paste it into your favourite editor). Honestly, I prefer it this way, because it means that when people post large chunks of 6502 sample code (i.e. hundreds of lines long), I don't have to scroll down for 10 seconds to get to the next post.
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.

User avatar
rainwarrior
Posts: 7801
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Lines per "code" block

Post by rainwarrior » Mon Jan 06, 2020 7:07 pm

Thanks lidnariq for the tip that this is a CSS property. I put this in CSS override plugin called Stylus to get unlimited code blocks:

Code: Select all

.codebox code {
    max-height: none;
}
Quietust wrote:
Mon Jan 06, 2020 6:41 pm
there's still a scrollbar at the right
I find this a pretty bad way to look at code. 14 lines is an extremely narrow view to try and understand what a piece of code is doing, especially when it's assembly. It hurts comprehension a lot.

I wouldn't mind a more complicated solution like collapse/expand buttons or some user option, or whatever, but this is a forum where a lot of code is shared, and much of the time being able to read it is essential to the content of the post.

Yes, sometimes people dump a big pile of useless code that should really be an attachment or a pastebin or something else, but personally I'd much rather have the occasional problem of scrolling past a long post than having a hard time reading all other code posts.

Post Reply