Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pasting should overtype rather than insert in overtype mode #15

Open
blah238 opened this issue Jun 27, 2016 · 15 comments
Open

Pasting should overtype rather than insert in overtype mode #15

blah238 opened this issue Jun 27, 2016 · 15 comments

Comments

@blah238
Copy link

blah238 commented Jun 27, 2016

When pasting, if overtype mode is on, I would expect the pasted text to overtype any existing characters within the length of the pasted text. Currently it just does a normal insert paste.

Would be nice for pasting into formatted Markdown tables, for example.

@brunetton
Copy link
Owner

Indeed

@Asc2011
Copy link
Collaborator

Asc2011 commented Apr 3, 2019

hi @brunetton,
i have worked on this package and the behavior of paste-from-clipboard is a topic now. Having a destructive-overwrite with space-chars seems reasonable to me. I have a simple version that already does so. Questions could be if its reasonable to have some sort of boundary (see issue-#14 'Whitespace overtype') or a end-of-line-limit or maybe smth. entirely different.
So I'd like to hear your thoughts on this.

greets Andreas

@brunetton
Copy link
Owner

Hi @andread, I do not use Atom anymore so I don't take time on this project. Do you want me to add you as a project manager so you can merge PRs and manage other team people?

@Asc2011
Copy link
Collaborator

Asc2011 commented Apr 3, 2019

@brunetton hello Bruno,
hmm, why not - that's my first one then :-)
What editor have you switched to and does it feature a well-done overwrite-mode ?

regards, Andreas

@l-cornelius-dol
Copy link

At end-of-line it should just append to the end; it should not overwrite the linefeed and overtype into the next line.

@l-cornelius-dol
Copy link

I do use Atom, and I also think pasting should overwrite what's there when overtype mode is on, exactly as if the pasted text were typed.

@Asc2011
Copy link
Collaborator

Asc2011 commented Apr 3, 2019

@lawrence-dol
ok, I can imagine at least two cases

  1. a destructive-overwrite, with a boundary at the line-end. Therefore the content to insert shall not contain any line-feeds whatsoever. That said, it focusses on one line and overwrites all of its content, or maybe less. But it would in all cases leave the line-structure intact.
  2. a destructive-overwrite carrying itself line-feeds/returns in its new-content. That would eventually overwrite some buffer-lines, not looking for the end-of-line.
  3. maybe a combination if the use-case is alike issue-Pushing Text Into Whitespace, "Whitespace Overtype" #14, where you find a table-like structure that contains 'holes', that is spaces, that should be filled with pasteboard-content, if doable.

Thats why I'm asking for your use-cases and needs. Cos' they are surely different from mine.

Technically I like to play with the idea of marking the overwrite-area by doing a selection. Then there would be two cases of user-intent - with a user-defined-area or without.

@l-cornelius-dol
Copy link

@Asc2011,

I think pasted linefeeds should be actioned by erasing to end-of-line, then moving to the next line and continuing to paste. With a question mark about moving to true start-of-line or the indented start of line.

When overtype pasting a block of text, hole insertion should be done as if they were individually pasted one at a time. I think all block-mode insertions should behave as if each line of the block were done individually at each successive caret.

@Asc2011
Copy link
Collaborator

Asc2011 commented Apr 5, 2019

I think pasted linefeeds should be actioned by erasing to end-of-line, then moving to the next line and continuing to paste.

@lawrence-dol sry, i don't understand completely. Pls. elaborate a bit between cases like :

  • clipboard has a single-line
  • clipboard has multi-line content

The current implementation is rather dumb.
An easy thing to do would be. When in doubt on paste, it first marks the target-region without mutating. A second paste-operation would then write to the buffer ?

greets

@l-cornelius-dol
Copy link

l-cornelius-dol commented Apr 8, 2019

@Asc2011

What I mean is that clipboard paste overtype should, at the point of a line break, delete to the end of the line, move to the start of the next line at the column of the past point, and continue overtyping using the clipboard data.

This means if I copy the full lines include the 3 linefeeds of this text:

line 1
    line 2
        line 3

and paste with my cursor on the c of current in the first line:

The current implementation is rather dumb.
An easy thing to do would be. When in doubt on paste, it first marks 
the target-region without mutating. A second paste-operation would then write to the buffer ?

the result will be

The line 1
An e    line 2
the         line 3

and if pasted at the beginning of the line it would be:

line 1
    line 2
        line 3

In effect, my intent is to replace existing lines of text with the lines of text I copied.

This is distinct behavior from when I copy a block of text using muli-cursors, and paste that block into the same number of multi-cursors, where each cursor point is a normal overtype paste point. (Note that I don't know how, or even if, Atom indicates that text has been copied using multiple cursors, but I expect you end up with multiple blocks to paste.)

PS: I think the idea to indicate the paste first and then paste is fine, even better. But this is what I expect to happen when pasting in overtype mode.

@Asc2011
Copy link
Collaborator

Asc2011 commented Apr 8, 2019

@lawrence-dol
ok, I did not I expect this, but well, why not.
As a side note - i just added support for auto-complete-insertions. Testing this now, looks good. It basically supports two cases of inserts from the autocomplete-plus-package :

  1. the current-line has enough space, then it will only overwrite as much as needed and keeps the rest of the line-content.
  2. not enough space, then the newline moves to the right, finally expanding the line.

What you propose is cutting the right-parts of the target-region, but keeping the left-parts. I would name this maybe 'multiline-paste preserving source-indents and cutting rest-of-line' ?
I'll, give it a try, seems to be easy to do.
For now I expect the source-lines to be a single selection starting from column-0. As said, I need to look into the Atom's-API concerning vertical- or block-selections. I have not noticed anything alike, yet. There are packages that allow for block-selections - i don't use these. Internally i assume Atom will use multiple-cursors to simulate a vertical-/block-selection. I spare this for later...
Do you use snippet-insertion or have you tried snippets in overtype-mode ? With my version I encounter an error - which is rooted in Atoms-API - there is a report for this.
I'd like to know if the current version of overtype-mode supports snippets (maybe not properly) or if you see an error ?
What platform are you on Mac/Win/Unix ?

greets Andreas

@l-cornelius-dol
Copy link

@Asc2011

I don't use snippets yet, but I have a mental to-do to look into them as a substitute for macros I used to use in TextPad to insert common boilerplate code. So I will before very long. I am in the long-tail of transitioning from TextPad as my coding editor.

Asc2011 added a commit to Asc2011/atom-overtype-mode that referenced this issue Apr 9, 2019
…elete-to-(end|beginning)-of-line‘

New paste-mode as discussed in issue-brunetton#15
Partial line-delete-options : ‚delete-to-end-of-line‘, ‚delete-to-beginning-of-line‘
@l-cornelius-dol
Copy link

Just to put a finer point on multiline paste, if the last line of my example above were pasted without the final NL, e.g. line 1\n line 2\n line 3 at column 4, then the result would be:

The line 1
An e    line 2
the         line 5without mutating. A second paste-operation would then write to the buffer ?

Does that make sense? No NL means no erase to end-of-line.

@Asc2011
Copy link
Collaborator

Asc2011 commented Apr 10, 2019

@lawrence-dol a first version of this paste-action is there. I'm struggling a bit with auto-indent, so this paste-action does need some testing.
You're asking if it makes sense, to not cut the end of the last line. Well, at a first look, i'd be tempted to say no. But if that floats-your-boat, then feel free to take a look at the code - it's roughly 50-lines - and adjust it to your needs. BTW it does not depend on the overwrite-mode at all. One could just flesh it out and put it into init.coffee, assign a short-cut and happily rock your buffer.
... reworked ... seems reliable now.

@l-cornelius-dol
Copy link

@Asc2011 Where is this project at. I see no updates in the Atom packages repo. Do I need to pull this repo down and manually link into my atom packages? I am not familiar with how one goes about this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants