Commits

Barthelemy Dagenais  committed 52d741c

Refs #116 Fixed issue with spaces not being printed. Turns out the parser was trying to be too smart... Being dump sometimes pays :-(

  • Participants
  • Parent commits adbd703

Comments (0)

Files changed (1)

File ca.mcgill.cs.swevo.qualyzer/src/ca/mcgill/cs/swevo/qualyzer/editors/RTFDocumentProvider2.java

 		Map<String, Integer> currentTags = new HashMap<String, Integer>();
 		Stack<Map<String, Integer>> state = new Stack<Map<String, Integer>>();
 		state.push(currentTags);
-		boolean printSpace = true;
 
 		try
 		{
 				if (ch == BACKSLASH)
 				{
 					ParserPair pair = handleControl(contentStream);
-					printSpace = handleControlCommand(pair.fString, text, safeState(state), rtfDocument);
+					handleControlCommand(pair.fString, text, safeState(state), rtfDocument);
 					c = pair.fChar;
 				}
 				else if (ch == LEFT_BRACE)
 				{
 					ParserPair pair = handleGroup(contentStream, state, text, rtfDocument);
-					printSpace = false;
 					c = pair.fChar;
 				}
 				else if (ch == RIGHT_BRACE)
 				{
 					handleEndGroup(contentStream, state, text, rtfDocument);
-					printSpace = false;
 					c = contentStream.read();
 				}
 				else
 					if (!in(ch, SPACES))
 					{
 						text.append(ch);
-						printSpace = true;
 					}
-					else if (equal(ch, SPACE_CHAR) && printSpace)
+					else if (equal(ch, SPACE_CHAR) && true)
 					{
 						text.append(ch);
 					}
 	}
 
 	//CSOFF:
-	private boolean handleControlCommand(String control, StringBuilder text, Map<String, Integer> state,
+	private void handleControlCommand(String control, StringBuilder text, Map<String, Integer> state,
 			RTFDocument document)
 	{
-		// May need to be tweaked for NEW_LINE, ESCAPE, and TAB
-		boolean printSpace = true;
-
 		if (control.equals(BOLD_START) && !state.containsKey(BOLD_START))
 		{
 			startBold(document, text, state);
 			handleControlCommand(BOLD_END, text, state, document);
 			handleControlCommand(ITALIC_END, text, state, document);
 			handleControlCommand(UNDERLINE_END, text, state, document);
-			printSpace = false;
 		}
 		else if (in(control, ESCAPE_CONTROLS))
 		{
 			char unicodeChar = (char) unicodeNumber;
 			text.append(unicodeChar);
 		}
-		else 
-		{	
-			printSpace = false;
-		}
-		return printSpace;
 	}
 	//CSON: