Copying Code examples from forum brings line numbers lazarus / 8-Other ---------------------------------------------------------------------- jamie · 2019-07-06 15:56 I use IE, maybe that is an issue but, when I select all of even use the option SELECT, all text except the numbers are selected, I copy it, then I paste it within the code window of laz but, all the line numbers come with it..  It does not matter If I paste in NotePad, the line numbers are still there.  What do you guys do to eliminate that issue ? ---------------------------------------------------------------------- Handoko · 2019-07-06 16:03 I use Pluma text editor. It will replace the line numbers with spaces but I still have to manually clean up the spaces. Luckily if I paste it to Lazarus source editor, all of the line numbers will be removed properly. In this case, Lazarus is smarter than any text editor I ever knew. ---------------------------------------------------------------------- Martin_fr · 2019-07-06 16:21 Use another browser... You can try to fix the script, but it needs to keep working under other browsers. (You can get it from your browsers debugger) Tested with (by copying to notepad++) Win10: Firefox, Chrome, Edge Win Vista: Opera, Safari And I do not plan to repeatedly test new attempts on fixing it. If you believe you have a working version, I will test it (once) and update if it works. And it also must be completely in the onclick tag of the link. I do not have access to modify other stuff. (That means it should not grow to much in size, since it repeats with every code block on the page) ---------------- If you have a solution that needs bigger changes you can post it. I can try to get the attention of the server admin. But he is a very busy person.... ---------EDIT Actually IIRC making it work (back then) was changing the display options of GESHI. I spent quite some hours testing... Anyway code is displayed using GESHI extension. And the JS is a modified copy of what the forum used before. ---------------------------------------------------------------------- jamie · 2019-07-06 18:08 Sounds like too much work to fix the forums,. I'll write a utility to remove the leading line numbers and have it hook into the clipboard monitor chain to clean it up automatically.  Thanks for the info..  I guess I could offer it up to the public when done but it will only work on windows, I don't know how to do this in Linux. ---------------------------------------------------------------------- 440bx · 2019-07-06 18:34 Quote from: Handoko on July 06, 2019, 06:03:51 pmLuckily if I paste it to Lazarus source editor, all of the line numbers will be removed properly. In this case, Lazarus is smarter than any text editor I ever knew. That is really interesting.  When I paste it into the Lazarus source editor, I get the line numbers. Does anyone know if removing the lines numbers is a "user selectable" option in Lazarus and is it a feature available in Lazarus 1.8.2 or does it require a later version ? Thanks. ---------------------------------------------------------------------- wp · 2019-07-06 18:44 Did anybody try to uncheck "Toggle View" above the forum editor or to uncheck the option "Show WYSIWIG editor by default" in the forum profile? When this feature is not active copy & paste between forum posts works fine for me, no line numbers when pasting source code. I can't say anything about line numbers when pasting into the IDE because I never observed this issue. ---------------------------------------------------------------------- kupferstecher · 2019-07-06 19:37 An other workaround: Quote the post and copy the code from the reply box. (I use Firefox and didn't encounter the described issue before.) ---------------------------------------------------------------------- Handoko · 2019-07-06 19:46 I tested it again, these are what I found: Copying code example from forum to Lazarus source editor didn't have any line number issue. Copying code example from forum to Pluma text editor, sometimes it replaces the line number with spaces but usually it automatically removes the line numbers correctly. Hmmm, need to inspect more. Copying code example from forum to forum (post reply), it has line number issue. But as wp mentioned, if the toggle view disabled, no line number issue. I'm using Lazarus 2.0.2 Linux GTK2, Pale Moon 28.6.01 web browser and Pluma 1.20.4 text editor. Below is the screenshot: pasted to Lazarus Source Editor  ---  original code in Pale Moon browser  ---  pasted to Pluma ---------------------------------------------------------------------- Peter H · 2019-07-06 19:57 Quick solution: Mark the spaces or numbers as a rectangular block in Notepad++ or Lazarus and delete them. ---------------------------------------------------------------------- 440bx · 2019-07-06 20:39 For some reason (likely because I'm not doing something right), so far, I have not been able to get the code without the line numbers. @wp My "Show WYSIWYG editor on post page by default. " is off/unchecked. Quote from: wp on July 06, 2019, 08:44:11 pmDid anybody try to uncheck "Toggle View" above the forum editor I don't see a "Toggle View" anywhere ... did I miss an elephant in the room again ? @kupferstecher Quote from: kupferstecher on July 06, 2019, 09:37:34 pmAn other workaround: Quote the post and copy the code from the reply box. (I use Firefox and didn't encounter the described issue before.) Unless something else works, I'll be using that. ---------------------------------------------------------------------- wp · 2019-07-06 20:47 Quote from: 440bx on July 06, 2019, 10:39:17 pmI don't see a "Toggle View" anywhere ... did I miss an elephant in the room again ? It's the last button, "[arrow]", in the second button row, below the "Change color" combo. ---------------------------------------------------------------------- 440bx · 2019-07-06 20:59 Quote from: wp on July 06, 2019, 10:47:17 pmQuote from: 440bx on July 06, 2019, 10:39:17 pmI don't see a "Toggle View" anywhere ... did I miss an elephant in the room again ? It's the last button, "[arrow]", in the second button row, below the "Change color" combo. Thank you.  I tried and I got the message "Your browser does not support Rich Text Editing".  I guess I am out of luck with that one. ---------------------------------------------------------------------- jamie · 2019-07-06 21:07 I just wrote up a simple app that hooks into the clipboard and I was able to filter out the line numbers This is the code block that did the actual editing of it. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Procedure TForm1.WmDrawClipBoard(Var M:Tmessage);Var  L,X:Integer;  S:String;Begin  SendMessage(NextClipBoardHandle,M.Msg,M.wParam,m.Lparam); //Pass it on..  If ClipBoard.HasFormat(CF_Text) Then  Begin   SynEdit1.Lines.Text :=  ClipBoard.AsText;   {Delete lines with nothing on them,only empty lines with numbers are valid }   For L := SynEdit1.Lines.Count-1 DownTo 0 do    if SynEdit1.Lines[L]='' Then SynEdit1.Lines.Delete(L);   For L := 0 to  SynEdit1.Lines.Count-1 do  Begin      S := SynEdit1.Lines[L];      X := 1;      While (X <= Length(S))and(S[X] in ['0'..'9','.']) Do Inc(X);      S := Copy(S,X,Length(S));      SynEdit1.Lines[L] := S;    end;end;End;                                              The next step is deciding if I should put the corrected version back on the clipboard automatically or use a button for this.. Hmm. ---------------------------------------------------------------------- jamie · 2019-07-06 21:50 This is the first time I've posted a publish project but here goes.