Index: typo3/sysext/rtehtmlarea/extensions/Acronym/class.tx_rtehtmlarea_acronym.php
===================================================================
--- typo3/sysext/rtehtmlarea/extensions/Acronym/class.tx_rtehtmlarea_acronym.php	(révision 4132)
+++ typo3/sysext/rtehtmlarea/extensions/Acronym/class.tx_rtehtmlarea_acronym.php	(copie de travail)
@@ -2,7 +2,7 @@
 /***************************************************************
 *  Copyright notice
 *
-*  (c) 2008 Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca>
+*  (c) 2008 Stanislas Rolland <typo3(arobas)sjbr.ca>
 *  All rights reserved
 *
 *  This script is part of the Typo3 project. The Typo3 project is
@@ -24,7 +24,7 @@
 /**
  * Acronym extension for htmlArea RTE
  *
- * @author Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca>
+ * @author Stanislas Rolland <typo3(arobas)sjbr.ca>
  *
  * TYPO3 SVN ID: $Id$
  *
@@ -131,8 +131,8 @@
 		$whereClause .= t3lib_BEfunc::deleteClause($table);
 		$res = $TYPO3_DB->exec_SELECTquery('type,term,acronym', $table, $whereClause);
 		while($acronymRow = $TYPO3_DB->sql_fetch_assoc($res))    {
-			if( $acronymRow['type'] == 1) $JSAcronymArray .= (($this->acronymIndex++)?',':'') . '"' . $acronymRow['acronym'] . '":"' . $acronymRow['term'] . '"' . $linebreak;
-			if ($acronymRow['type'] == 2) $JSAbbreviationArray .= (($this->AbbreviationIndex++)?',':'') . '"' . $acronymRow['acronym'] . '":"' . $acronymRow['term'] . '"' . $linebreak;
+			if( $acronymRow['type'] == 1) $JSAcronymArray .= (($this->acronymIndex++)?',':'') . '"' . $acronymRow['term'] . '":"' . $acronymRow['acronym'] . '"' . $linebreak;
+			if ($acronymRow['type'] == 2) $JSAbbreviationArray .= (($this->AbbreviationIndex++)?',':'') . '"' . $acronymRow['term'] . '":"' . $acronymRow['acronym'] . '"' . $linebreak;
 		}
 		$JSAcronymArray .= '};' . $linebreak;
 		$JSAbbreviationArray .= '};' . $linebreak;
Index: typo3/sysext/rtehtmlarea/mod2/class.tx_rtehtmlarea_acronym_mod.php
===================================================================
--- typo3/sysext/rtehtmlarea/mod2/class.tx_rtehtmlarea_acronym_mod.php	(révision 4132)
+++ typo3/sysext/rtehtmlarea/mod2/class.tx_rtehtmlarea_acronym_mod.php	(copie de travail)
@@ -89,7 +89,7 @@
 					document.getElementById("abbrType").innerHTML = "' . $LANG->getLL('Abbreviation') . '";
 				}
 				document.getElementById("title").value = param["title"];
-				fillSelect(param["text"]);
+				fillSelect(param);
 				dialog.resize();
 			}
 			
@@ -115,22 +115,46 @@
 				document.getElementById("title").focus();
 			};
 			
-			function fillSelect(text) {
+			function fillSelect(param) {
 				var termSelector = document.getElementById("termSelector");
 				var acronymSelector = document.getElementById("acronymSelector");
-				while(termSelector.options.length>1) termSelector.options[termSelector.length-1] = null;
-				while(acronymSelector.options.length>1) acronymSelector.options[acronymSelector.length-1] = null;
-				if(abbrType == "acronym") var abbrObj = acronyms;
-					else var abbrObj = abbreviations;
-				if(abbrObj != "") {
-					for(var i in abbrObj) {
-						same = (i==text);
-						termSelector.options[termSelector.options.length] = new Option(abbrObj[i], abbrObj[i], false, same);
-						acronymSelector.options[acronymSelector.options.length] = new Option(i, i, false, same);
-						if(same) document.content.title.value = abbrObj[i];
+				while (termSelector.options.length > 1) {
+					termSelector.options[termSelector.length-1] = null;
+				}
+				while (acronymSelector.options.length > 1) {
+					acronymSelector.options[acronymSelector.length-1] = null;
 					}
+				if (abbrType == "acronym") {
+					var abbrObj = acronyms;
+				} else {
+					var abbrObj = abbreviations;
 				}
-				if(acronymSelector.options.length == 1) {
+				if (abbrObj != "") {
+					var sameTerm = false;
+					var sameAbbreviation = false;
+					var selectedOption = false;
+					for (var i in abbrObj) {
+						if (abbrObj.hasOwnProperty(i)) {
+							if (param["title"]) {
+								sameTerm = (param["title"] == i);
+							} else {
+								sameTerm = (param["text"] == i);
+							}
+							sameAbbreviation = (param["text"] == abbrObj[i]);
+							if (!selectedOption && (sameTerm || sameAbbreviation)) {
+								selectedOption = i;
+							}
+							if (!param["text"] || sameTerm || sameAbbreviation) {
+								termSelector.options[termSelector.options.length] = new Option(i, i, false, (selectedOption == i));
+								acronymSelector.options[acronymSelector.options.length] = new Option(abbrObj[i], abbrObj[i], false, (selectedOption == i));
+							}
+							if (selectedOption == i) {
+								document.content.title.value = i;
+							}
+						}
+					}
+				}
+				if (acronymSelector.options.length == 1) {
 					document.getElementById("selector").style.display = "none";
 				} else {
 					document.getElementById("selector").style.display = "block";
