3 ms·
I've never had a problem with this when moving code around. Cut/paste, indent entire block to match initial level, done. Where is the potential for errors? Ther
by formerly_proven 5y ago
I've never had a problem with this when moving code around. Cut/paste, indent entire block to match initial level, done. Where is the potential for errors? There really is none, because the brainbox keeps track of what I just pasted and tab/shift-tab moves that block as a unit. I find moving stuff around in braced languages a wee bit more work, actually, because you have to move the braces manually instead of shifting the block in and out, which is quicker.
Personally I've been way more annoyed when I've typed something up in the REPL and can't paste that over directly because of the >>> and ... but that's really a small tooling issue; a smarter editor would remove the REPL marks when pasting. Same for other REPL languages, most of them have PSn...
- lostdog 5y agoI have frequently had code like this: if other < mine: update_comments(other, mine) write_billing(other) and then I paste it, but get the indentation wrong on the last line, and it falls outside of the if block. Maybe my brainbox needs an upgrade. And yeah, pasting code into a repl would be easier too if I could rely on braces to convey scope.
- housecarpenter 5y agoI normally select the whole block that I just pasted and then press Tab or Shift+Tab to indent/dedent the whole thing at once---no possibility of missing the last line then. This works in most editors.