Recent

Author Topic: Question about the forum software  (Read 1941 times)

440bx

  • Hero Member
  • *****
  • Posts: 3946
Question about the forum software
« on: April 28, 2020, 01:43:30 pm »
Hello,

When posting some code, the forum software provides a number of ways to "quote" the code depending on the language.

When the code sequence is longer than some number of lines (don't really know exactly how many), the code is put in a scrollable window.

The question is: is there a way to tell the forum software _not_ to use a scrollable window ?... that is, even if the code sequence is a hundred lines or more, to put in a "window" long enough to accommodate all the code, visible without having to scroll vertically ?

Thank you for your help.

(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9794
  • Debugger - SynEdit - and more
    • wiki
Re: Question about the forum software
« Reply #1 on: April 28, 2020, 01:48:07 pm »
There is no way to change the default size for the message you write.
The length is set in the forum admin.

However, the reader should be able to freely resize the box. So if someone is interested in the code, they can grow it as they see fit.

IMHO, this is better if the reader has the choice. Not everyone wants to read every code segment.

-- Edit:
Just tested again:
Edge and IE do not do that. (anymore?)

I thought I had tested all of them, but that is long ago

-- Edit
The div has the css "resize: vertical;". No idea why some browser do not acknowledge this.
« Last Edit: April 28, 2020, 01:56:11 pm by Martin_fr »

440bx

  • Hero Member
  • *****
  • Posts: 3946
Re: Question about the forum software
« Reply #2 on: April 28, 2020, 01:54:49 pm »
There is no way to change the default size for the message you write.
The length is set in the forum admin.
Quite reasonable.

However, the reader should be able to freely resize the box. So if someone is interested in the code, they can grow it as they see fit.
I've just tried and don't see any way that allows the user to resize the box.  Did I miss it ?

IMHO, this is better if the reader has the choice. Not everyone wants to read every code segment.
I agree that in the great majority of cases, it's better to leave that as "reader's choice".

Thank you Martin. :)

ETA:
got rid of the question as a result of your edit.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9794
  • Debugger - SynEdit - and more
    • wiki
Re: Question about the forum software
« Reply #3 on: April 28, 2020, 02:33:57 pm »
I added some js, to have a +/- button.

Let me know, if it works for you.

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: Question about the forum software
« Reply #4 on: April 28, 2020, 02:41:40 pm »
It works here, using Midori 0.5.8 in an Ubuntu 12.04 box, so it should work in any OS/browser newer than that. :D
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

440bx

  • Hero Member
  • *****
  • Posts: 3946
Re: Question about the forum software
« Reply #5 on: April 28, 2020, 02:43:54 pm »
I added some js, to have a +/- button.

Let me know, if it works for you.
Yes! it works, wonderful... thank you Martin :)
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: Question about the forum software
« Reply #6 on: April 28, 2020, 02:44:53 pm »
Hi!

It works with Firefox 33 (!!) on Debian 6.x

Winni

MarkMLl

  • Hero Member
  • *****
  • Posts: 6676
Re: Question about the forum software
« Reply #7 on: April 28, 2020, 02:53:49 pm »
I added some js, to have a +/- button.

Let me know, if it works for you.

Not sure I see it: what should I be looking for. FF 68.7 Debian 10 "Buster" x86_64.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9794
  • Debugger - SynEdit - and more
    • wiki
Re: Question about the forum software
« Reply #8 on: April 28, 2020, 03:01:04 pm »
Code: Text  [Select][+][-]
  1. Above this text,
  2. on the left is a link "select".
  3.  
  4. On the right
  5. there is a
  6. [ + ]
  7. symbol.
  8.  
  9. If you click it,
  10. the "code" box
  11. should expand,
  12. and no scrollbar
  13. should be needed.
  14.  
  15. It turns into a
  16. [ - ]
  17. to reduce size again.
  18.  
  19. It will also show, if there is no scrollbar. Well, that's life...
  20.  
  21. And it does not change between +/- if you resize the box, with the resize handle on the lower right.
  22. That is, if your browser allows resizing via such an handle.
  23. Which IE & Edge do not.
  24.  
  25. 1
  26. 2
  27. 3 (some lines to get a scrollbar)
  28. 4
  29. 5
  30. 6
  31. ....
  32.  
  33.  

Code: Text  [Select][+][-]
  1. Code box, without scroll bar
« Last Edit: April 28, 2020, 03:04:22 pm by Martin_fr »

Zoran

  • Hero Member
  • *****
  • Posts: 1829
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: Question about the forum software
« Reply #9 on: April 28, 2020, 03:02:37 pm »
This topic needs some code for testing this. :)
So, here is UTF8Trim function from LazUTF8:

Code: Pascal  [Select][+][-]
  1. function UTF8Trim(const s: string; Flags: TUTF8TrimFlags): string;
  2. var
  3.   p: PChar;
  4.   u: Cardinal;
  5.   StartP: PtrUInt;
  6.   l: Integer;
  7.   KeepAllNonASCII: boolean;
  8. begin
  9.   Result:=s;
  10.   if Result='' then exit;
  11.   KeepAllNonASCII:=[u8tKeepControlCodes,u8tKeepNoBreakSpaces]*Flags=[u8tKeepControlCodes,u8tKeepNoBreakSpaces];
  12.   if not (u8tKeepStart in Flags) then begin
  13.     // trim start
  14.     p:=PChar(Result);
  15.     repeat
  16.       l:=1;
  17.       case p^ of
  18.       #0:
  19.         if p-PChar(Result)=length(Result) then
  20.         begin
  21.           // everything was trimmed
  22.           exit('')
  23.         end else if u8tKeepControlCodes in Flags then
  24.           break;
  25.       ' ': ;
  26.       #10,#13:
  27.         if u8tKeepLineBreaks in Flags then
  28.           break;
  29.       #9:
  30.         if u8tKeepTabs in Flags then
  31.           break;
  32.       #1..#8,#11,#12,#14..#31,#127:
  33.         if u8tKeepControlCodes in Flags then
  34.           break;
  35.       #128..#255:
  36.         begin
  37.           if KeepAllNonASCII then break;
  38.           u:=UTF8CodepointToUnicode(p,l);
  39.           if (l<=1) then break; // invalid character
  40.           case u of
  41.           128..159, // C1 set of control codes
  42.           8206, 8207: // left-to-right, right-to-left mark
  43.             if u8tKeepControlCodes in Flags then break;
  44.           160,   // no break space
  45.           $2007, // figure space
  46.           $2026, // narrow no-break space
  47.           $FEFF: // zero with no-break space
  48.             if u8tKeepNoBreakSpaces in Flags then break;
  49.           else
  50.             break;
  51.           end;
  52.         end;
  53.       else
  54.         break;
  55.       end;
  56.       inc(p,l);
  57.     until false;
  58.     if p>PChar(Result) then begin
  59.       Result:=copy(Result,p-PChar(Result)+1,length(Result));
  60.       if Result='' then exit;
  61.     end;
  62.   end;
  63.  
  64.   if not (u8tKeepEnd in Flags) then begin
  65.     // trim end
  66.     p:=@Result[length(Result)];
  67.     repeat
  68.       case p^ of
  69.       #0:
  70.         if u8tKeepControlCodes in Flags then
  71.           break;
  72.       ' ': ;
  73.       #10,#13:
  74.         if u8tKeepLineBreaks in Flags then
  75.           break;
  76.       #9:
  77.         if u8tKeepTabs in Flags then
  78.           break;
  79.       #1..#8,#11,#12,#14..#31,#127:
  80.         if u8tKeepControlCodes in Flags then
  81.           break;
  82.       #128..#255:
  83.         begin
  84.           if KeepAllNonASCII then break;
  85.           StartP:=UTF8FindNearestCharStart(PChar(Result),length(Result),p-PChar(Result));
  86.           u:=UTF8CodepointToUnicode(PChar(Result)+StartP,l);
  87.           if (l<=1) then break; // invalid character
  88.           case u of
  89.           128..159, // C1 set of control codes
  90.           8206, 8207: // left-to-right, right-to-left mark
  91.             if u8tKeepControlCodes in Flags then break;
  92.           160,   // no break space
  93.           $2007, // figure space
  94.           $2026, // narrow no-break space
  95.           $FEFF: // zero with no-break space
  96.             if u8tKeepNoBreakSpaces in Flags then break;
  97.           else
  98.             break;
  99.           end;
  100.           p:=PChar(Result)+StartP;
  101.         end;
  102.       else
  103.         break;
  104.       end;
  105.       dec(p);
  106.     until p<PChar(Result);
  107.     // p is on last good byte
  108.     SetLength(Result,p+1-PChar(Result));
  109.   end;
  110. end;
  111.  

MarkMLl

  • Hero Member
  • *****
  • Posts: 6676
Re: Question about the forum software
« Reply #10 on: April 28, 2020, 03:19:56 pm »
Code: Text  [Select][+][-]
  1. Above this text,
  2. on the left is a link "select".
  3.  
  4. On the right
  5. there is a
  6. [ + ]
  7. symbol.
  8.  

Thanks Martin, appearance and operation confirmed. I was looking in the message quote/reply editor, not the original.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: Question about the forum software
« Reply #11 on: April 28, 2020, 04:01:58 pm »
Thank you Martin, a simple but helpful improvement.

Otto

  • Full Member
  • ***
  • Posts: 226
Re: Question about the forum software
« Reply #12 on: April 28, 2020, 05:58:20 pm »
Thank you Martin.

I tested your change, on Windows 10 64bit using the following browsers:
chromium-based Edge (new standard),
Internet Explorer 11,
Firefox,
Waterfox,
Basilisk,

worked correctly on each one.


I quote Zoran's post in ways to test a nested quote.
This topic needs some code for testing this. :)
So, here is UTF8Trim function from LazUTF8:

Code: Pascal  [Select][+][-]
  1. function UTF8Trim(const s: string; Flags: TUTF8TrimFlags): string;
  2. var
  3.   p: PChar;
  4.   u: Cardinal;
  5.   StartP: PtrUInt;
  6.   l: Integer;
  7.   KeepAllNonASCII: boolean;
  8. begin
  9.   Result:=s;
  10.   if Result='' then exit;
  11.   KeepAllNonASCII:=[u8tKeepControlCodes,u8tKeepNoBreakSpaces]*Flags=[u8tKeepControlCodes,u8tKeepNoBreakSpaces];
  12.   if not (u8tKeepStart in Flags) then begin
  13.     // trim start
  14.     p:=PChar(Result);
  15.     repeat
  16.       l:=1;
  17.       case p^ of
  18.       #0:
  19.         if p-PChar(Result)=length(Result) then
  20.         begin
  21.           // everything was trimmed
  22.           exit('')
  23.         end else if u8tKeepControlCodes in Flags then
  24.           break;
  25.       ' ': ;
  26.       #10,#13:
  27.         if u8tKeepLineBreaks in Flags then
  28.           break;
  29.       #9:
  30.         if u8tKeepTabs in Flags then
  31.           break;
  32.       #1..#8,#11,#12,#14..#31,#127:
  33.         if u8tKeepControlCodes in Flags then
  34.           break;
  35.       #128..#255:
  36.         begin
  37.           if KeepAllNonASCII then break;
  38.           u:=UTF8CodepointToUnicode(p,l);
  39.           if (l<=1) then break; // invalid character
  40.           case u of
  41.           128..159, // C1 set of control codes
  42.           8206, 8207: // left-to-right, right-to-left mark
  43.             if u8tKeepControlCodes in Flags then break;
  44.           160,   // no break space
  45.           $2007, // figure space
  46.           $2026, // narrow no-break space
  47.           $FEFF: // zero with no-break space
  48.             if u8tKeepNoBreakSpaces in Flags then break;
  49.           else
  50.             break;
  51.           end;
  52.         end;
  53.       else
  54.         break;
  55.       end;
  56.       inc(p,l);
  57.     until false;
  58.     if p>PChar(Result) then begin
  59.       Result:=copy(Result,p-PChar(Result)+1,length(Result));
  60.       if Result='' then exit;
  61.     end;
  62.   end;
  63.  
  64.   if not (u8tKeepEnd in Flags) then begin
  65.     // trim end
  66.     p:=@Result[length(Result)];
  67.     repeat
  68.       case p^ of
  69.       #0:
  70.         if u8tKeepControlCodes in Flags then
  71.           break;
  72.       ' ': ;
  73.       #10,#13:
  74.         if u8tKeepLineBreaks in Flags then
  75.           break;
  76.       #9:
  77.         if u8tKeepTabs in Flags then
  78.           break;
  79.       #1..#8,#11,#12,#14..#31,#127:
  80.         if u8tKeepControlCodes in Flags then
  81.           break;
  82.       #128..#255:
  83.         begin
  84.           if KeepAllNonASCII then break;
  85.           StartP:=UTF8FindNearestCharStart(PChar(Result),length(Result),p-PChar(Result));
  86.           u:=UTF8CodepointToUnicode(PChar(Result)+StartP,l);
  87.           if (l<=1) then break; // invalid character
  88.           case u of
  89.           128..159, // C1 set of control codes
  90.           8206, 8207: // left-to-right, right-to-left mark
  91.             if u8tKeepControlCodes in Flags then break;
  92.           160,   // no break space
  93.           $2007, // figure space
  94.           $2026, // narrow no-break space
  95.           $FEFF: // zero with no-break space
  96.             if u8tKeepNoBreakSpaces in Flags then break;
  97.           else
  98.             break;
  99.           end;
  100.           p:=PChar(Result)+StartP;
  101.         end;
  102.       else
  103.         break;
  104.       end;
  105.       dec(p);
  106.     until p<PChar(Result);
  107.     // p is on last good byte
  108.     SetLength(Result,p+1-PChar(Result));
  109.   end;
  110. end;
  111.  
Kind regards.

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2020
  • Former Delphi 1-7, 10.2 user
Re: Question about the forum software
« Reply #13 on: April 29, 2020, 01:59:47 pm »
Works fine on FreeBSD with SeaMonkey and macOS with Safari.

 

TinyPortal © 2005-2018