The replit editor soft wrap starts wrapped lines at far left instead of auto-indenting

In the below code, it would be much better (it seems to me) if the second and subsequent wrapped lines in line 4 and in line 6 were indented to start below the print as they do in line 1.

Can this be done? The editor ‘Wrapping’ setting for this code is ‘soft wrap’.

1   print("Hello there, how are you? I'm writing this as a big paragraph to see how it indents. Not 
     very well I'm afraid, but then again it could be worse.")
2   first,last = input("Name (First Last)? ").split()
3   if first == "bob":
4       print("Hello there, how are you? I'm writing this as a big  paragraph to see how it indents. Not 
     very well I'm afraid, but then again it could be worse.")	
 5	  if last == "wob":
	      print("Hello there, how are you? I'm writing this as a big paragraph to see how it indents.   
    Not very well I'm afraid, but then again it could be worse.")
1 Like

Sorry, line 6 didn’t have a line number:

In the below code, it would be much better (it seems to me) if the second and subsequent wrapped lines in line 4 and in line 6 were indented to start below the print as they do in line 1.

Can this be done? The editor ‘Wrapping’ setting for this code is ‘soft wrap’.

1   print("Hello there, how are you? I'm writing this as a big paragraph to see how it indents. Not 
     very well I'm afraid, but then again it could be worse.")
2   first,last = input("Name (First Last)? ").split()
3   if first == "bob":
4       print("Hello there, how are you? I'm writing this as a big  paragraph to see how it indents. Not 
     very well I'm afraid, but then again it could be worse.")	
5	  if last == "wob":
6	      print("Hello there, how are you? I'm writing this as a big paragraph to see how it indents.   
    Not very well I'm afraid, but then again it could be worse.")

Hi @warflyer , welcome to the forums!
If you were to indent the text on the next line, the text when displayed will have an indent in it, making it harder to read.
Also, please try to format your code with code fences ```

1 Like

Thanks, codehs and other editors (such as vi with its wrapmargin and autoindent parameters) achieve the editor indenting behavior I need. It’s a Python “code your own adventure” class and we use long quoted paragraphs in print() statements. Codehs works fine. Sorry for my posted code format; I thought the forum instructions said HTML can be used to format a post so I wrapped it in <pre> tags.

It’s markdown that we use to format posts. For example

if first == "bob":
   print("Hello...")
else:
   print("Something else")

can be achieved using three backticks before and after the code e.g.
image

2 Likes

add to the pyproject.toml file

[tool.yapf]
column_limit=# replace this comment with the number of characters that fit on a line on your screen

And use CtrlS to format your code.
black is better at splitting lines (and better in general) than the default formatter, yapf, so you might want to set that up:

  1. Run in Shell [this won’t work on the beta python template]:
sed -i /replit-python-lsp-server/d pyproject.toml
poetry add --dev python-lsp-black
  1. Add to pyproject.toml
[tool.black]
preview = true
line-length = # replace this comment
  1. Run in Shell
pkill python3

The setup takes 198.232 sec, so here’s a template

2 Likes