Difference between revisions of "Paste with Indentation"

(Behavior 2: Multiple lines with no tab in pasting text)
(Behavior 3: Single line with leading tabs in pasting text)
Line 83: Line 83:
 
== Behavior 3: Single line with leading tabs in pasting text ==
 
== Behavior 3: Single line with leading tabs in pasting text ==
 
Copied text:
 
Copied text:
 +
 +
[[Image:Behavior_3_copied_text.PNG]]
 
=== Behavior 3.1 ===
 
=== Behavior 3.1 ===
 
Pasted at:
 
Pasted at:
 +
 +
[[Image:Behavior_3_1_pasted_at.PNG]]
 +
 
Result:
 
Result:
Comment:
+
 
 +
[[Image:Behavior_3_1_result.PNG]]
 +
 
 +
Summury:
 +
* Remove tabs before the cursor.
 +
* The text pasted is indented by one tabulation (NC - NP)
 +
 
 
=== Behavior 3.2 ===
 
=== Behavior 3.2 ===
 
Pasted at:
 
Pasted at:
 +
 +
[[Image:Behavior_3_2_pasted_at.PNG]]
 +
 
Result:
 
Result:
Comment:
+
 
 +
[[Image:Behavior_3_2_result.PNG]]
 +
 
 +
Summury:
 +
* Remove tabs before the cursor.
 +
* The text pasted is not modified when (NC - NP) = 0
 +
 
 
=== Behavior 3.3 ===
 
=== Behavior 3.3 ===
 
Pasted at:
 
Pasted at:
 +
 +
[[Image:Behavior_3_3_pasted_at.PNG]]
 +
 
Result:
 
Result:
Comment:
+
 
 +
[[Image:Behavior_3_3_result.PNG]]
 +
 
 +
Summury:
 +
* Nothing is done to the text pasted when NC = 0
  
 
== Behavior 4 ==
 
== Behavior 4 ==

Revision as of 05:41, 27 April 2012

Description

This article describes a new pasting behavior which is smarter than the regular paste-as-it-is behavior in terms of indentation. However the implementation will remain simple without using heavy Eiffel parser to reformat the text being pasted.

Behaviors

Note:

  • Number of tabulations before the cursor (NC)
  • Number of leading tabulations of the text being pasted (NP)

Behavior 1: Multiple lines with leading tabs in pasting text

Copied text:

Error creating thumbnail: Unable to save thumbnail to destination

Behavior 1.1

Pasted at:

Error creating thumbnail: Unable to save thumbnail to destination

Result:

Error creating thumbnail: Unable to save thumbnail to destination

Summury:

  • Remove tabs before the cursor.
  • The text pasted is indented by one tabulation (NC - NP)

Behavior 1.2

Pasted at:

Error creating thumbnail: Unable to save thumbnail to destination

Result:

Error creating thumbnail: Unable to save thumbnail to destination

Summury:

  • Remove tabs before the cursor.
  • The text pasted is not modified when (NC - NP) = 0

Behavior 1.3

Pasted at:

Error creating thumbnail: Unable to save thumbnail to destination

Result:

Error creating thumbnail: Unable to save thumbnail to destination

Summury:

  • Nothing has been done to the pasted text when NC = 0

Behavior 2: Multiple lines with no tab in pasting text

Copied text:

Error creating thumbnail: Unable to save thumbnail to destination

Behavior 2.1

Pasted at:

Error creating thumbnail: Unable to save thumbnail to destination

Result:

Error creating thumbnail: Unable to save thumbnail to destination

Summury:

  • Nothing has been done to the pasted text when NP = 0

Behavior 2.2

Pasted at:

Error creating thumbnail: Unable to save thumbnail to destination

Result:

Error creating thumbnail: Unable to save thumbnail to destination

Summury:

  • Nothing has been done to the pasted text when NP = 0

Behavior 3: Single line with leading tabs in pasting text

Copied text:

Error creating thumbnail: Unable to save thumbnail to destination

Behavior 3.1

Pasted at:

Error creating thumbnail: Unable to save thumbnail to destination

Result:

Error creating thumbnail: Unable to save thumbnail to destination

Summury:

  • Remove tabs before the cursor.
  • The text pasted is indented by one tabulation (NC - NP)

Behavior 3.2

Pasted at:

Error creating thumbnail: Unable to save thumbnail to destination

Result:

Error creating thumbnail: Unable to save thumbnail to destination

Summury:

  • Remove tabs before the cursor.
  • The text pasted is not modified when (NC - NP) = 0

Behavior 3.3

Pasted at:

Error creating thumbnail: Unable to save thumbnail to destination

Result:

Error creating thumbnail: Unable to save thumbnail to destination

Summury:

  • Nothing is done to the text pasted when NC = 0

Behavior 4

Copied text:

Behavior 4.1

Pasted at: Result: Comment: