"Smart" Block Copy & Paste

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Tim Hochberg

    "Smart" Block Copy & Paste


    During the recent, massive, painful Lisp-Python crossposting thread the
    evils of Python's whitespace based indentation were once again brought
    to light. Since Python' syntax is so incredibly brittle, and failure
    prone, it's amazing that we don't have more editor support for our
    feeble minds. To help reduce the severity of this crisis, I decided to
    take a whack at creating smart block copy and paste functionality.

    Anyway, I wrote some code to extract indentation information from the
    original file when doing copies and then to match up the indentation in
    a sensible way when doing pastes. The code is still rough and can be
    quite slow in some situations, but I figured it was interesting enough
    to release. If your interested in trying it out or just getting more
    details, the code and instructions for hacking it into Idle are
    available at http://starship.python.net/crew/hochberg/

    Regargs,

    -tim



  • Steve Lamb

    #2
    Re: "Smart&quo t; Block Copy & Paste

    On 2003-10-14, Tim Hochberg <tim.hochberg@i eee.org> wrote:[color=blue]
    > During the recent, massive, painful Lisp-Python crossposting thread the
    > evils of Python's whitespace based indentation were once again brought
    > to light. Since Python' syntax is so incredibly brittle, and failure
    > prone, it's amazing that we don't have more editor support for our
    > feeble minds.[/color]

    Why, exactly, would we need more than << and >>?

    --
    Steve C. Lamb | I'm your priest, I'm your shrink, I'm your
    PGP Key: 8B6E99C5 | main connection to the switchboard of souls.
    -------------------------------+---------------------------------------------

    Comment

    • Tim Hochberg

      #3
      Re: &quot;Smart&quo t; Block Copy &amp; Paste

      Steve Lamb wrote:[color=blue]
      > On 2003-10-14, Tim Hochberg <tim.hochberg@i eee.org> wrote:
      >[color=green]
      >>During the recent, massive, painful Lisp-Python crossposting thread the
      >>evils of Python's whitespace based indentation were once again brought
      >>to light. Since Python' syntax is so incredibly brittle, and failure
      >>prone, it's amazing that we don't have more editor support for our
      >>feeble minds.[/color]
      >
      >
      > Why, exactly, would we need more than << and >>?[/color]

      I assume that's block dedent and indent? You don't, really, need more
      than that.

      However, many editors tend to mess up the indentation on the first line
      of a pasted block, which as to be corrected separately from the rest.
      You can usually avoid this if your careful or hit home/ctrl-a/etc before
      pasting, but that's extra keystrokes. Also, at least some editors
      (SciTe, Idle) don't set the mark on your pasted text, so then you need
      to select the pasted text before (in)|(de)dentin g it.

      Of course what I did was probably massively overkill for these problems,
      but it's an interesting project. Also, the behaviour of Idle with the
      patch is overall better than without, IMO. In truth, I suspect that I
      could get a similar gain with less invasive and simpler changes, but it
      wouldn't be as intersting.

      Regards,

      -tim







      Comment

      Working...