diff --git a/doc/function/sort_text.txt b/doc/function/sort_text.txt
index 4fb132df..a6174c38 100644
--- a/doc/function/sort_text.txt
+++ b/doc/function/sort_text.txt
@@ -35,6 +35,9 @@ Parts
| @"pattern(.z. xyz)"@ @"yzz"@ Selects all things that match the pattern, where @"."@ is a wildcard.
The things matching the wildcards are then sorted using the given pattern (separated by a space), and subsituted back in.
So in "zzyyxxy" the pattern matches "zzyxxy" with wildcards "zy" these sort as "yz" and in the pattern this becomes "yzz".
+| @"in_place(yz)"@ @"yyyzxxz"@ Sort everything with the given pattern, and insert the remaining characters in their orignal places.
+ For example, in @"zzyyxxy"@ we match y and z, leaving @"....xx."@.
+ The result of the pattern is @"yyyzz"@, subsituting that back in gives @"yyyzxxz"@.
The parts are read from left to right, each part that matches something removes it from the input, so for example
> sort_text(order: "xx")
diff --git a/doc/type/game.txt b/doc/type/game.txt
index 8baa6799..729b3d85 100644
--- a/doc/type/game.txt
+++ b/doc/type/game.txt
@@ -40,6 +40,7 @@ Such a package contains a [[file:format|data file]] called game that ha
| @keyword modes@ [[type:list]] of [[type:keyword mode]]s Choices for the 'mode' property of keywords.
| @keyword parameter types@ [[type:list]] of [[type:keyword param type]]s Types of parameters available to keywords.
| @keywords@ [[type:list]] of [[type:keyword]]s Standard keywords for this game.
+| @word lists@ [[type:list]] of [[type:word list]]s Word lists that can be used by text fields.
--Examples--
Look at the game files in the standard MSE distribution for examples.
diff --git a/doc/type/tagged_string.txt b/doc/type/tagged_string.txt
index a82565c8..e1ae225b 100644
--- a/doc/type/tagged_string.txt
+++ b/doc/type/tagged_string.txt
@@ -37,6 +37,8 @@ This is written as the character with code 1 in files.
Inserting this tag manually will confuse that function!
This tag can never be selected, and its contents can not be edited.
| @""@ Like @""@, only hidden. This is inserted by [[fun:combined_editor]]
+| @""@ Indicate that the text inside the tag should be selected from a [[type:word list]].
+ The ? must be the name of a word list in the game.
| any other tag Other tags are ignored.
--Related functions--
diff --git a/doc/type/word_list.txt b/doc/type/word_list.txt
new file mode 100644
index 00000000..861b78b2
--- /dev/null
+++ b/doc/type/word_list.txt
@@ -0,0 +1,18 @@
+Data type: word list
+
+A list of words. Used for drop down lists in the text editor, for example for card types.
+
+--Properties--
+! Property Type Default Description
+| @name@ [[type:string]] ''Required'' Name of this word list, refered to using a @""@ tag.
+| @words@ [[type:list]] of [[type:word list word]]s ''Required'' The words in the list
+
+--Example--
+>word list:
+> name: type
+> word: Creature
+> word: Spell
+> word: Artifact
+This can be used with for example:
+> @"Creature"@
+Which gives the creature choice, and that can be changed with a drop down list.
diff --git a/doc/type/word_list_word.txt b/doc/type/word_list_word.txt
new file mode 100644
index 00000000..6ba7614f
--- /dev/null
+++ b/doc/type/word_list_word.txt
@@ -0,0 +1,18 @@
+Data type: word list word
+
+A word in a [[type:word list]].
+
+--Properties--
+! Property Type Default Description
+| @name@ [[type:string]] ''Required'' The word
+| @line below@ [[type:boolean]] @false@ Display a line below this item in the list?
+| @words@ [[type:list]] of [[type:word list word]]s A submenu
+
+A word can also be given in a short form, in that case only the name is specified.
+
+--Example--
+In short form:
+>word: xyz
+Is the same as:
+>word:
+> name: xyz
diff --git a/src/data/game.cpp b/src/data/game.cpp
index 946c0519..7f244c3e 100644
--- a/src/data/game.cpp
+++ b/src/data/game.cpp
@@ -12,6 +12,7 @@
#include
#include
#include
+#include
#include
#include