Index: cpp/frams/genetics/fH/fH_oper.cpp
===================================================================
--- cpp/frams/genetics/fH/fH_oper.cpp	(revision 780)
+++ cpp/frams/genetics/fH/fH_oper.cpp	(revision 797)
@@ -1,2 +1,6 @@
+// This file is a part of Framsticks SDK.  http://www.framsticks.com/
+// Copyright (C) 1999-2018  Maciej Komosinski and Szymon Ulatowski.
+// See LICENSE.txt for details.
+
 #include "fH_oper.h"
 
@@ -421,20 +425,9 @@
 }
 
-void Geno_fH::mutateNeuronHandleProperties(fH_NeuronHandle *handle, ParamEntry *tab, bool userandomclass)
+void Geno_fH::mutateNeuronProperties(SString &det)
 {
 	Neuro neu;
-	Param hpar(tab, handle->obj);
-	SString det = hpar.getStringById("d");
+	det = det == "" ? "N" : det;
 	neu.setDetails(det == "" ? "N" : det);
-	NeuroClass *nc = neu.getClass();
-
-	if (userandomclass)
-	{
-		nc = getRandomNeuroClass();
-		if (!nc) nc = Neuro::getClass("N");
-	}
-
-	det = nc->getName();
-	neu.setDetails(det);
 
 	SyntParam par = neu.classProperties();
@@ -455,32 +448,84 @@
 		if (props != "")
 		{
+			det = neu.getClass()->name;
 			det += ": ";
 			det += props;
-			hpar.setStringById("d", det);
-		}
-	}
-}
-
-uint32_t Geno_fH::style(const char *geno, int pos)
-{
-	char ch = geno[pos];
-	uint32_t style = GENSTYLE_CS(0, GENSTYLE_STRIKEOUT);
-	if (pos == 0 || geno[pos - 1] == '\n' || ch == ':') // single-character handle type and all colons
-	{
-		style = GENSTYLE_CS(GENCOLOR_TEXT, GENSTYLE_BOLD);
-	}
-	else if (isalpha(ch)) // properties name
-	{
-		style = GENSTYLE_RGBS(0, 200, 0, GENSTYLE_BOLD);
-	}
-	else if (isdigit(ch) || strchr(",.=", ch)) // properties values
-	{
-		style = GENSTYLE_CS(GENCOLOR_TEXT, GENSTYLE_NONE);
-	}
-	else if (ch == '\"')
-	{
-		style = GENSTYLE_RGBS(200, 0, 0, GENSTYLE_BOLD);
-	}
-
-	return style;
-}
+		}
+	}
+}
+
+void Geno_fH::mutateNeuronHandleProperties(fH_NeuronHandle *handle, ParamEntry *tab, bool userandomclass)
+{
+	Neuro neu;
+	Param hpar(tab, handle->obj);
+	SString det = hpar.getStringById("d");
+	neu.setDetails(det == "" ? "N" : det);
+	NeuroClass *nc = neu.getClass();
+
+	if (userandomclass)
+	{
+		nc = getRandomNeuroClass();
+		if (!nc) nc = Neuro::getClass("N");
+	}
+
+	det = nc->getName();
+
+	mutateNeuronProperties(det);
+
+	hpar.setStringById("d", det);
+}
+
+//uint32_t Geno_fH::style(const char *geno, int pos)
+//{
+//	char ch = geno[pos];
+//	uint32_t style = GENSTYLE_CS(0, GENSTYLE_STRIKEOUT);
+//	if (pos == 0 || geno[pos - 1] == '\n' || ch == ':') // single-character handle type and all colons
+//	{
+//		style = GENSTYLE_CS(GENCOLOR_TEXT, GENSTYLE_BOLD);
+//	}
+//	else if (isalpha(ch)) // properties name
+//	{
+//		style = GENSTYLE_RGBS(0, 200, 0, GENSTYLE_BOLD);
+//	}
+//	else if (isdigit(ch) || strchr(",.=", ch)) // properties values
+//	{
+//		style = GENSTYLE_CS(GENCOLOR_TEXT, GENSTYLE_NONE);
+//	}
+//	else if (ch == '\"')
+//	{
+//		style = GENSTYLE_RGBS(200, 0, 0, GENSTYLE_BOLD);
+//	}
+//
+//	return style;
+//}
+
+uint32_t Geno_fH::style(const char *g, int pos)
+{
+   char ch=g[pos];
+   uint32_t style=GENSTYLE_CS(0,GENSTYLE_NONE); //default, should be changed below
+
+   int pp=pos; //detect comment line
+   while (pp>1 && g[pp-1]!='\n') pp--;
+   if (g[pp]=='#') return GENSTYLE_RGBS(0,220,0,GENSTYLE_NONE); //comment line
+
+   if (pos==0 || g[pos-1]=='\n' || ch==':' || ch==',') style=GENSTYLE_CS(0,GENSTYLE_BOLD); else
+     if (ch=='\"') style=GENSTYLE_RGBS(150,0,0,GENSTYLE_BOLD); else
+     {
+      int cudz=0,neuclass=1; //ile cudz. do poczatku linii; czy w nazwie neuroklasy?
+      while (pos>0)
+      {
+         pos--;
+         if (g[pos]=='\"') cudz++;
+         if (cudz==0 && (g[pos]==':' || g[pos]==',')) neuclass=0;
+         if (g[pos]=='\n') break;
+      }
+      if (cudz%2)
+      {
+         if (neuclass) style=GENSTYLE_RGBS(150,0,150,GENSTYLE_BOLD); else //neuroclass
+           if (isalpha(ch)) style=GENSTYLE_RGBS(255,140,0,GENSTYLE_BOLD); else //property
+             style=GENSTYLE_RGBS(200,0,0,GENSTYLE_NONE);
+      } else
+        if (isalpha(ch)) style=GENSTYLE_RGBS(0,0,200,GENSTYLE_BOLD);
+     }
+   return style;
+}
