Index: trunk/org.txm.texts.core/src/org/txm/texts/core/TextsView.java
===================================================================
--- trunk/org.txm.texts.core/src/org/txm/texts/core/TextsView.java	(revision 3522)
+++ trunk/org.txm.texts.core/src/org/txm/texts/core/TextsView.java	(revision 3523)
@@ -203,6 +203,7 @@
 	protected boolean _toTxt(File outfile, String encoding, String colseparator, String txtseparator) throws Exception {
 		
 		PrintWriter writer = org.txm.utils.io.IOUtils.getWriter(outfile, encoding);
+		
 		writer.println("text"+colseparator+StringUtils.join(pColumns, colseparator));
 		
 		for (String text : result.keySet()) {
Index: TXM/trunk/org.txm.concordance.core/src/org/txm/concordance/core/functions/comparators/LineComparator.java
===================================================================
--- TXM/trunk/org.txm.concordance.core/src/org/txm/concordance/core/functions/comparators/LineComparator.java	(revision 3522)
+++ TXM/trunk/org.txm.concordance.core/src/org/txm/concordance/core/functions/comparators/LineComparator.java	(revision 3523)
@@ -60,6 +60,10 @@
 		return availableComparator;
 	}
 
+	public boolean equals(LineComparator c2) {
+		return this.getName().equals(c2.getName());
+	}
+	
 	/**
 	 * Instantiates a new line comparator.
 	 *
Index: TXM/trunk/org.txm.concordance.core/src/org/txm/concordance/core/functions/Concordance.java
===================================================================
--- TXM/trunk/org.txm.concordance.core/src/org/txm/concordance/core/functions/Concordance.java	(revision 3522)
+++ TXM/trunk/org.txm.concordance.core/src/org/txm/concordance/core/functions/Concordance.java	(revision 3523)
@@ -1235,8 +1235,7 @@
 	 * Brutal way to reset the concordance lines. they will be recomputed when getLines(...) is called
 	 */
 	public void resetLines() {
-		lines = new ArrayList<>(Collections.nCopies(nLines,
-				(Line) null)); // empty lines
+		lines = new ArrayList<>(Collections.nCopies(nLines,	(Line) null)); // empty lines
 	}
 	
 	/**
@@ -1560,13 +1559,19 @@
 	 * @throws IOException
 	 */
 	public void sort(LineComparator comparator, TXMProgressMonitor monitor) throws Exception {
+		
+		//String[] previousSort = comparator.getAvailableComparators();
 		System.currentTimeMillis();
 		this.acquireSemaphore();
 		comparator.initialize(this.getCorpus());
 		this.releaseSemaphore();
+		
+		resetLines();
+		
 		if (getNLines() == 0) {
 			return;
 		}
+		
 		getLines(0, nLines - 1); // all lines are necessary to sort TODO: if fact only the sort properties are needed
 		if (lines.size() > 0) {
 			Collections.sort(lines, comparator);
Index: TXM/trunk/org.txm.concordance.rcp/src/org/txm/concordance/rcp/editors/ConcordanceEditor.java
===================================================================
--- TXM/trunk/org.txm.concordance.rcp/src/org/txm/concordance/rcp/editors/ConcordanceEditor.java	(revision 3522)
+++ TXM/trunk/org.txm.concordance.rcp/src/org/txm/concordance/rcp/editors/ConcordanceEditor.java	(revision 3523)
@@ -424,7 +424,7 @@
 				
 				currentComparator = cComparator;
 				
-				complexsorter.setKey(4);// set ref key
+				complexsorter.setSimpleSortKey(4);// set ref key
 				sort();
 				StatusLine.setMessage(""); //$NON-NLS-1$
 			}
@@ -567,7 +567,7 @@
 				
 				currentComparator = cComparator;
 				
-				complexsorter.setKey(2);// set ref key
+				complexsorter.setSimpleSortKey(2);// set ref key
 				sort();
 				StatusLine.setMessage(""); //$NON-NLS-1$
 			}
@@ -617,7 +617,7 @@
 				
 				currentComparator = cComparator;
 				
-				complexsorter.setKey(1);// set ref key
+				complexsorter.setSimpleSortKey(1);// set ref key
 				sort();
 				StatusLine.setMessage(""); //$NON-NLS-1$
 			}
@@ -665,7 +665,7 @@
 				
 				currentComparator = cComparator;
 				
-				complexsorter.setKey(3); // set ref key
+				complexsorter.setSimpleSortKey(3); // set ref key
 				sort();
 				StatusLine.setMessage(""); //$NON-NLS-1$
 			}
@@ -846,9 +846,9 @@
 	public void sort() {
 		
 		if (concordance != null && currentComparator != null) {
-			
+//			System.out.println("SORT !!!!");
 			// System.out.println("concordance sort props: "+concordance.getLeftCAnalysisProperty()+", "+concordance.getKeywordAnalysisProperty()+", "+concordance.getRightCAnalysisProperty());
-			concordance.resetLines();
+			//concordance.resetLines();
 			
 			try {
 				Log.fine(NLS.bind(ConcordanceUIMessages.sortingWithP0, currentComparator.getName()));
@@ -1463,8 +1463,27 @@
 		try {
 			QueriesView.refresh();
 			
+			System.out.println("lines="+concordance.getLines());
+			
 			this.fillDisplayArea(update);
 			
+//			if (update) {
+//				//System.out.println(this.currentComparator);
+//				if (currentComparator instanceof CompositeComparator) {
+//					CompositeComparator cc = (CompositeComparator)currentComparator;
+//					boolean allDefault = true;
+//					for (LineComparator ccc : cc.getComparators()) {
+//						allDefault = allDefault && ccc instanceof WordPositionComparator;
+//					}
+//					
+//					if (!allDefault) {
+//						this.sort();
+//					}
+//				} else {
+//					this.sort();
+//				}
+//			}
+			
 			boolean b = concordance.getQueryResultParameter() == null;
 			this.queryWidget.setEnabled(b); // disable the widget if a QueryResult was provided
 			
@@ -1576,6 +1595,7 @@
 	public void setLeftSortProperties(List<WordProperty> list) {
 		
 		concordance.setLeftAnalysisProperties(list);
+		sort();
 	}
 	
 	/**
@@ -1636,7 +1656,7 @@
 		concordance.setRightContextSize(rightContextSize);
 		this.rightSizeSpinner.setSelection(rightContextSize);
 		this.leftSizeSpinner.setSelection(leftContextSize);
-		fillDisplayArea(false); // we return to the previously
+		updateEditorFromResult(true); // we return to the previously
 		resetColumnWidths();
 	}
 	
@@ -1748,19 +1768,13 @@
 	 */
 	private void createActions() {
 		
-		setSortPropertyAction = new SortPropertySelection(getSite()
-				.getWorkbenchWindow(), this, this.viewerRight);
-		setContextSizeAction = new SetContextSize(getSite()
-				.getWorkbenchWindow(), this);
+		setSortPropertyAction = new SortPropertySelection(getSite().getWorkbenchWindow(), this, this.viewerRight);
+		setContextSizeAction = new SetContextSize(getSite().getWorkbenchWindow(), this);
 		// resetColumnWidths = new ResetColumnWidths(getSite().getWorkbenchWindow(), this);
-		setLineNumberAction = new SetLineNumber(getSite().getWorkbenchWindow(),
-				this);
-		defineViewReferencePatternAction = new DefineViewReferencePattern(getSite()
-				.getWorkbenchWindow(), this);
-		defineSortReferencePatternAction = new DefineSortReferencePattern(getSite()
-				.getWorkbenchWindow(), this);
-		setViewPropertyAction = new ViewPropertySelection(getSite()
-				.getWorkbenchWindow(), this, this.viewerRight);
+		setLineNumberAction = new SetLineNumber(getSite().getWorkbenchWindow(), this);
+		defineViewReferencePatternAction = new DefineViewReferencePattern(getSite().getWorkbenchWindow(), this);
+		defineSortReferencePatternAction = new DefineSortReferencePattern(getSite().getWorkbenchWindow(), this);
+		setViewPropertyAction = new ViewPropertySelection(getSite().getWorkbenchWindow(), this, this.viewerRight);
 	}
 	
 	/**
Index: TXM/trunk/org.txm.concordance.rcp/src/org/txm/concordance/rcp/actions/SetContextSize.java
===================================================================
--- TXM/trunk/org.txm.concordance.rcp/src/org/txm/concordance/rcp/actions/SetContextSize.java	(revision 3522)
+++ TXM/trunk/org.txm.concordance.rcp/src/org/txm/concordance/rcp/actions/SetContextSize.java	(revision 3523)
@@ -62,8 +62,8 @@
 	 * @param window the window
 	 * @param concordanceEditor the concordance editor
 	 */
-	public SetContextSize(IWorkbenchWindow window,
-			ConcordanceEditor concordanceEditor) {
+	public SetContextSize(IWorkbenchWindow window, ConcordanceEditor concordanceEditor) {
+		
 		this.window = window;
 		this.concordanceEditor = concordanceEditor;
 		setId(ID);
@@ -85,8 +85,7 @@
 	public void run() {
 		SetContextSizeDialog d = new SetContextSizeDialog(window.getShell());
 		if (d.open() == Window.OK) {
-			concordanceEditor.setContextSize(d.getLeftContextSize(), d
-					.getRightContextSize());
+			concordanceEditor.setContextSize(d.getLeftContextSize(), d.getRightContextSize());
 			// concordanceEditor.getConcordance().setLeftContextSize(d.getLeftContextSize());
 			// concordanceEditor.getConcordance().setRightContextSize(d.getRightContextSize());
 			// concordanceEditor.sort();
Index: TXM/trunk/org.txm.concordance.rcp/src/org/txm/concordance/rcp/widgets/ComplexSortSelector.java
===================================================================
--- TXM/trunk/org.txm.concordance.rcp/src/org/txm/concordance/rcp/widgets/ComplexSortSelector.java	(revision 3522)
+++ TXM/trunk/org.txm.concordance.rcp/src/org/txm/concordance/rcp/widgets/ComplexSortSelector.java	(revision 3523)
@@ -169,11 +169,12 @@
 	}
 	
 	/**
-	 * Sets the key.
+	 * Sets a simple sort with ONE key.
+	 * 0,1,2,3 or 4 of the available sorts list
 	 *
 	 * @param no the new key
 	 */
-	public void setKey(int no)
+	public void setSimpleSortKey(int no)
 	{
 		firstKey.select(no);
 		secondKey.select(0);
