Pasting line of code indents, why? lazarus / 9-Editor ---------------------------------------------------------------------- BosseB · 2020-02-15 07:41 I want to paste a line,which should be at the left edge of the code window. But when I paste it Lazarus indents the line no matter how I do it, and it will indent to a far right position, why? And is there a possibility to change this? I am on Raspberry Pi 4 with a fully updated Raspbian Buster operating system. FPC 3.0.4 and Lazarus 2.0.6 both built from sources checked out on the release tags. ---------------------------------------------------------------------- Thaddy · 2020-02-15 07:53 I can not reproduce this (tested on a RPi3 and a RPi4, Laz trunk 2.1 r62630, FPC Trunk r44177, Buster up-to-date) Is it just one copy/paste from a particular string or does it always behave like that with any copy/paste? ---------------------------------------------------------------------- BosseB · 2020-02-15 08:59 OK, let me exemplify, the example is pretty daft code-wise but shows the unwanted indentation: I have a section of code looking like this: 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 begin  Result := false;  try    sCmdDir := ReadIniString('configuration', 'cmddir', '/monitorctrl/cmd', sCnfFile);    FL.Clear;    if DirectoryExists(sCmdDir) then    begin      //Now list the files in the cmd dir with extension .cmd      slCmdFiles := TStringList.Create; Now I want to paste a line containing a debug variable (deb_pos := 3;) into the code further down, so I select the line and Ctrl-C then place the cursor at the left margin of where I want to insert the line and Ctrl-V to paste it. I want it to be in the left margin so it easier to see when it is finally going to be removed... But now the result looks like this: 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 begin  Result := false;  try    sCmdDir := ReadIniString('configuration', 'cmddir', '/monitorctrl/cmd', sCnfFile);    FL.Clear;    if DirectoryExists(sCmdDir) then    begin      //Now list the files in the cmd dir with extension .cmd      deb_pos := 3;      slCmdFiles := TStringList.Create; It should have looked like this: 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 begin  Result := false;  try    sCmdDir := ReadIniString('configuration', 'cmddir', '/monitorctrl/cmd', sCnfFile);    FL.Clear;    if DirectoryExists(sCmdDir) then    begin      //Now list the files in the cmd dir with extension .cmddeb_pos := 3;      slCmdFiles := TStringList.Create; In other cases with more complex statements and where I want to add something non-indented it is pushed right a long way. And when I want to back it out using backspace key it just moves one position at a time rather than moving left by a tab size or even to the start position of the previous line... In Delphi this worked a lot more "naturally". I assume there is a CodeTools setting I have missed like how to set the Ctrl-Click move to the implementation if one does it on a function name (which I finally found after googling)... ---------------------------------------------------------------------- Thaddy · 2020-02-15 09:11 If I make sure the cursor is at the begin of the line, the paste is also at the begin. Otherwise it is a feature, because in 99% of the cases you would want that behavior. (Auto indentation) ---------------------------------------------------------------------- Hartmut · 2020-02-15 09:46 I often have the same problem. In Lazarus editor I place the cursor at the beginning of a line and then press CTRL-V to paste something there, but it's indented to the position, where the next line above starts. Mostly I face this when I have e.g. the following in my clipboard: 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 {$IFDEF LINUX} {$ELSE} {$ENDIF}which I often steal from somewhere and I always want to have it at the beginnig of the lines. But often it is indented to the position, where the next line above starts and I have to move back all 3 lines to the beginning. Very annoying. But it's not always! I swear I had it often in Lazarus 1.8.4 and 2.0.6, both in Windows 7 and Ubuntu 18.04. Just now I tried to reproduce it in Lazarus 1.8.4 and 2.0.6 and it never happened. Very strange. In the past I tried several times to find a setting to disable this, but didn't find something and gave up. Would be very happy, if someone knows to disable this. ---------------------------------------------------------------------- howardpc · 2020-02-15 10:49 The IDE Options dialog has a   Codetools      General node/page which in the Indentation for Pascal sources section has a checkbox option     On paste from clipboard ---------------------------------------------------------------------- BosseB · 2020-02-15 11:58 Thanks! I unchecked the On Paste From Clipboard item and now the paste stays where I put it! ---------------------------------------------------------------------- Hartmut · 2020-02-16 12:59 For me it works too. Thanks a lot to howardpc.