Difference between revisions of "Paste with Indentation"

(Behavior 1: Multiple lines with leading tabs in pasting text)
(Behavior 1: Multiple lines with leading tabs in pasting text)
Line 11: Line 11:
 
== Behavior 1: Multiple lines with leading tabs in pasting text ==
 
== Behavior 1: Multiple lines with leading tabs in pasting text ==
 
Copied text:
 
Copied text:
 +
 
[[Image:Behavior_1_copied_text.PNG]]
 
[[Image:Behavior_1_copied_text.PNG]]
 
=== Behavior 1.1 ===
 
=== Behavior 1.1 ===
The text pasted is indented by one tabulation (NC - NP)
 
  
 
Pasted at:
 
Pasted at:
 +
 
[[Image:Behavior_1_1_pasted_at.PNG]]
 
[[Image:Behavior_1_1_pasted_at.PNG]]
  
 
Result:
 
Result:
 +
 
[[Image:Behavior_1_1_result.PNG]]
 
[[Image:Behavior_1_1_result.PNG]]
  
Comment:
+
Summury:
=== Behavior 1.2 ===
+
* Removed tabs before the cursor.
 +
* The text pasted is indented by one tabulation (NC - NP)
  
 +
=== Behavior 1.2 ===
 
Pasted at:
 
Pasted at:
 +
 
[[Image:Behavior_1_2_pasted_at.PNG]]
 
[[Image:Behavior_1_2_pasted_at.PNG]]
  
 
Result:
 
Result:
 +
 
[[Image:Behavior_1_2_result.PNG]]
 
[[Image:Behavior_1_2_result.PNG]]
  
Comment:
+
Summury:
 +
* Removed tabs before the cursor.
 +
* The text pasted is modified as (NC - NP) = 0
  
 
=== Behavior 1.3 ===
 
=== Behavior 1.3 ===
 
Pasted at:
 
Pasted at:
 +
 
[[Image:Behavior_1_3_pasted_at.PNG]]
 
[[Image:Behavior_1_3_pasted_at.PNG]]
  
 
Result:
 
Result:
 +
 
[[Image:Behavior_1_3_result.PNG]]
 
[[Image:Behavior_1_3_result.PNG]]
  
Comment:
+
Summury:
 +
* Nothing has been done to the pasted text, becaues NC = 0
  
 
== Behavior 2: Multiple lines with no tab in pasting text ==
 
== Behavior 2: Multiple lines with no tab in pasting text ==

Revision as of 19:07, 26 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

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:

Behavior 1 copied text.PNG

Behavior 1.1

Pasted at:

Behavior 1 1 pasted at.PNG

Result:

Behavior 1 1 result.PNG

Summury:

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

Behavior 1.2

Pasted at:

Behavior 1 2 pasted at.PNG

Result:

Behavior 1 2 result.PNG

Summury:

  • Removed tabs before the cursor.
  • The text pasted is modified as (NC - NP) = 0

Behavior 1.3

Pasted at:

Behavior 1 3 pasted at.PNG

Result:

Behavior 1 3 result.PNG

Summury:

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

Behavior 2: Multiple lines with no tab in pasting text

Copied text:

Behavior 2.1

Pasted at: Result: Comment:

Behavior 2.2

Pasted at: Result: Comment:

Behavior 3: Single line with leading tabs in pasting text

Copied text:

Behavior 3.1

Pasted at: Result: Comment:

Behavior 3.2

Pasted at: Result: Comment:

Behavior 3.3

Pasted at: Result: Comment:

Behavior 4

Copied text:

Behavior 4.1

Pasted at: Result: Comment: