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: 1405
Joined: Fri Feb 24, 2012 12:09 pm
Contact:

Lines per "code" block

Post by nocash »

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: 8732
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Lines per "code" block

Post by rainwarrior »

Yes, I agree that going back to showing all lines would be much more useful for this forum.
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: Lines per "code" block

Post by lidnariq »

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: 1920
Joined: Sun Sep 19, 2004 10:59 pm
Contact:

Re: Lines per "code" block

Post by Quietust »

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: 8732
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Lines per "code" block

Post by rainwarrior »

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 pmthere'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