Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 171124
Collapse All | Expand All

(-)src/org/eclipse/tptp/test/auto/gui/internal/editor/AutoGUITestCasesForm.java (-9 / +54 lines)
Lines 1599-1613 Link Here
1599
			int firstCharacterInx = -1; 
1599
			int firstCharacterInx = -1; 
1600
			char currentCharacter;
1600
			char currentCharacter;
1601
			
1601
			
1602
			for (int i = 0, macroLength = macro.length(); i < macroLength; i++)
1602
			if(searchForward)
1603
			{
1603
			{
1604
				currentCharacter = macro.charAt(i);
1604
				
1605
				if ((currentCharacter == findStringChar[0] || 
1605
				for (int i = 0, macroLength = macro.length(); i < macroLength; i++)
1606
				   (!caseSensitive && (currentCharacter <= 90 ? currentCharacter + 32 == findStringChar[0] : currentCharacter - 32 == findStringChar[0]))) && 
1607
				   (wholeWord ? macro.charAt(i - 1) == 32 && macro.charAt(i + findStringChar.length) == 32 : true))
1608
				{
1606
				{
1609
					firstCharacterInx = i;
1607
					currentCharacter = macro.charAt(i);
1610
				}
1608
					if ((currentCharacter == findStringChar[0] || 
1609
							(!caseSensitive && (currentCharacter <= 90 ? currentCharacter + 32 == findStringChar[0] : currentCharacter - 32 == findStringChar[0]))) && 
1610
							(wholeWord ? macro.charAt(i - 1) == 32 && macro.charAt(i + findStringChar.length) == 32 : true))
1611
					{
1612
						firstCharacterInx = i;
1613
					}
1611
				
1614
				
1612
				for (int j = 1; firstCharacterInx != -1 && j < findStringChar.length; j++)
1615
				for (int j = 1; firstCharacterInx != -1 && j < findStringChar.length; j++)
1613
				{
1616
				{
Lines 1628-1637 Link Here
1628
				if (firstCharacterInx != -1)
1631
				if (firstCharacterInx != -1)
1629
				{
1632
				{
1630
					widgetOffset = widgetOffset < 0 ? 0 : widgetOffset;
1633
					widgetOffset = widgetOffset < 0 ? 0 : widgetOffset;
1631
					input.setSelection(searchForward ? i + widgetOffset: i - widgetOffset, searchForward ? i + findStringChar.length + widgetOffset : i + findStringChar.length - widgetOffset);
1634
					input.setSelection( i + widgetOffset, i + findStringChar.length + widgetOffset );
1632
					return i;
1635
					return i;
1633
				}
1636
				}
1634
			}
1637
			}}
1638
			
1639
			else{
1640
				// searching ackward requires a different search (need to go match last character first and traversal is already based on widgetOffset
1641
				// added for defect 171124 Liz D.
1642
				
1643
				for (int k = macro.length()-1, macroLength = macro.length(); k > 0; k--)
1644
				{
1645
					currentCharacter = macro.charAt(k);
1646
					
1647
					int lastChar = findStringChar.length-1;
1648
					if ((currentCharacter == findStringChar[lastChar] || 
1649
					   (!caseSensitive && (currentCharacter <= 90 ? currentCharacter + 32 == findStringChar[0] : currentCharacter - 32 == findStringChar[0]))) && 
1650
					   (wholeWord ? macro.charAt(k - 1) == 32 && macro.charAt(k + findStringChar.length) == 32 : true))
1651
					{
1652
						firstCharacterInx = k;
1653
					}
1654
					
1655
					for (int j = 1; firstCharacterInx != -1 && j < findStringChar.length; j++)
1656
					{
1657
						if (k - j >= macroLength)
1658
						{
1659
							firstCharacterInx = -1;
1660
							break;
1661
						}
1662
						currentCharacter = macro.charAt(k - j);
1663
						if (currentCharacter != findStringChar[lastChar -j] &&
1664
							(caseSensitive ? true : (currentCharacter <= 90 ? currentCharacter + 32 != findStringChar[lastChar-j] : currentCharacter - 32 != findStringChar[lastChar -j])))
1665
						{
1666
							firstCharacterInx = -1;
1667
							break;
1668
						}
1669
					}
1670
					
1671
					if (firstCharacterInx != -1)
1672
					{
1673
						k++;
1674
						input.setSelection(k , k - findStringChar.length );
1675
						return k;
1676
					}
1677
				}
1678
			}	
1679
			
1635
			
1680
			
1636
			return -1;
1681
			return -1;
1637
		}
1682
		}

Return to bug 171124