[Question]
  [
*As a celebration of [good old Notepad](https://blogs.msdn.microsoft.com/commandline/2018/05/08/extended-eol-in-notepad/), we are going to treat carriage returns and line feeds as what they originally meant, rather than what they are (ab-)used for today.*
Given a string consisting of printable ASCII plus line feeds (␊; LF; esc `\n`; hex 0A; dec 10) and carriage returns (␍; CR; esc `\r`; hex 0D; dec 13), **cause [Try It Online](https://tio.run/#) to show how the printable characters would be positioned** if printed on a printer which takes those two control characters literally:
1. upon a line feed, continue printing one line further down
2. upon a carriage return continue printing from the left edge
3. multiple consecutive carriage returns behave like a single carriage return
Due to modern devices having problems with [overstriking](https://en.wikipedia.org/wiki/Overstrike), a run of one or more of carriage returns will, except for at the beginning of the input, never occur without at least one preceding and/or following line feed. However, two runs of carriage returns may be separated by a single line feed.
Any amount of additional trailing white space is acceptable, both on the right-hand side of any lines and below the entire text, as long as at least the amount of white space given in the input is preserved.
### Examples (using `\n` and `\r` for line feed and carriage return)
`Lorem ipsum dolor sit amet,`
```
Lorem ipsum dolor sit amet,
```
---
`consectetur adipiscing\nelit, sed`
```
consectetur adipiscing
                      elit, sed
```
---
`do eiusmod\r\ntempor incididunt\n\n ut labore`
```
do eiusmod
tempor incididunt
                  ut labore
```
---
`et dolore\n\rmagna \r\r\naliqua. Ut` (notice the trailing spaces)
```
et dolore
magna          
aliqua. Ut
```
---
`\nenim ad minim veniam,\n\r quis nostrud`
```
enim ad minim veniam,
     quis nostrud
```
---
`\rexercitation\r\n\rullamco laboris\n\r\nnisi ut aliquip ex\n\n\rea commodo consequat.\n\n`
```
exercitation
ullamco laboris
nisi ut aliquip ex
ea commodo consequat.
```
  
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 10 bytes
```
ＵＴＦθ«ι≡ι⸿↑
```
[Try it online!](https://tio.run/##PYoxDsIwEATr@BUnV04BDwhvQKJIKkxxMsax5PjIxQkFytsPp2G3mp11I7IjTCI9hZB8z3Ey7UW9iMHMLXxVc@OYi4l1bJZPLG6ECodwuHjQlnUHV9q86Yb3cdrVLnLXvsCTErG32fKEISP8Y7k2Y4rzimcYin7IaUs/ "Charcoal – Try It Online") Link is to verbose version of code. Explanation:
```
ＵＴ
```
Disable right padding.
```
Ｆθ«
```
Loop over the input.
```
ι
```
Print the current character. This automatically handles `\n` (which Charcoal treats as `\v` in this context) but Charcoal translates `\r` into `\r\n`, so...
```
≡ι⸿
```
... check for an `\r`...
```
↑
```
... and if so then move back up a line.
[Answer]
# [Ruby](https://www.ruby-lang.org/), ~~24~~ 17 bytes
```
->s{s.tr $/,"\v"}
```
[Try it online!](https://tio.run/##PZA9bsMwDIXn5hSE0amw3RO0J@jaKfKgSExAwKIckQpSFD27SzlwNIk/771PKvX0s54/1uFTfmXUAq/vfedu3d@6VBU4Hl7Ox@4rF0xAi9QEMc@5gJCCT6h9N/XbSsgsGBS1FvCRFpJAfHGMM2kPgnFfjBmQqqQcXXGsmBazIw4UKVZWx46hKsz@ZKG7CPWRizYuyV/Yw/OYjRn5ma51hG/dJRbNlIwFErXLzUqf@mawya6VBDiLlvpkcwXvWAKpV8rcbF2p8@xTyA8gEre1mYQa5ZZKC@C9cZvcQ8jJ3pZh@5Br9Tq2UTcdpjdjGobBivUf "Ruby – Try It Online")
It does not work on TIO, but works on the Linux console.
[Answer]
# Java 10, ~~211~~ ~~207~~ 206 bytes
```
s->{var a=s.replace("\r\n","\n\r").split("(?<=\n)");int i=0,p=0,j;for(var x:a){for(j=x.charAt(0)<14?0:p;j-->0;x=" "+x);j=(a[i++]=x.replace("\r","")).length()-1;p=x.matches("\\s+")?p:j;}return"".join("",a);}
```
[Try it online.](https://tio.run/##lVJNb9swDL3vVxA6WUhspMBOcd1g962XYae6B1ZWE3rWRyU58BDkt2eU63bNsMsECRBF8vHxiT0esey7nxc1YIzwDcmePgGQTTo8o9Jwn02A7ymQ3YMqlkuUNb@f@fCOCRMpuAcLDVxieXc6YgBsYhW0HxilEG1orViL1rZByCr6gVIhit1t01opZM31gJrN2vPp62cXiowwbVGestE3U6UOGL6kYiNvbz7vNltf92V5t6mnRoBYTbLumwIfaLV65NgPZbmokLIatN2nQyHLm9pzgMGkDjpyQBtXQu78tq/PQacxWCGq3pEthFijrM@X@rVHPz4N3OPS6tFRB4bFWvR4eASmOiuVdOTWvrqgDZCPo4HODS5ApARodFqLWbq3QOVs1Crl0oAdeYqK8VqrWaE1RN1dh3cONI3RuC4rmrTxDE1WUUfdaBPra2FMMOATE7hO1emVic6fYHBvEd4XgzEcDvQyYgU/0nUms7FkmB4Yypcjm2jWGWfOfhkpgnUxhfEvum3Qkw6KsmrO5hptGIcBjXKvHCm287OlSJn4TIE86Cm3wukIyhlu18GsFPNLVXaJZQD/jN/8J3PZ9xldZvdXZKEqN6bKsyMNtrCVKqJcqP7DL8r/Xm@Ezpff)
**Explanation:**
```
s->{                      // Method with String as both parameter and return-type
  var a=s.replace("\r\n","\n\r")
                          //  Replace all "\r\n" with "\n\r"
        .split("(?<=\n)");//  Create String-array split by "\n",
                          //  without removing the trailing "\n" delimiter
  int i=0,                //  Index integer
      p=0,                //  Previous line-length, starting at 0
      j;                  //  Temp integer
  for(var x:a){           //  Loop over the String-array
    for(j=x.charAt(0)<14?0//   If the current line starts with either '\r' or '\n':
        0                 //    Prepend no spaces
       :                  //   Else:
        p;j-->0;x=" "+x); //    Prepand `p` amount of spaces for the current item
    j=(a[i++]=x.replace("\r",""))
                          //   Remove all "\r" from the current line
       .length()-1;       //   Set `j` to the current line-length (minus the trailing '\n')
    p=x.matches("\\s+")?  //   If the current line only contains '\r', '\n' and/or spaces:
       p                  //    Leave `p` unchanged
      :                   //   Else:
       j;}                //    Change `p` to this line-length minus 1
  return"".join("",a);}   //  Return the String-array joined together
```
---
Old answer before the challenge was changed **~~151~~ 148 bytes**:
```
s->{String a[]=s.replace("\r\n","\n\r").split("(?<=\n)"),r="";int p=0,i;for(var x:a){for(i=p;i-->0;r+=" ");i=x.length()-1;p=i<1?p:i;r+=x;}return r;}
```
**Explanation:**
```
s->{                            // Method with String as both parameter and return-type
  String a[]=s.replace("\r\n","\n\r") 
                                //  Replace all "\r\n" with "\n\r"
              .split("(?<=\n)"),//  Create String-array split by "\n",
                                //  without removing the trailing "\n" delimiter
         r="";                  //  Result-String, starting empty
  int p=0,                      //  Previous line-length, starting at 0
      i;                        //  Index (and temp) integer
  for(var x:a){                 //  Loop over the String-array
    for(i=p;i-->0;r+=" ");      //   Append `p` amount of spaces to the result
    i=x.length()-1;p=i<1?p:j;   //   If the current line is not empty:
                                //    Replace `p` with the length of this current line
    r+=x;}                      //   Append the current item
  return r;}                    //  Return the result-String
```
Doesn't work on TIO, does work on Windows Command Prompt:
[![enter image description here](https://i.stack.imgur.com/hQhuP.png)](https://i.stack.imgur.com/hQhuP.png)
[Answer]
# [JavaScript (Node.js)](https://nodejs.org), 85 bytes
```
s=>s[R='replace'](/(.*)([\n\r]+)/g,(_,t,b)=>t+b[R](/\r/g,_=>s='',s=t[R](/./g,' '))+s)
```
[Try it online!](https://tio.run/##TVBLTsMwEN1zitk5piGwYIfSE7BCYlUj5DpDNMif1B5XlRBnL@MEIbyy38z7@dOebXGZFr6LacLrx3gt474cXkaVcfHWoXrr7rvhVncHE01@2@n7ue/ee@6Petzz7nh4kQWTBX0X4qhUX0ZewUEwBUrrXdHXeRTdL5diSR4Hn@buoytaP/1H1J0axBUtd48PMvu@uRHwOWUMQEupAabkU4ZCDDYg90q3hSaBjpFrBjvRQsVRnE1ET9xDwWlbmxIg1RLSZLKJjGERKYqOJppqZGkXoTJ4exTDjYK8OWKrHuwcLfwdEREZ6@lUB3jljSCmkYKkgEDtcpanDX2jr6RTpQIxFc71N5XJeMHsiC1Tik3S5Oq9DS5tUaiYFY5UqOVbHWkBvLTEQrfgUpBWCdaPOFXLQxspff0B "JavaScript (Node.js) – Try It Online")
[Answer]
# [Python 2](https://docs.python.org/2/), ~~150~~ ~~128~~ ~~122~~ ~~104~~ 103 bytes
```
def f(s):
 i=n=0;l=''
 for c in s:l,n,i=[l,l+c,l+' '*i*n+c,n,1,0,0,i,i+1]['\r\n'.find(c)%3::3]
 print l
```
[Try it online!](https://tio.run/##XZDLbsMgEEX3/orZVORBo6TZufIfdNtVyIICTkeCweFRpV/vDo7UhUFIA9x758D0W74jvc2zdSOMm7ztO8CBhuO7H4ToYIwJDCBB7r0kicPFS783vASIHe6Ia5IneeSJEven60WopEgcRiS7MduXc9@frx1MCamAn8eN@IjJBcAp1wA2eu6QsYAOrkix7RaheBUdK02k7ExxpSbQFifMBummyHksErKzK72N4LDmEG1jKC5MHI5k0KKtVBQpgsoU@osRVl5XnjCOVSnoG2n4H5zGedrjvR7gs6yczEMYGBACtuKHtzrIlrO47xUzUMwl1TWwSu7hksGiC0ZqTVSq3utg4pMSs1qOCTM29IUBJ3CP9hi2azAx8IMjLJ91r7oc2hU3mv8A "Python 2 – Try It Online")
---
Saved:
* -1 byte, thanks to Lynn
[Answer]
# [C (gcc)](https://gcc.gnu.org/), ~~100~~ 94 bytes
```
b,c,d;f(char*s){for(b=13;b;b=*s++)b==13?c=d=0:b-10?d=!printf("%*c",++d,b),++c:putchar(b,d=c);}
```
Assumes ASCII coding (`'\r'==13`, `'\n'==10`); adjust to suit on other systems.
[Try it online!](https://tio.run/##fVLNitswEL7nKaYpBTuxwi497bruvkCvpRdf5JGcDEgjrzQqC0tfvenYS3soTQVCGonvbyQ0Z8Trdeqwc/3c4MXmQ2lf55Sbabj/2E/9NBzK8dhOg5ZPOLjh7nEy93dPbni3ZGKZm/2HA@6749F1U6sLPi5VVqJm6tyAbf/juntPjKE6D5@KOEqny@edQiFa4qbdve5AhxJ9SdlHoKXUCC6FlKGQgI1eun3bg/KWZj@yMUbL3yBMXDyKl5rBOlqoIPF5ZB9IOije3Ya6BJ5qicmNeWTxcVFJtUqOXGUZeWSoAsFOauw2jZc3t14BOdozW/gzlFipbaDnak/wVaDhJIQe5KIzWwpqFspi0Zf2toTGYYqaDyKtm@9a2titgpvMc6UCnIrk@p@8Y/YvPiOJFUq8GhtzDcFGTG8hqYzbMVOhNfnmmxbwL2svFG4BU9R@JdjarqHktF79Q1Of/SfOwZ7L1eirD/jwcDXfOBmKSyA1YfQL/HUyV8bVmnEeg82bzV8 "C (gcc) – Try It Online") (requires Javascript)
## Readable version
```
int c = 0;
int d = 0;
f(char*s)
{
    for (;*s;++s) {
        switch (*s) {
        case'\r':
            c = d = 0;
            break;
        case'\n':
            d = c;
            putchar(*s);
            break;
        default:
            printf("%*s%c", d, "", *s);
            d = 0;
            ++c;
        }
    }
}
```
`c` is the current column position; `d` is the number of spaces that must be inserted before a printable character. Both are assumed to be zero on entry to the function.
## Test program
```
int main(int argc, char **argv)
{
    char s[1024];
    if (argc <= 1)
        while (fgets(s, sizeof s, stdin))
               f(s);
    else
        for (int i = 1;  i < argc;  ++i)
            f(argv[i]);
}
```
[Answer]
# [Python 3](https://docs.python.org/3/), ~~101~~ 94 bytes
Based on [TFeld's answer](https://codegolf.stackexchange.com/a/164453/64121).
```
def f(s):
 i=n=0
 for c in s:k='\r\n'.find(c);a=k&1;print(end=-k*' '*i*n+c*a);n=k>0;i=i*a-k//2
```
[Try it online!](https://tio.run/##bZA9UsQwDIX7PYUqnIT9A7rNhBPQ0rkxtgKaxHLWlpnl9MHJzlAwcWXJek/f8/QjX4Ff5tlhD32V6ssOqOPuvIM@RLBADOkydEpHzerYE7vK1q3phoendorEUiG77jA0ClRDDT/axtQtd8PruaWOGnMYTqfnua/UW4jogaaUPbgwFvdEAsaj7FW9u3spzYdSlGkbOKEVlBzBOJooWeJPzTiS7CGh29C4AEg5@eAWWkE/lSXElhy5zKJZM2SB0XwUlA09yh0My2T05pMN/J3iWDzNSNd8hHfZUBc2Jl9gwdNy@S6l8fvFa3W4ZkrAIUnMW/A64g2jJTFCgZdlOuZxNN6GOzElvbaZEi0xVhaaAG9LsCI3YIMv4QOsn3fNRo7L079l8y8 "Python 3 – Try It Online")
---
## Ungolfed
```
def f(s):
  i=0  # position of the cursor
  n=0  # was the last character LF?
  for c in s:        # iterate over the input
    k='\r\n'.find(c) # k := 0 for CR, 1 for LF and -1 for every other character
    a=k&1            # as (-1)&1 == (1)&1 == 1, this is a := abs(k)
    print(end=-k*' '*i*n+c*a) # If c is a normal character (k == -1) and the last character was LF, 
                              # print leading spaces. If c is not CR, print it
    n=k>0            # n := True if c is LF, False otherwise
    i=i*a-k//2       # If c is either a newline or a printable character (a == 1),
                     # keep the cursor's position and increment it for a printable character ((-1)//2 == -1)
```
[Answer]
# [Clean](https://clean.cs.ru.nl), ~~92~~ 91 bytes
**-1 thanks to Laikoni!**
*Note:* `\` in `\r` is omitted from bytecount as Linux CG handles literal `\r` and `\n`s.  
*Note:* Windows CG requires `\n` and `\r` be escaped, so +3 if it has to run on Windows.
```
import StdEnv
?n['\r':t]= ?0t
?n['
':t]=['
':spaces n]++ ?n t
?n[h:t]=[h: ?(n+1)t]
?_ e=e
```
# 
```
?0
```
[Try it online!](https://tio.run/##JY6xCsIwFEX3fsXbohRB10LJooPQrWMTJE2iDTQvpXkR/HljG6fL4cK5V89WYfbBpNmCVw6z80tYCXoyN3xXHAcmVtaQbIGfqXBVsGRclLYRUNY1cITST6WdGuAHrC9HkhV/gG1t7klt4t0DAzMBrEtxWxarQLL7KjjUzjiTkAQKhEQwqzGslsn81c9ZvWI@3bt8/aDyTv9hO9q5MZ/GHw "Clean – Try It Online")
A partial application of `? :: Int [Char] -> [Char]` with 0 as the initial first argument. This descends through each character keeping track of how many traversed, the count resets when it encounters a carriage return and when it encounters a newline it adds spaces equal to the number of characters traversed at that point.
[Answer]
# [Haskell](https://www.haskell.org/), ~~93~~ 87 bytes
```
l=0#0
(n#x)(t:r)|t=='\n'=t:(n#1)r|t=='\r'=l$r|m<-n+1=(' '<$[1..n*x])++t:(m#0)r
(_#_)e=e
```
[Try it online!](https://tio.run/##rVPBbsIwDL33KyyKVDqggiuif8BO004Eoay1mLXEKYkzceDfWdpq@4BRn5IXx8/vxfnU4QuNeTxMvck32YLzW7mQnS/vUteF4qKWXQK3pR8BX9Rm7u92v@bltl4UUOznx21V8cvtVC6XKdnmm9Jni3N@LrHGR6MDBqjhmEGK2fofMVuNdw/OowXqQrTQOuM8BBLQFmX1m/JM@cZxwEZQogfdUkehIb4oRkOygoDtFCStA6QYrGuVVyxouySDuKGW2siiWDFEAaM/ktgpCFFGrzCV9lZfWMNfpBZSE9rQNeoK3mUKvuQXk00GgqV@8Z222q569oHzGikAuyA@TmKo8nhD35BoIce9HuWjMdo2bnSRghpgpkC9tYNc6gBvvdnpuobG2fQgDoYJSF5I1R891d0py6wmToNvdfd6hi7Km/gDw7wHwMDwLx4/ "Haskell – Try It Online")
---
Pretty straightforward solution. # is an infix function that recursively creates the output one character at a time while keeping a character position counter (n) and flag for when to add spaces after a newline (x).
]