How Copy and Paste actually works?

45 views
0

Lets say for text first and then for files.

In: 0

In general, the content for whatever you copied goes into memory that the OS sets aside. So then when you paste, the contents of that memory are copied to where you are focused on. Modern systems have some extra sophistication such as recognizing if the copied content is plain text, formatted text, or binary. So if the receiving application only supports plain text and you paste in formatted text, the application knows to strip away the formatting.

Using copy and paste with files works slightly differently. When you copy, the computer remembers the location of the file, not the file itself. When you paste, it now knows the location to copy from and where to put it.

and why is there only one slot to have it?

The OS has a clipboard, which is basically a small program. When copy is invoked in an application (or OS), it calls that clipboard program and gives it that data. When when paste is invoked by the same or other program, that data is transferred to that application.