Index: Scribus/scribus/canvasmode_legacy.cpp
===================================================================
--- Scribus/scribus/canvasmode_legacy.cpp	(wersja 16552)
+++ Scribus/scribus/canvasmode_legacy.cpp	(kopia robocza)
@@ -1802,7 +1802,7 @@
                                                                // K.I.S.S.:
                                                                currItem->oldCPos = 0;
                                                                currItem->itemText.insertChars(0, cc, true);
-								currItem->asTextFrame()->updateUndo(PageItem::INS,cc);
+								currItem->asTextFrame()->updateUndo(PageItem::INS,ETEAinsertingText, cc);
                                                                if (m_doc->docHyphenator->AutoCheck)
                                                                        m_doc->docHyphenator->slotHyphenate(currItem);
                                                                m_ScMW->BookMarkTxT(currItem);
Index: Scribus/scribus/pageitem.cpp
===================================================================
--- Scribus/scribus/pageitem.cpp	(wersja 16552)
+++ Scribus/scribus/pageitem.cpp	(kopia robocza)
@@ -957,6 +957,51 @@

 void PageItem::setGridOffset(double) { } // FIXME
 void PageItem::setGridDistance(double) { } // FIXME
+void PageItem::setColsGapDist(int newCols, double newGap, double newLeft, double newRight, double newTop, double newBottom)
+{
+	setUndoColsGapDist(newCols, newGap, newLeft, newRight, newTop, newBottom);
+	setColumns(newCols);
+	setColumnGap(newGap);
+	setTextToFrameDist(newLeft, newRight, newTop, newBottom);
+}
+void PageItem::setUndoColsGapDist(int newCols, double newGap, double newLeft, double newRight, double newTop, double newBottom)
+{
+	if (UndoManager::undoEnabled())
+	{
+		SimpleState * ss = NULL;
+		if (asTextFrame()->getLastUndoAction() == STORY && asTextFrame()->getLastETEA() == ETEAsetColsGapDist)
+			ss = (SimpleState*) undoManager->getLastUndoState();
+		if (ss && ss->undoObject() == this && ss->contains("COLSGAPDIST"))
+		{
+			ss->set("NEW_COLS", newCols);
+			ss->set("NEW_GAP", newGap);
+			ss->set("NEW_DLEFT", newLeft);
+			ss->set("NEW_DRIGHT", newRight);
+			ss->set("NEW_DTOP", newTop);
+			ss->set("NEW_DBOTTOM", newBottom);
+		}
+		else
+		{
+			ss = new SimpleState(Um::setColsGapDist);
+			ss->set("COLSGAPDIST","ColsGapDist");
+			ss->set("OLD_COLS", Cols);
+			ss->set("NEW_COLS", newCols);
+			ss->set("OLD_GAP", ColGap);
+			ss->set("NEW_GAP", newGap);
+			ss->set("OLD_DLEFT", Extra);
+			ss->set("NEW_DLEFT", newLeft);
+			ss->set("OLD_DRIGHT", RExtra);
+			ss->set("NEW_DRIGHT", newRight);
+			ss->set("OLD_DTOP", TExtra);
+			ss->set("NEW_DTOP", newTop);
+			ss->set("OLD_DBOTTOM", BExtra);
+			ss->set("NEW_DBOTTOM", newBottom);
+			undoManager->action(this, ss);
+			asTextFrame()->setLastUndoAction(STORY);
+			asTextFrame()->setLastETEA(ETEAsetColsGapDist);
+		}
+	}
+}
 void PageItem::setColumns(int n)
 {
        Cols = qMax(1, n); //FIXME: undo
@@ -3143,6 +3188,9 @@
        }
        if (ss)
        {
+		//for autoselecting item on undo/redo
+		m_Doc->scMW()->selectItemsFromOutlines(this);
+
                if (ss->contains("OLD_XPOS"))
                        restoreMove(ss, isUndo);
                else if (ss->contains("OLD_HEIGHT"))
@@ -3256,6 +3304,10 @@
                        restoreLinkTextFrame(ss,isUndo);
                else if (ss->contains("UNLINK_TEXT_FRAME"))
                        restoreUnlinkTextFrame(ss,isUndo);
+		else if (ss->contains("COLSGAPDIST"))
+			restoreColsGapDist(ss, isUndo);
+		else if (ss->contains("FIRSTLINEOFFS"))
+			restoreFirstLineOffset(ss, isUndo);
        }
        if (!OnMasterPage.isEmpty())
                m_Doc->setCurrentPage(oldCurrentPage);
@@ -3506,6 +3558,15 @@
        //	m_Doc->chAbStyle(this, styleid);
 }

+void PageItem::restoreColsGapDist(SimpleState *state, bool isUndo)
+{
+	if (isUndo)
+		setColsGapDist(state->getInt("OLD_COLS"), state->getDouble("OLD_GAP"), state->getDouble("OLD_DLEFT"), state->getDouble("OLD_DRIGHT"), state->getDouble("OLD_DTOP"), state->getDouble("OLD_DBOTTOM"));
+	else
+		setColsGapDist(state->getInt("NEW_COLS"), state->getDouble("NEW_GAP"), state->getDouble("NEW_DLEFT"), state->getDouble("NEW_DRIGHT"), state->getDouble("NEW_DTOP"), state->getDouble("NEW_DBOTTOM"));
+	update();
+	asTextFrame()->clearLastUndoAction();
+}

 // FIXME: This must go into class ScribusDoc!
 // For now we'll just make it independent of 'this' -- AV
@@ -3671,6 +3732,15 @@
        }
 }

+void PageItem::restoreFirstLineOffset(SimpleState *state, bool isUndo)
+{
+	if (isUndo)
+		setFirstLineOffset((FirstLineOffsetPolicy)state->getInt("OLD_FLOP"));
+	else
+		setFirstLineOffset((FirstLineOffsetPolicy)state->getInt("NEW_FLOP"));
+	update();
+	asTextFrame()->clearLastUndoAction();
+}

 void PageItem::restorePoly(SimpleState *state, bool isUndo, bool isContour)
 {
@@ -3844,10 +3914,16 @@
 {
        if (!isTextFrame())
                return;
+	int oldSelStart = 0, oldSelLen = 0;
+	if (HasSel)
+	{
+		oldSelStart = itemText.startOfSelection();
+		oldSelLen = itemText.lengthOfSelection();
+	}
        itemText.deselectAll();
        HasSel = false;
        EditAct action = (EditAct) state->getInt("STEXT");
-	if (action == PARAMFULL || action == PARAMSEL)
+	if (action == STORY || action == PARAGRAPH || action == SELECTION)
        {
                QString buffer;
                if (isUndo)
@@ -3862,29 +3938,28 @@
                        dig.addRule("/SCRIBUSTEXT", desaxe::Result<StoryText>());
                        dig.parseMemory(buffer.toStdString().c_str(), buffer.length());
                        StoryText* story = dig.result<StoryText>();
-			if (action == PARAMFULL)
+			if (action == STORY)
                        {
                                itemText.selectAll();
                                itemText.clear();
                                itemText.append(*story);
+				CPos = 0;
                        }
-			else if (action == PARAMSEL)
+			else if (action == PARAGRAPH || action == SELECTION)
                        {
-				itemText.deselectAll();
                                int SelStart = state->getInt("STEXT_SELSTART");
-				itemText.select(SelStart,state->getInt("STEXT_SELLEN"));
+				int SelLen = state->getInt("STEXT_SELLEN");
+				itemText.select(SelStart,SelLen);
+				if (action == PARAGRAPH)
+					asTextFrame()->expandParaSelection();
                                asTextFrame()->deleteSelectedTextFromFrame();
+				itemText.insert(SelStart, *story);
                                int ItemLength = itemText.length();
-				itemText.insert(SelStart, *story);
                                // If we have inserted at end of text we have to restore trailing style
                                if (ItemLength == SelStart && story->length() > 0 && story->text(-1) != SpecialChars::PARSEP)
-				{
-					itemText.setStyle(-1, story->paragraphStyle(story->length()));
-				}
-				itemText.select(SelStart, story->length());
-				HasSel = true;
+				    itemText.setStyle(-1, story->paragraphStyle(story->length()));
+				CPos = state->getInt("STEXT_CPOS");
                        }
-			CPos = itemText.endOfSelection();
                        delete story;
                }
                else { qDebug() << "UNDO buffer EMPTY";}
@@ -3967,55 +4042,55 @@
                }
        }
        // after Undo or Redo new actions should create new undoStates
-	asTextFrame()->lastUndoAction = NOACTION;
+	asTextFrame()->clearLastUndoAction();
+
+	if (oldSelLen >0 && (action == PARAGRAPH || action == SELECTION))
+		asTextFrame()->restoreTextSelection(oldSelStart, oldSelLen);

        m_Doc->scMW()->setTBvals(this);
        update();
 }

-QString PageItem::getItemTextSaxed(EditActPlace undoItem)
+QString PageItem::getItemTextSaxed(EditAct action)
 {
        if (!isTextFrame()) return "";
        StoryText iT(m_Doc);
        iT.setDefaultStyle(itemText.defaultStyle());
-	if (undoItem == FRAME)
-		iT.insert(0, itemText);
+	int oldSelStart = CPos, oldSelLen = 0;
+	if (action == STORY)
+		HasSel = false;
        else
        {
-		int StartOldSel = -1, LenOldSel = -1;
-		if (undoItem == PARAGRAPH)
+		if (HasSel)
                {
-			LenOldSel = 0;
-			if (HasSel)
+			oldSelStart = itemText.startOfSelection();
+			oldSelLen = itemText.lengthOfSelection();
+		}
+		if (action == PARAGRAPH)
+			asTextFrame()->expandParaSelection();
+		else if (action == SELECTION && !HasSel)
+		{
+			//case when there was not any selection, action was not paragraph related
+			// so changes will be applied for one char on right of cursor position
+			//if cursor is not at the end of paragraph or text
+			if (CPos >= itemText.length()
+			        || itemText.text(CPos) == SpecialChars::PARSEP
+			        || itemText.text(CPos) == SpecialChars::COLBREAK
+			        || itemText.text(CPos) == SpecialChars::FRAMEBREAK
+			        || itemText.text(CPos) == SpecialChars::LINEBREAK
+			        || itemText.text(CPos) == SpecialChars::OBJECT
+			        || itemText.text(CPos) == SpecialChars::SHYPHEN)
+				return "";
+			else
                        {
-				StartOldSel = itemText.startOfSelection();
-				LenOldSel = itemText.lengthOfSelection();
+				itemText.select(CPos, 1);
+				HasSel = true;
                        }
-			asTextFrame()->expandParaSelection(true);
                }
-		else if (undoItem == CHAR || (undoItem == SELECTION && !HasSel))
-		{
-			LenOldSel = itemText.lengthOfSelection();
-			if (LenOldSel > 0)
-				StartOldSel = itemText.startOfSelection();
-			if (CPos >= itemText.length())
-				return  "";
-			itemText.select(CPos,1);
-			HasSel = true;
-		}
-		//is SELECTION
-		iT.insert(0, itemText, HasSel);
-		if (LenOldSel > 0) //restoring old selection if undoItem was PARAPGRAPH
-		{
-			itemText.select(StartOldSel, LenOldSel);
-			HasSel = true;
-		}
-		else if (LenOldSel == 0)
-		{
-			itemText.deselectAll();
-			HasSel = false;
-		}
        }
+	iT.insert(0, itemText, HasSel);
+	asTextFrame()->restoreTextSelection(oldSelStart, oldSelLen);
+
        //saxing text
        std::ostringstream xmlString;
        SaxXML xmlStream(xmlString);
@@ -4026,42 +4101,6 @@
        return QString(xml.c_str());
 }

-QString PageItem::getItemTextSaxed(int selStart, int selLength)
-{
-	if (selStart < 0 || selLength < 0)
-		return QString();
-
-	StoryText it(m_Doc);
-	it.setDefaultStyle(itemText.defaultStyle());
-
-	int oldSelStart = -1, oldSelLength = -1;
-	oldSelStart  = itemText.startOfSelection();
-	oldSelLength = itemText.lengthOfSelection();
-
-	itemText.select(selStart, selLength);
-	it.insert(0, itemText, (selLength > 0));
-
-	if (oldSelLength > 0) //restoring old selection if undoItem was PARAPGRAPH
-	{
-		itemText.select(oldSelStart, oldSelLength);
-		HasSel = true;
-	}
-	else if (oldSelLength == 0)
-	{
-		itemText.deselectAll();
-		HasSel = false;
-	}
-
-	//saxing text
-	std::ostringstream xmlString;
-	SaxXML xmlStream(xmlString);
-	xmlStream.beginDoc();
-	it.saxx(xmlStream, "SCRIBUSTEXT");
-	xmlStream.endDoc();
-	std::string xml(xmlString.str());
-	return QString(xml.c_str());
-}
-
 QString PageItem::getTextSaxed(QString str)
 {
        StoryText iT(m_Doc);
@@ -4079,7 +4118,7 @@
 void PageItem::select()
 {
        if (m_Doc->m_Selection->count() == 1 && m_Doc->m_Selection->itemAt()->isTextFrame())
-		m_Doc->m_Selection->itemAt()->asTextFrame()->lastUndoAction = PageItem::NOACTION;
+		m_Doc->m_Selection->itemAt()->asTextFrame()->clearLastUndoAction();
        m_Doc->view()->Deselect(false);
        //CB #2969 add this true parm to addItem so we dont connectToGUI, the rest of view->SelectItem isnt needed anyway
        m_Doc->m_Selection->addItem(this, true);
@@ -5980,11 +6019,38 @@
        return htmlText;
 }

+
 FirstLineOffsetPolicy PageItem::firstLineOffset() const
 {
        return firstLineOffsetP;
 }

+void PageItem::setFirstLineOffset(FirstLineOffsetPolicy flop, bool createUndo)
+{
+	if(firstLineOffsetP != flop)
+	{
+		if (createUndo && UndoManager::undoEnabled())
+		{
+			SimpleState * ss = NULL;
+			if (asTextFrame()->getLastUndoAction() == STORY && asTextFrame()->getLastETEA() == ETEAsetFirstLineOffset)
+				ss = (SimpleState*) undoManager->getLastUndoState();
+			if (ss && ss->undoObject() == this && ss->contains("FIRSTLINEOFFS"))
+				ss->set("NEW_FLOP", flop);
+			else
+			{
+				ss = new SimpleState(Um::SetFirstLineOffset);
+				ss->set("FIRSTLINEOFFS", "FirstLineOffset");
+				ss->set("OLD_FLOP", (int) firstLineOffsetP);
+				ss->set("NEW_FLOP", flop);
+				undoManager->action(this, ss);
+				asTextFrame()->setLastUndoAction(STORY);
+				asTextFrame()->setLastETEA(ETEAsetFirstLineOffset);
+			}
+		}
+		firstLineOffsetP = flop;
+	}
+}
+
 void PageItem::setFirstLineOffset(FirstLineOffsetPolicy flop)
 {
        if(firstLineOffsetP != flop)
@@ -5993,7 +6059,3 @@
        }
 }

-
-
-
-
Index: Scribus/scribus/pageitem_textframe.cpp
===================================================================
--- Scribus/scribus/pageitem_textframe.cpp	(wersja 16539)
+++ Scribus/scribus/pageitem_textframe.cpp	(kopia robocza)
@@ -30,7 +30,7 @@
 #include <QRegion>
 #include <cassert>

-
+#include "actionmanager.h"
 #include "canvas.h"
 #include "commonstrings.h"
 #include "guidemanager.h"
@@ -69,8 +69,7 @@
        unicodeTextEditMode = false;
        unicodeInputCount = 0;
        unicodeInputString = "";
-	lastUndoAction = NOACTION;
-//	lastAction4Paragraph = false;
+	clearLastUndoAction();

        connect(&itemText,SIGNAL(changed()), this, SLOT(slotInvalidateLayout()));
 }
@@ -82,8 +81,7 @@
        unicodeTextEditMode = false;
        unicodeInputCount = 0;
        unicodeInputString = "";
-	lastUndoAction = NOACTION;
-//	lastAction4Paragraph = false;
+	clearLastUndoAction();

        connect(&itemText,SIGNAL(changed()), this, SLOT(slotInvalidateLayout()));
 }
@@ -2659,11 +2657,11 @@
        PageItem *nextItem = this;
        while (nextItem->prevInChain() != 0)
                nextItem = nextItem->prevInChain();
-	nextItem->itemTextSaxed = nextItem->getItemTextSaxed(PageItem::FRAME); //for undo
+	nextItem->itemTextSaxed = nextItem->getItemTextSaxed(PageItem::STORY); //for undo
        ParagraphStyle defaultStyle = nextItem->itemText.defaultStyle();
        nextItem->itemText.clear();
        nextItem->itemText.setDefaultStyle(defaultStyle);
-	nextItem->asTextFrame()->updateUndo(); //for undo
+	nextItem->asTextFrame()->updateUndo(PageItem::STORY, ETEAclearContents); //for undo
        while (nextItem != 0)
        {
                nextItem->CPos = 0;
@@ -2716,7 +2714,7 @@
        case Qt::Key_Down:
                if ( (buttonModifiers & Qt::ShiftModifier) == 0 )
                        deselectAll();
-		lastUndoAction = PageItem::NOACTION;
+		clearLastUndoAction();
        }

        if (unicodeTextEditMode)
@@ -2745,22 +2743,19 @@
                                {
                                        itemTextSaxed = getItemTextSaxed(PageItem::SELECTION);
                                        deleteSelectedTextFromFrame();
-					lastUndoAction = PageItem::NOACTION;
+					clearLastUndoAction();
                                }
                                if (conv < 31)
                                        conv = 32;
                                if (conv == 32)
-				{
-					qDebug() << "SPACE conv?";
-					lastUndoAction = PageItem::NOACTION;
-				}
+					clearLastUndoAction();
                                oldCPos = CPos;
                                itemText.insertChars(CPos, QString(QChar(conv)), true);
                                CPos += 1;
                                if (itemTextSaxed.isEmpty())
-					updateUndo(INS, QString(QChar(conv)));
+					updateUndo(INS, ETEAinsertingText, QString(QChar(conv)));
                                else
-					updateUndo(REPSAX, getTextSaxed(QString(QChar(conv))));
+					updateUndo(REPSAX, ETEAreplacingText, getTextSaxed(QString(QChar(conv))));
 //				Tinput = true;
                                m_Doc->scMW()->setTBvals(this);
                                update();
@@ -3040,7 +3035,7 @@
                                oldCPos = itemText.startOfSelection();
                                itemTextSaxed = getItemTextSaxed(PageItem::SELECTION);
                                deleteSelectedTextFromFrame();
-				updateUndo(DELSAX);
+				updateUndo(DELSAX, ETEAdeletingText);
                                m_Doc->scMW()->setTBvals(this);
                                update();
 //				view->RefreshItem(this);
@@ -3062,7 +3057,7 @@
                oldCPos = itemText.startOfSelection();
                itemTextSaxed = getItemTextSaxed(PageItem::SELECTION);
                deleteSelectedTextFromFrame();
-		updateUndo(DELSAX);
+		updateUndo(DELSAX, ETEAdeletingText);
                update();
 //		Tinput = false;
                if ((cr == QChar(13)) && (itemText.length() != 0))
@@ -3081,7 +3076,7 @@
                                oldCPos = itemText.startOfSelection();
                                itemTextSaxed = getItemTextSaxed(PageItem::SELECTION);
                                deleteSelectedTextFromFrame();
-				updateUndo(DELSAX);
+				updateUndo(DELSAX, ETEAdeletingText);
                                m_Doc->scMW()->setTBvals(this);
                                update();
                        }
@@ -3099,7 +3094,7 @@
                oldCPos = itemText.startOfSelection();
                itemTextSaxed = getItemTextSaxed(PageItem::SELECTION);
                deleteSelectedTextFromFrame();
-		updateUndo(DELSAX);
+		updateUndo(DELSAX, ETEAdeletingText);
 //		Tinput = false;
                if ((cr == QChar(13)) && (itemText.length() != 0))
                {
@@ -3130,7 +3125,7 @@
                                oldCPos = itemText.startOfSelection();
                                itemTextSaxed = getItemTextSaxed(PageItem::SELECTION);
                                deleteSelectedTextFromFrame();
-				lastUndoAction = PageItem::NOACTION;
+				clearLastUndoAction();
                                doUpdate = true;
                        }
                        /*
@@ -3149,11 +3144,11 @@
                        oldCPos = CPos;
                        itemText.insertChars(CPos, QString(SpecialChars::TAB), true);
                        CPos += 1;
-			lastUndoAction = PageItem::NOACTION;
+			clearLastUndoAction();
                        if (itemTextSaxed.isEmpty())
-				updateUndo(INS, QString(SpecialChars::TAB));
+				updateUndo(INS, ETEAManageTabs, QString(SpecialChars::TAB));
                        else
-				updateUndo(REPSAX, getTextSaxed(QString(SpecialChars::TAB)));
+				updateUndo(REPSAX, ETEAManageTabs, getTextSaxed(QString(SpecialChars::TAB)));
 //			Tinput = true;
 //			view->RefreshItem(this);
                        doUpdate = true;
@@ -3161,15 +3156,15 @@
                else if ((uc[0] > QChar(31) && m_Doc->currentStyle.charStyle().font().canRender(uc[0])) || (as == 13) || (as == 30))
                {
                        if (uc[0] == QChar(32) || uc[0] == QChar(13))
-				lastUndoAction = PageItem::NOACTION;
-			if (lastUndoAction != PageItem::INS)
+				clearLastUndoAction();
+			if (getLastUndoAction() != PageItem::INS)
                                oldCPos = CPos;
                        itemText.insertChars(CPos, uc, true);
                        CPos += 1;
                        if (itemTextSaxed.isEmpty())
-				updateUndo(INS, uc);
+				updateUndo(INS, ETEAinsertingText, uc);
                        else
-				updateUndo(REPSAX, getTextSaxed(uc));
+				updateUndo(REPSAX, ETEAreplacingText, getTextSaxed(uc));
                        if ((m_Doc->docHyphenator->AutoCheck) && (CPos > 1))
                        {
                                Twort = "";
@@ -3332,46 +3327,38 @@
 // 	layoutWeakLock = true;
 // 	update();
        m_Doc->regionsChanged()->update(getBoundingRect());
-	lastUndoAction = PageItem::NOACTION;
+	clearLastUndoAction();
 }

-void PageItem_TextFrame::ExpandParSel() //expand selection to whole paragrpah(s)
-{
-	if (m_Doc->appMode != modeEdit)
-		return;
-	int StartSel = 0, LenSel = 0;
-	if (HasSel)
-	{
-		//extend selection to whole paragraphs
-		StartSel = itemText.startOfParagraph(itemText.nrOfParagraph(itemText.startOfSelection()));
-		LenSel = itemText.endOfParagraph(itemText.nrOfParagraph(itemText.endOfSelection())) - StartSel;
-	}
-	else
-	{
-		//extend selection to whole paragraph
-		StartSel = itemText.startOfParagraph(itemText.nrOfParagraph(CPos));
-		LenSel = itemText.endOfParagraph(itemText.nrOfParagraph(CPos)) - StartSel;
-	}
-	itemText.select(StartSel, LenSel);
-	HasSel = true;
-}
-
 void PageItem_TextFrame::expandParaSelection(bool includeEOL)
 {
        int selStart, selLength;
-	if (HasSel)
+	if (itemText.lengthOfSelection() >0)
        {
+		if (CPos == itemText.endOfSelection() && CPos < itemText.length())
+			//hack for situation, when CPos is before first char of next paragraph
+			//it add unselected paragraph if cursor is at its beginning
+			itemText.select(itemText.startOfSelection(), itemText.lengthOfSelection() +1);
+
+		//remove PARSEP from end of selection - will be added if includeEOL is true
+		if (itemText.text(itemText.endOfSelection()-1) == SpecialChars::PARSEP)
+		{
+			selStart = itemText.startOfSelection();
+			selLength = itemText.lengthOfSelection() -1;
+			itemText.deselectAll();
+			itemText.select(selStart, selLength);
+		}
                //extend selection to whole paragraphs
                selStart  = itemText.startOfParagraph(itemText.nrOfParagraph(itemText.startOfSelection()));
-		selLength = itemText.endOfParagraph(itemText.nrOfParagraph(itemText.endOfSelection())) - selStart;
+		selLength = itemText.endOfParagraph(itemText.nrOfParagraph(itemText.endOfSelection()-1)) - selStart;
        }
        else
        {
-		//extend selection to whole paragraph
+		//extend selection to whole paragraph where is cursor
                selStart  = itemText.startOfParagraph(itemText.nrOfParagraph(CPos));
                selLength = itemText.endOfParagraph(itemText.nrOfParagraph(CPos)) - selStart;
        }
-	if (includeEOL)
+	if (includeEOL && itemText.text(selStart + selLength -1) != SpecialChars::PARSEP)
                selLength += 1;
        selLength = qMin(selLength, itemText.length() - selStart);

@@ -3398,7 +3385,7 @@
        }
        //CB Replace with direct call for now //emit HasNoTextSel();
        m_Doc->scMW()->DisableTxEdit();
-	lastUndoAction = PageItem::NOACTION;
+	clearLastUndoAction();
 }

 double PageItem_TextFrame::columnWidth()
@@ -3659,48 +3646,62 @@
        invalidateLayout();
 }

-void PageItem_TextFrame::updateUndo(EditAct action, QString str)
+void PageItem_TextFrame::updateUndo(EditAct action, exactlyTextEditAct newAction, QString str)
 {
        if (UndoManager::undoEnabled() && undoManager->undoEnabled())
        {
-		int oldSelStart = -1, oldSelLen = -1;
+		int oldSelStart = CPos, oldSelLen = 0;
                oldSelLen = itemText.lengthOfSelection();
                if (oldSelLen > 0)
                        oldSelStart = itemText.startOfSelection();
-		if (action == PARAMFULL && m_Doc->appMode == modeEdit)
+		if (m_Doc->appMode == modeEdit && action == STORY && oldSelLen == 0 && CPos <= itemText.length())
                {
-			//action is for paragraph where cursor is
-			expandParaSelection(true);
-			action = PARAMSEL;
+			if (itemText.itemText(CPos) == SpecialChars::PARSEP
+			        || itemText.text(CPos) == SpecialChars::COLBREAK
+			        || itemText.text(CPos) == SpecialChars::FRAMEBREAK
+			        || itemText.text(CPos) == SpecialChars::LINEBREAK
+			        || itemText.text(CPos) == SpecialChars::OBJECT
+			        || itemText.text(CPos) == SpecialChars::SHYPHEN)
+			//case of cursor at the end of paragraph, no slection, no paragraph related change
+			// FIX ME - if changes in PP are not applied for text lets disable it or let select word if nothing is selected
+			{
+				return;
+			}
+			else
+			{
+				//action for one character on the right from cursor
+				action = SELECTION;
+				itemText.select(CPos, 1);
+				HasSel = true;
+			}
                }
-		if (CPos >= itemText.length() && itemTextSaxed.isEmpty() && action == PARAMFULL && m_Doc->appMode == modeEdit)
+		if (CPos >= itemText.length() && itemTextSaxed.isEmpty() && action == STORY && m_Doc->appMode == modeEdit)
                {
-			//case when cursor is after last character without selection and nothing was and will be done
                        //changes will be ignored
-			lastUndoAction = PageItem::NOACTION;
+			clearLastUndoAction();
                        restoreTextSelection(oldSelStart, oldSelLen);
                        return;
                }
                SimpleState* ss;
                bool newState = true;  // indicate when new undoState should be created
-		if (lastUndoAction == action && action != REPSAX && action != DELSAX)
+		if (getLastUndoAction() == action && action != REPSAX && action != DELSAX)
                {
                        ss = (SimpleState*) undoManager->getLastUndoState();
                        if (ss && ss->undoObject() == this)
                        {
-				if (action == PARAMFULL || action == PARAMSEL)
+				if (action == STORY || action == PARAGRAPH || action == SELECTION)
                                {
-					newState = false;
-					if (itemTextSaxed.length() > 0)
+					if (getLastETEA() == newAction)
                                        {
-						/*QString tmpStr = ss->get("STEXT_NEW");
-						newState = (tmpStr.length() > 0 && tmpStr != itemTextSaxed);*/
-						newState = true;
+						newState = false;
+						if (itemTextSaxed.length() > 0)
+						{
+							QString tmpStr = ss->get("STEXT_NEW");
+							newState = (tmpStr.length() > 0 && tmpStr != itemTextSaxed);
+						}
+						if (newState == false)
+							itemTextSaxed = ss->get("STEXT_OLD");
                                        }
-					if (newState == false)
-					{
-						itemTextSaxed = ss->get("STEXT_OLD");
-					}
                                }
                                else if (action == INSSAX || action == INS)
                                {
@@ -3713,7 +3714,33 @@
                }
                if (newState)
                {
-			ss = new SimpleState(UndoManager::EditText);
+			QString descript;
+			switch (action)
+			{
+			case STORY:
+				descript = tr("Changing whole text");
+				break;
+			case PARAGRAPH:
+				descript = tr("Changing selected paragraph(s)");
+				break;
+			case SELECTION:
+				descript = tr("Changing selected text");
+				break;
+			case INSSAX:
+			case INS:
+			case DELSAX:
+			case REPSAX:
+			case NOACTION:
+			default:
+				break;
+			}
+			if (newAction >0)
+			{
+				if (!descript.isEmpty())
+					descript += "\n";
+				descript += doc()->scMW()->actionManager->textEditActionDescriptions.value(newAction,"");
+			}
+			ss = new SimpleState(UndoManager::EditText, descript);
                        ss->set("STEXT_CPOS", oldCPos);
                }
                if (action == INSSAX || action == INS)
@@ -3727,24 +3754,18 @@
                }
                else
                {
-			if (action == PARAMFULL && m_Doc->appMode == modeEdit)
+			if (action == PARAGRAPH || action == SELECTION)
                        {
-				//action is for paragraph where cursor is
-				expandParaSelection(true);
-				action = PARAMSEL;
-			}
-			if (action == PARAMSEL)
-			{
+				if (action == PARAGRAPH)
+					expandParaSelection(false);
                                ss->set("STEXT_CPOS",CPos);
                                ss->set("STEXT_SELSTART", itemText.startOfSelection());
                                ss->set("STEXT_SELLEN", itemText.lengthOfSelection());
                        }
                        ss->set("STEXT_OLD", itemTextSaxed);
-			itemTextSaxed = getItemTextSaxed((action == PARAMSEL) ? SELECTION : FRAME);
-			ss->set("STEXT_NEW", itemTextSaxed);
+			ss->set("STEXT_NEW", getItemTextSaxed(action));
                        if (QString::compare(ss->get("STEXT_OLD"),ss->get("STEXT_NEW")) == 0)
                        {
-				//nothing change - quit without set new Undo step
                                itemTextSaxed.clear();
                                restoreTextSelection(oldSelStart, oldSelLen);
                                if (newState)
@@ -3753,7 +3774,8 @@
                        }
                }
                itemTextSaxed.clear();
-		lastUndoAction = action;
+		setLastUndoAction(action);
+		setLastETEA(newAction);
                ss->set("STEXT",(int) action);
                if (newState)
                        undoManager->action(this, ss);
@@ -3764,6 +3786,7 @@

 void PageItem_TextFrame::restoreTextSelection(int oldSelStart, int oldSelLength)
 {
+	itemText.deselectAll();
        if (oldSelLength > 0)
                itemText.select(oldSelStart, oldSelLength);
        else if (oldSelLength == 0)
Index: Scribus/scribus/scribus.cpp
===================================================================
--- Scribus/scribus/scribus.cpp	(wersja 16552)
+++ Scribus/scribus/scribus.cpp	(kopia robocza)
@@ -1118,9 +1118,9 @@
                                                        currItem->oldCPos = currItem->CPos;
                                                currItem->itemText.insertChars(currItem->CPos, QString(QChar(unicodevalue)), true);
                                                if (currItem->itemTextSaxed.isEmpty())
-							currItem->asTextFrame()->updateUndo(PageItem::INS, QString(QChar(unicodevalue)));
+							currItem->asTextFrame()->updateUndo(PageItem::INS, ETEAinsertingText, QString(QChar(unicodevalue)));
                                                else
-							currItem->asTextFrame()->updateUndo(PageItem::REPSAX, currItem->getTextSaxed(QString(QChar(unicodevalue))));
+							currItem->asTextFrame()->updateUndo(PageItem::REPSAX, ETEAreplacingText, currItem->getTextSaxed(QString(QChar(unicodevalue))));
                                                currItem->CPos += 1;
 //						currItem->Tinput = true;
                                                currItem->update();
@@ -1139,7 +1139,7 @@
                                                        currItem->itemText.insertChars(currItem->CPos, QString(SpecialChars::SHYPHEN), true);
                                                        currItem->oldCPos = currItem->CPos;
                                                        currItem->CPos += 1;
-							currItem->asTextFrame()->updateUndo(PageItem::INS, QString(SpecialChars::SHYPHEN));
+							currItem->asTextFrame()->updateUndo(PageItem::INS, ETEAinsertingSpecChar, QString(SpecialChars::SHYPHEN));
 #endif
 //							currItem->Tinput = true;
                                                        currItem->update();
@@ -4304,7 +4304,7 @@
                        ImportSetup impsetup=gt->run();
                        if (impsetup.runDialog)
                        {
-				currItem->itemTextSaxed = currItem->getItemTextSaxed(PageItem::FRAME);
+				currItem->itemTextSaxed = currItem->getItemTextSaxed(PageItem::STORY);
                                if (currItem->itemText.length() != 0)
                                {
                                        int t = QMessageBox::warning(this, CommonStrings::trWarning, tr("Do you really want to clear all your text?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
@@ -4312,7 +4312,7 @@
                                                return;
                                }
                                gt->launchImporter(impsetup.importer, impsetup.filename, impsetup.textOnly, impsetup.encoding, false);
-				currItem->asTextFrame()->updateUndo();
+				currItem->asTextFrame()->updateUndo(PageItem::STORY, ETEAslotGetContent);
                        }
                        delete gt;
                        if (doc->docHyphenator->AutoCheck)
@@ -4339,7 +4339,7 @@
        if (!currItem->asTextFrame())
                return; // not a text frame
        // I dont know what is doing here, but Undo dont hurts
-	currItem->itemTextSaxed = currItem->getItemTextSaxed(PageItem::FRAME);
+	currItem->itemTextSaxed = currItem->getItemTextSaxed(PageItem::STORY);
        ScGTPluginManager::instance()->run();
        if (doc->docHyphenator->AutoCheck)
                doc->docHyphenator->slotHyphenate(currItem);
@@ -4348,7 +4348,7 @@
                if (doc->Items->at(a)->isBookmark)
                        bookmarkPalette->BView->ChangeText(doc->Items->at(a));
        }
-	currItem->asTextFrame()->updateUndo();
+	currItem->asTextFrame()->updateUndo(PageItem::STORY, ETEAslotGetContent);
        view->DrawNew();
        slotDocCh();
 }
@@ -4405,9 +4405,9 @@
                if (impsetup.runDialog)
                {
                        PageItem *currItem = doc->m_Selection->itemAt(0);
-			currItem->itemTextSaxed = currItem->getItemTextSaxed(PageItem::FRAME);
+			currItem->itemTextSaxed = currItem->getItemTextSaxed(PageItem::STORY);
                        gt->launchImporter(impsetup.importer, impsetup.filename, impsetup.textOnly, impsetup.encoding, true);
-			currItem->asTextFrame()->updateUndo();
+			currItem->asTextFrame()->updateUndo(PageItem::STORY, ETEAslotFileAppend);
                }
                delete gt;
                //CB Hyphenating now emits doc changed, plus we change lang as appropriate
@@ -4988,6 +4988,7 @@
                                return;
                        currItem->oldCPos = currItem->itemText.startOfSelection();
                        //for undo
+			QString oldstr = currItem->itemText.text(currItem->itemText.startOfSelection(), currItem->itemText.lengthOfSelection());
                        currItem->itemTextSaxed = currItem->getItemTextSaxed(PageItem::SELECTION);

                        StoryText itemText(doc);
@@ -5008,7 +5009,7 @@

                        dynamic_cast<PageItem_TextFrame*>(currItem)->deleteSelectedTextFromFrame();
                        //for undo
-			currItem->asTextFrame()->updateUndo(PageItem::DELSAX);
+			currItem->asTextFrame()->updateUndo(PageItem::DELSAX, ETEAdeletingText, oldstr);
                        currItem->update();
                }
                else
@@ -5144,7 +5145,7 @@
                {
                        PageItem_TextFrame *currItem = dynamic_cast<PageItem_TextFrame*>(doc->m_Selection->itemAt(0));
                        assert(currItem != NULL);
-			currItem->lastUndoAction = PageItem::NOACTION;
+			currItem->clearLastUndoAction();
                        if (currItem->HasSel)
                        {
                                //for text undo, storing current selection
@@ -5175,7 +5176,7 @@
                                currItem->itemText.select(currItem->CPos,story->length());
                                currItem->HasSel = true;
                                //if itemTextSaxed is not empty there was selection
-				currItem->updateUndo(currItem->itemTextSaxed.isEmpty() ? PageItem::INSSAX : PageItem::REPSAX,currItem->getItemTextSaxed(PageItem::SELECTION));
+				currItem->updateUndo(currItem->itemTextSaxed.isEmpty() ? PageItem::INSSAX : PageItem::REPSAX, ETEAinsertingText, currItem->getItemTextSaxed(PageItem::SELECTION));

                                currItem->CPos += story->length();

@@ -5266,7 +5267,7 @@
                                currItem->itemText.select(currItem->oldCPos,currItem->CPos - currItem->oldCPos);
                                currItem->HasSel = true;
                                //if itemTextSaxed is not empty there was selection
-				currItem->updateUndo(currItem->itemTextSaxed.isEmpty() ? PageItem::INSSAX : PageItem::REPSAX,currItem->getItemTextSaxed(PageItem::SELECTION));
+				currItem->updateUndo(currItem->itemTextSaxed.isEmpty() ? PageItem::INSSAX : PageItem::REPSAX, ETEAinsertingText, currItem->getItemTextSaxed(PageItem::SELECTION));
                        }
                        else
                        {
@@ -5280,9 +5281,9 @@
                                currItem->HasSel = true;
                                //if itemTextSaxed is not empty there was selection
                                if (currItem->itemTextSaxed.isEmpty())
-					currItem->updateUndo(PageItem::INS, text);
+					currItem->updateUndo(PageItem::INS, ETEAinsertingText, text);
                                else
-					currItem->updateUndo(PageItem::REPSAX, currItem->getTextSaxed(text));
+					currItem->updateUndo(PageItem::REPSAX, ETEAreplacingText, currItem->getTextSaxed(text));

                        }
                        currItem->update();
@@ -7001,11 +7002,10 @@
        //for undo
        PageItem *currItem = doc->m_Selection->itemAt(0);
        if (currItem->asTextFrame())
-		currItem->itemTextSaxed = currItem->getItemTextSaxed(doc->appMode == modeEdit? PageItem::SELECTION : PageItem::FRAME);
-	qDebug() << "setNewFont" << currItem->HasSel;
+		currItem->itemTextSaxed = currItem->getItemTextSaxed(doc->appMode == modeEdit? PageItem::SELECTION : PageItem::STORY);
        doc->itemSelection_SetFont(nf2);
        if (currItem->asTextFrame())
-		currItem->asTextFrame()->updateUndo(currItem->HasSel? PageItem::PARAMSEL : PageItem::PARAMFULL);
+		currItem->asTextFrame()->updateUndo(doc->appMode == modeEdit? PageItem::SELECTION : PageItem::STORY, ETEASetNewFont);

 //	doc->currentStyle.charStyle().setFont((*doc->AllFonts)[nf2]);
        view->DrawNew();
@@ -7016,8 +7016,7 @@
 {
        PageItem *currItem = doc->m_Selection->itemAt(0);
        if (currItem->asTextFrame())
-		currItem->itemTextSaxed = currItem->getItemTextSaxed(doc->appMode == modeEdit? PageItem::SELECTION : PageItem::FRAME);
-
+		currItem->itemTextSaxed = currItem->getItemTextSaxed(doc->appMode == modeEdit? PageItem::SELECTION : PageItem::STORY);
        int c = id;
        if (c != -1)
                doc->itemSelection_SetFontSize(c*10);
@@ -7034,8 +7033,7 @@
                delete dia;
        }
        if (currItem->asTextFrame())
-		currItem->asTextFrame()->updateUndo(currItem->HasSel? PageItem::PARAMSEL : PageItem::PARAMFULL);
-
+		currItem->asTextFrame()->updateUndo(doc->appMode == modeEdit? PageItem::SELECTION : PageItem::STORY, ETEAsetItemFSize);
        propertiesPalette->setSize(c*10);
 // 	slotDocCh();
 }
@@ -7048,6 +7046,8 @@
        if (doc->m_Selection->count() != 0)
        {
                PageItem *currItem = doc->m_Selection->itemAt(0);
+		if (currItem->asTextFrame())
+			currItem->itemTextSaxed = currItem->getItemTextSaxed(doc->appMode == modeEdit? PageItem::SELECTION : PageItem::STORY);
                if (c != -1)
                {
                        if ((currItem->itemType() == PageItem::TextFrame) || (currItem->itemType() == PageItem::PathText))
@@ -7071,6 +7071,8 @@
                        }
                        delete dia;
                }
+		if (currItem->asTextFrame())
+			currItem->asTextFrame()->updateUndo(doc->appMode == modeEdit? PageItem::SELECTION : PageItem::STORY, ETEAsetItemShade);
        }
 // 	slotDocCh();
 }
@@ -7435,14 +7437,10 @@
                else */
                PageItem *currItem = doc->m_Selection->itemAt(0);
                if (currItem->asTextFrame())
-		{
-//			currItem->asTextFrame()->ExpandParSel();
-//			currItem->asTextFrame()->lastAction4Paragraph = true;
-			currItem->itemTextSaxed = currItem->getItemTextSaxed(doc->appMode == modeEdit? PageItem::PARAGRAPH : PageItem::FRAME);
-		}
+			currItem->itemTextSaxed = currItem->getItemTextSaxed(doc->appMode == modeEdit? PageItem::PARAGRAPH : PageItem::STORY);
                doc->itemSelection_SetNamedParagraphStyle(name);
                if (currItem->asTextFrame())
-			currItem->asTextFrame()->updateUndo();
+			currItem->asTextFrame()->updateUndo(doc->appMode == modeEdit? PageItem::PARAGRAPH : PageItem::STORY, ETEAsetNewParStyle);
                setTBvals(currItem);
        }
 }
@@ -7459,10 +7457,10 @@
                else */
                PageItem *currItem = doc->m_Selection->itemAt(0);
                if (currItem->asTextFrame())
-			currItem->itemTextSaxed = currItem->getItemTextSaxed(doc->appMode == modeEdit? PageItem::SELECTION : PageItem::FRAME);
+			currItem->itemTextSaxed = currItem->getItemTextSaxed(doc->appMode == modeEdit? PageItem::SELECTION : PageItem::STORY);
                doc->itemSelection_SetNamedCharStyle(name);
                if (currItem->asTextFrame())
-			currItem->asTextFrame()->updateUndo(currItem->HasSel? PageItem::PARAMSEL : PageItem::PARAMFULL);
+			currItem->asTextFrame()->updateUndo(doc->appMode == modeEdit? PageItem::SELECTION : PageItem::STORY, ETEAsetNewCharStyle);
                setTBvals(currItem);
        }
 }
Index: Scribus/scribus/propertiespalette.cpp
===================================================================
--- Scribus/scribus/propertiespalette.cpp	(wersja 16552)
+++ Scribus/scribus/propertiespalette.cpp	(kopia robocza)
@@ -61,6 +61,7 @@
 #include "scribuscore.h"
 #include "scraction.h"
 #include "scribusview.h"
+#include "scribusstructs.h"
 #include "selection.h"
 #include "spalette.h"
 #include "styleselect.h"
@@ -2947,15 +2948,10 @@
        if ((HaveDoc) && (HaveItem))
        {
                if (CurItem->asTextFrame())
-		{
-//			CurItem->asTextFrame()->ExpandParSel();
-			CurItem->itemTextSaxed = CurItem->getItemTextSaxed(doc->appMode == modeEdit? PageItem::PARAGRAPH : PageItem::FRAME);
-//			CurItem->asTextFrame()->lastAction4Paragraph = true;
-		}
+			CurItem->itemTextSaxed = CurItem->getItemTextSaxed(doc->appMode == modeEdit? PageItem::PARAGRAPH : PageItem::STORY);
                doc->itemSelection_SetLineSpacingMode(id);
-		updateStyle(doc->appMode == modeEdit? CurItem->currentStyle() : CurItem->itemText.defaultStyle());
                if (CurItem->asTextFrame())
-			CurItem->asTextFrame()->updateUndo();
+			CurItem->asTextFrame()->updateUndo(doc->appMode == modeEdit? PageItem::PARAGRAPH : PageItem::STORY, ETEAsetLineSpacingMode);
        }
 }

@@ -3298,7 +3294,7 @@
        if (!HaveDoc || !HaveItem || !m_ScMW || m_ScMW->scriptIsRunning())
                return;
        if (CurItem->asTextFrame())
-		CurItem->itemTextSaxed = CurItem->getItemTextSaxed(PageItem::FRAME);
+		CurItem->itemTextSaxed = CurItem->getItemTextSaxed(doc->appMode == modeEdit? PageItem::PARAGRAPH : PageItem::STORY);
        int omt(ParagraphStyle::OM_None);
 //	if (optMarginCheckLeftProtruding->isChecked()) omt+=ParagraphStyle::OM_LeftProtruding;
        if (optMarginRadioBoth->isChecked())
@@ -3310,14 +3306,18 @@

        doc->itemSelection_SetOpticalMargins(omt);
        if (CurItem->asTextFrame())
-		CurItem->asTextFrame()->updateUndo();
+		CurItem->asTextFrame()->updateUndo(doc->appMode == modeEdit? PageItem::PARAGRAPH : PageItem::STORY, ETEAsetOpticalMargins);
 }

 void PropertiesPalette::resetOpticalMargins()
 {
        if (!HaveDoc || !HaveItem || !m_ScMW || m_ScMW->scriptIsRunning())
                return;
+	if (CurItem->asTextFrame())
+		CurItem->itemTextSaxed = CurItem->getItemTextSaxed(doc->appMode == modeEdit? PageItem::PARAGRAPH : PageItem::STORY);
        doc->itemSelection_resetOpticalMargins();
+	if (CurItem->asTextFrame())
+		CurItem->asTextFrame()->updateUndo(doc->appMode == modeEdit? PageItem::PARAGRAPH : PageItem::STORY, ETEAsetOpticalMargins);
 }

 void PropertiesPalette::updateOpticalMargins(const ParagraphStyle & pStyle)
@@ -3339,12 +3339,12 @@
        if (!HaveDoc || !HaveItem || !m_ScMW || m_ScMW->scriptIsRunning())
                return;
        if (CurItem->asTextFrame())
-		CurItem->itemTextSaxed = CurItem->getItemTextSaxed(doc->appMode == modeEdit? PageItem::SELECTION : PageItem::FRAME);
+		CurItem->itemTextSaxed = CurItem->getItemTextSaxed(doc->appMode == modeEdit? PageItem::SELECTION : PageItem::STORY);
        ParagraphStyle newStyle;
        newStyle.setMinWordTracking(minWordTrackingSpinBox->value() / 100.0);
        doc->itemSelection_ApplyParagraphStyle(newStyle);
        if (CurItem->asTextFrame())
-		CurItem->asTextFrame()->updateUndo(CurItem->HasSel? PageItem::PARAMSEL : PageItem::PARAMFULL);
+		CurItem->asTextFrame()->updateUndo(CurItem->HasSel? PageItem::SELECTION : PageItem::STORY, ETEAsetMinWordTracking);
 }


@@ -3353,13 +3353,13 @@
        if (!HaveDoc || !HaveItem || !m_ScMW || m_ScMW->scriptIsRunning())
                return;
        if (CurItem->asTextFrame())
-		CurItem->itemTextSaxed = CurItem->getItemTextSaxed(doc->appMode == modeEdit? PageItem::SELECTION : PageItem::FRAME);
+		CurItem->itemTextSaxed = CurItem->getItemTextSaxed(doc->appMode == modeEdit? PageItem::SELECTION : PageItem::STORY);
        ParagraphStyle newStyle;
 //	newStyle.setNormWordTracking(percent / 100.0);
        newStyle.charStyle().setWordTracking(normWordTrackingSpinBox->value() / 100.0);
        doc->itemSelection_ApplyParagraphStyle(newStyle);
        if (CurItem->asTextFrame())
-		CurItem->asTextFrame()->updateUndo(CurItem->HasSel? PageItem::PARAMSEL : PageItem::PARAMFULL);
+		CurItem->asTextFrame()->updateUndo(CurItem->HasSel? PageItem::SELECTION : PageItem::STORY, ETEAsetNormWordTracking);
 }

 void PropertiesPalette::setMinGlyphExtension()
@@ -3367,12 +3367,12 @@
        if (!HaveDoc || !HaveItem || !m_ScMW || m_ScMW->scriptIsRunning())
                return;
        if (CurItem->asTextFrame())
-		CurItem->itemTextSaxed = CurItem->getItemTextSaxed(doc->appMode == modeEdit? PageItem::SELECTION : PageItem::FRAME);
+		CurItem->itemTextSaxed = CurItem->getItemTextSaxed(doc->appMode == modeEdit? PageItem::SELECTION : PageItem::STORY);
        ParagraphStyle newStyle;
        newStyle.setMinGlyphExtension(minGlyphExtSpinBox->value() / 100.0);
        doc->itemSelection_ApplyParagraphStyle(newStyle);
        if (CurItem->asTextFrame())
-		CurItem->asTextFrame()->updateUndo(CurItem->HasSel? PageItem::PARAMSEL : PageItem::PARAMFULL);
+		CurItem->asTextFrame()->updateUndo(CurItem->HasSel? PageItem::SELECTION : PageItem::STORY, ETEAsetMinGlyphExtension);
 }

 void PropertiesPalette::setMaxGlyphExtension()
@@ -3380,12 +3380,12 @@
        if (!HaveDoc || !HaveItem || !m_ScMW || m_ScMW->scriptIsRunning())
                return;
        if (CurItem->asTextFrame())
-		CurItem->itemTextSaxed = CurItem->getItemTextSaxed(doc->appMode == modeEdit? PageItem::SELECTION : PageItem::FRAME);
+		CurItem->itemTextSaxed = CurItem->getItemTextSaxed(doc->appMode == modeEdit? PageItem::SELECTION : PageItem::STORY);
        ParagraphStyle newStyle;
        newStyle.setMaxGlyphExtension(maxGlyphExtSpinBox->value() / 100.0);
        doc->itemSelection_ApplyParagraphStyle(newStyle);
        if (CurItem->asTextFrame())
-		CurItem->asTextFrame()->updateUndo(CurItem->HasSel? PageItem::PARAMSEL : PageItem::PARAMFULL);
+		CurItem->asTextFrame()->updateUndo(CurItem->HasSel? PageItem::SELECTION : PageItem::STORY, ETEAsetMaxGlyphExtension);
 }


@@ -3404,10 +3404,10 @@
        if (!HaveDoc || !HaveItem || !m_ScMW || m_ScMW->scriptIsRunning())
                return;
        if (CurItem->asTextFrame())
-		CurItem->itemTextSaxed = CurItem->getItemTextSaxed(doc->appMode == modeEdit? PageItem::SELECTION : PageItem::FRAME);
+		CurItem->itemTextSaxed = CurItem->getItemTextSaxed(doc->appMode == modeEdit? PageItem::SELECTION : PageItem::STORY);
        doc->itemSelection_SetScaleV(qRound(ChScaleV->value() * 10));
        if (CurItem->asTextFrame())
-		CurItem->asTextFrame()->updateUndo(CurItem->HasSel? PageItem::PARAMSEL : PageItem::PARAMFULL);
+		CurItem->asTextFrame()->updateUndo(CurItem->HasSel? PageItem::SELECTION : PageItem::STORY, ETEANewTScale);
 }

 void PropertiesPalette::NewTBase()
@@ -3415,10 +3415,10 @@
        if (!HaveDoc || !HaveItem || !m_ScMW || m_ScMW->scriptIsRunning())
                return;
        if (CurItem->asTextFrame())
-		CurItem->itemTextSaxed = CurItem->getItemTextSaxed(doc->appMode == modeEdit? PageItem::SELECTION : PageItem::FRAME);
+		CurItem->itemTextSaxed = CurItem->getItemTextSaxed(doc->appMode == modeEdit? PageItem::SELECTION : PageItem::STORY);
        doc->itemSelection_SetBaselineOffset(qRound(ChBase->value() * 10));
        if (CurItem->asTextFrame())
-		CurItem->asTextFrame()->updateUndo(CurItem->HasSel? PageItem::PARAMSEL : PageItem::PARAMFULL);
+		CurItem->asTextFrame()->updateUndo(CurItem->HasSel? PageItem::SELECTION : PageItem::STORY, ETEANewTBase);
 }

 void PropertiesPalette::setTScale(double e)
@@ -3446,10 +3446,10 @@
        if (!HaveDoc || !HaveItem || !m_ScMW || m_ScMW->scriptIsRunning())
                return;
        if (CurItem->asTextFrame())
-		CurItem->itemTextSaxed = CurItem->getItemTextSaxed(doc->appMode == modeEdit? PageItem::SELECTION : PageItem::FRAME);
+		CurItem->itemTextSaxed = CurItem->getItemTextSaxed(doc->appMode == modeEdit? PageItem::SELECTION : PageItem::STORY);
        doc->itemSelection_SetScaleH(qRound(ChScale->value() * 10));
        if (CurItem->asTextFrame())
-		CurItem->asTextFrame()->updateUndo(CurItem->HasSel? PageItem::PARAMSEL : PageItem::PARAMFULL);
+		CurItem->asTextFrame()->updateUndo(CurItem->HasSel? PageItem::SELECTION : PageItem::STORY, ETEANewTScale);
 }

 void PropertiesPalette::NewX()
@@ -3874,14 +3874,10 @@
        if (!HaveDoc || !HaveItem || !m_ScMW || m_ScMW->scriptIsRunning())
                return;
        if (CurItem->asTextFrame())
-	{
-//		CurItem->asTextFrame()->ExpandParSel();
-		CurItem->itemTextSaxed = CurItem->getItemTextSaxed(doc->appMode == modeEdit? PageItem::PARAGRAPH : PageItem::FRAME);
-//		CurItem->asTextFrame()->lastAction4Paragraph = true;
-	}
+		CurItem->itemTextSaxed = CurItem->getItemTextSaxed(doc->appMode == modeEdit? PageItem::PARAGRAPH : PageItem::STORY);
        doc->itemSelection_SetLineSpacing(LineSp->value());
        if (CurItem->asTextFrame())
-		CurItem->asTextFrame()->updateUndo();
+		CurItem->asTextFrame()->updateUndo(doc->appMode == modeEdit? PageItem::PARAGRAPH : PageItem::STORY, ETEANewLineSpacing);
 }

 void PropertiesPalette::HandleGapSwitch()
@@ -3901,7 +3897,7 @@
 {
        if (!HaveDoc || !HaveItem || !m_ScMW || m_ScMW->scriptIsRunning())
                return;
-	CurItem->Cols = DCol->value();
+	CurItem->setColsGapDist(DCol->value(), CurItem->ColGap, CurItem->textToFrameDistLeft(), CurItem->textToFrameDistRight(), CurItem->textToFrameDistTop(), CurItem->textToFrameDistBottom());
        setCols(CurItem->Cols, CurItem->ColGap);
        CurItem->update();
        emit DocChanged();
@@ -3922,8 +3918,9 @@
 {
        if (!HaveDoc || !HaveItem || !m_ScMW || m_ScMW->scriptIsRunning())
                return;
+	double newGap;
        if (colgapLabel->currentIndex() == 0)
-		CurItem->ColGap = dGap->value() / m_unitRatio;
+		newGap = dGap->value() / m_unitRatio;
        else
        {
                double lineCorr;
@@ -3932,9 +3929,9 @@
                else
                        lineCorr = 0;
                double newWidth = dGap->value() / m_unitRatio;
-		double newGap = qMax(((CurItem->width() - CurItem->textToFrameDistLeft() - CurItem->textToFrameDistRight() - lineCorr) - (newWidth * CurItem->Cols)) / (CurItem->Cols - 1), 0.0);
-		CurItem->ColGap = newGap;
+		newGap = qMax(((CurItem->width() - CurItem->textToFrameDistLeft() - CurItem->textToFrameDistRight() - lineCorr) - (newWidth * CurItem->Cols)) / (CurItem->Cols - 1), 0.0);
        }
+	CurItem->setColsGapDist(CurItem->Cols, newGap, CurItem->textToFrameDistLeft(), CurItem->textToFrameDistRight(), CurItem->textToFrameDistTop(), CurItem->textToFrameDistBottom());
        CurItem->update();
        emit DocChanged();
 }
@@ -3944,10 +3941,10 @@
        if (!HaveDoc || !HaveItem || !m_ScMW || m_ScMW->scriptIsRunning())
                return;
        if (CurItem->asTextFrame())
-		CurItem->itemTextSaxed = CurItem->getItemTextSaxed(doc->appMode == modeEdit? PageItem::SELECTION : PageItem::FRAME);
+		CurItem->itemTextSaxed = CurItem->getItemTextSaxed(doc->appMode == modeEdit? PageItem::SELECTION : PageItem::STORY);
        doc->itemSelection_SetFontSize(qRound(Size->value()*10.0));
        if (CurItem->asTextFrame())
-		CurItem->asTextFrame()->updateUndo(CurItem->HasSel? PageItem::PARAMSEL : PageItem::PARAMFULL);
+		CurItem->asTextFrame()->updateUndo(CurItem->HasSel? PageItem::SELECTION : PageItem::STORY, ETEANewSize);
 }

 void PropertiesPalette::NewTracking()
@@ -3955,10 +3952,10 @@
        if (!HaveDoc || !HaveItem || !m_ScMW || m_ScMW->scriptIsRunning())
                return;
        if (CurItem->asTextFrame())
-		CurItem->itemTextSaxed = CurItem->getItemTextSaxed(doc->appMode == modeEdit? PageItem::SELECTION : PageItem::FRAME);
+		CurItem->itemTextSaxed = CurItem->getItemTextSaxed(doc->appMode == modeEdit? PageItem::SELECTION : PageItem::STORY);
        doc->itemSelection_SetTracking(qRound(Extra->value() * 10.0));
        if (CurItem->asTextFrame())
-		CurItem->asTextFrame()->updateUndo(CurItem->HasSel? PageItem::PARAMSEL : PageItem::PARAMFULL);
+		CurItem->asTextFrame()->updateUndo(CurItem->HasSel? PageItem::SELECTION : PageItem::STORY, ETEANewTracking);
 }

 void PropertiesPalette::NewLocalXY()
@@ -4276,35 +4273,13 @@

 void PropertiesPalette::NewAlignement(int a)
 {
-	int selStart = 0, selEnd = 0, selLength = 0;
        if (!HaveDoc || !HaveItem || !m_ScMW || m_ScMW->scriptIsRunning())
                return;
        if (CurItem->asTextFrame())
-	{
-		// hack for apply left align for text with no align at all
-		//so during Undo/Redo some align will be applied
-		StoryText& itemText(CurItem->itemText);
-		if (doc->appMode == modeEdit)
-		{
-			//selected parapgraph(s) only
-			selStart = (itemText.lengthOfSelection() > 0) ? itemText.startOfSelection() : CurItem->CPos;
-			selEnd   = (itemText.lengthOfSelection() > 0) ? itemText.endOfSelection() : CurItem->CPos;
-			selStart = itemText.startOfParagraph( itemText.nrOfParagraph(selStart) );
-			selEnd   = itemText.endOfParagraph  ( itemText.nrOfParagraph(selEnd) );
-		}
-		else
-		{
-			//for whole frame
-			selStart = itemText.startOfParagraph( 0 );
-			selEnd   = itemText.endOfParagraph  ( itemText.nrOfParagraph(itemText.lastInFrame()) );
-		}
-		selLength = qMin(selEnd - selStart + 1, itemText.length() - selStart);
-		CurItem->itemTextSaxed = CurItem->getItemTextSaxed(selStart, selLength);
-//		CurItem->asTextFrame()->lastAction4Paragraph = true;
-	}
+		CurItem->itemTextSaxed = CurItem->getItemTextSaxed(doc->appMode == modeEdit? PageItem::PARAGRAPH : PageItem::STORY);
        doc->itemSelection_SetAlignment(a);
        if (CurItem->asTextFrame())
-		CurItem->asTextFrame()->updateUndo();
+		CurItem->asTextFrame()->updateUndo(doc->appMode == modeEdit? PageItem::PARAGRAPH : PageItem::STORY, ETEANewAlignement);
 }

 void PropertiesPalette::setTypeStyle(int s)
@@ -4312,10 +4287,10 @@
        if (!m_ScMW || m_ScMW->scriptIsRunning())
                return;
        if (CurItem->asTextFrame())
-		CurItem->itemTextSaxed = CurItem->getItemTextSaxed(doc->appMode == modeEdit? PageItem::SELECTION : PageItem::FRAME);
+		CurItem->itemTextSaxed = CurItem->getItemTextSaxed(doc->appMode == modeEdit? PageItem::SELECTION : PageItem::STORY);
        emit NewEffects(s);
        if (CurItem->asTextFrame())
-		CurItem->asTextFrame()->updateUndo(CurItem->HasSel? PageItem::PARAMSEL : PageItem::PARAMFULL);
+		CurItem->asTextFrame()->updateUndo(CurItem->HasSel? PageItem::SELECTION : PageItem::STORY, ETEAsetTypeStyle);
 }

 void PropertiesPalette::newShadowOffs()
@@ -4323,12 +4298,12 @@
        if ((HaveDoc) && (HaveItem))
        {
                if (CurItem->asTextFrame())
-			CurItem->itemTextSaxed = CurItem->getItemTextSaxed(doc->appMode == modeEdit? PageItem::SELECTION : PageItem::FRAME);
+			CurItem->itemTextSaxed = CurItem->getItemTextSaxed(doc->appMode == modeEdit? PageItem::SELECTION : PageItem::STORY);
                int x = qRound(SeStyle->ShadowVal->Xoffset->value() * 10.0);
                int y = qRound(SeStyle->ShadowVal->Yoffset->value() * 10.0);
                doc->itemSelection_SetShadowOffsets(x, y);
                if (CurItem->asTextFrame())
-			CurItem->asTextFrame()->updateUndo(CurItem->HasSel? PageItem::PARAMSEL : PageItem::PARAMFULL);
+			CurItem->asTextFrame()->updateUndo(CurItem->HasSel? PageItem::SELECTION : PageItem::STORY, ETEAnewShadowOffs);
        }
 }

@@ -4349,12 +4324,12 @@
        if ((HaveDoc) && (HaveItem))
        {
                if (CurItem->asTextFrame())
-			CurItem->itemTextSaxed = CurItem->getItemTextSaxed(doc->appMode == modeEdit? PageItem::SELECTION : PageItem::FRAME);
+			CurItem->itemTextSaxed = CurItem->getItemTextSaxed(doc->appMode == modeEdit? PageItem::SELECTION : PageItem::STORY);
                int x = qRound(SeStyle->UnderlineVal->LPos->value() * 10.0);
                int y = qRound(SeStyle->UnderlineVal->LWidth->value() * 10.0);
                doc->itemSelection_SetUnderline(x, y);
                if (CurItem->asTextFrame())
-			CurItem->asTextFrame()->updateUndo(CurItem->HasSel? PageItem::PARAMSEL : PageItem::PARAMFULL);
+			CurItem->asTextFrame()->updateUndo(CurItem->HasSel? PageItem::SELECTION : PageItem::STORY, ETEAnewUnderline);
        }
 }

@@ -4375,12 +4350,12 @@
        if ((HaveDoc) && (HaveItem))
        {
                if (CurItem->asTextFrame())
-			CurItem->itemTextSaxed = CurItem->getItemTextSaxed(doc->appMode == modeEdit? PageItem::SELECTION : PageItem::FRAME);
+			CurItem->itemTextSaxed = CurItem->getItemTextSaxed(doc->appMode == modeEdit? PageItem::SELECTION : PageItem::STORY);
                int x = qRound(SeStyle->StrikeVal->LPos->value() * 10.0);
                int y = qRound(SeStyle->StrikeVal->LWidth->value() * 10.0);
                doc->itemSelection_SetStrikethru(x, y);
                if (CurItem->asTextFrame())
-			CurItem->asTextFrame()->updateUndo(CurItem->HasSel? PageItem::PARAMSEL : PageItem::PARAMFULL);
+			CurItem->asTextFrame()->updateUndo(CurItem->HasSel? PageItem::SELECTION : PageItem::STORY, ETEAnewStrike);
        }
 }

@@ -4411,10 +4386,10 @@
        if ((HaveDoc) && (HaveItem))
        {
                if (CurItem->asTextFrame())
-			CurItem->itemTextSaxed = CurItem->getItemTextSaxed(doc->appMode == modeEdit? PageItem::SELECTION : PageItem::FRAME);
+			CurItem->itemTextSaxed = CurItem->getItemTextSaxed(doc->appMode == modeEdit? PageItem::SELECTION : PageItem::STORY);
                doc->itemSelection_SetOutlineWidth(x);
                if (CurItem->asTextFrame())
-			CurItem->asTextFrame()->updateUndo(CurItem->HasSel? PageItem::PARAMSEL : PageItem::PARAMFULL);
+			CurItem->asTextFrame()->updateUndo(CurItem->HasSel? PageItem::SELECTION : PageItem::STORY, ETEAnewOutlineW);
        }
 }

@@ -4677,7 +4652,7 @@
                return;
        if ((HaveDoc) && (HaveItem))
        {
-		CurItem->setTextToFrameDist(DLeft->value() / m_unitRatio, DRight->value() / m_unitRatio, DTop->value() / m_unitRatio, DBottom->value() / m_unitRatio);
+		CurItem->setColsGapDist(CurItem->Cols, CurItem->ColGap, DLeft->value() / m_unitRatio, DRight->value() / m_unitRatio, DTop->value() / m_unitRatio, DBottom->value() / m_unitRatio);
                setCols(CurItem->Cols, CurItem->ColGap);
                CurItem->update();
                emit DocChanged();
@@ -4742,10 +4717,10 @@
        if (HaveDoc)
        {
                if (CurItem->asTextFrame())
-			CurItem->itemTextSaxed = CurItem->getItemTextSaxed(doc->appMode == modeEdit? PageItem::SELECTION : PageItem::FRAME);
+			CurItem->itemTextSaxed = CurItem->getItemTextSaxed(doc->appMode == modeEdit? PageItem::SELECTION : PageItem::STORY);
                doc->itemSelection_EraseCharStyle();
                if (CurItem->asTextFrame())
-			CurItem->asTextFrame()->updateUndo(doc->appMode == modeEdit? PageItem::PARAMSEL : PageItem::PARAMFULL);
+			CurItem->asTextFrame()->updateUndo(doc->appMode == modeEdit? PageItem::SELECTION : PageItem::STORY, ETEAdoClearCStyle);
        }
 }

@@ -4757,16 +4732,12 @@
        if (HaveDoc)
        {
                if (CurItem->asTextFrame())
-		{
-//			CurItem->asTextFrame()->ExpandParSel();
-			CurItem->itemTextSaxed = CurItem->getItemTextSaxed(doc->appMode == modeEdit? PageItem::PARAGRAPH : PageItem::FRAME);
-//			CurItem->asTextFrame()->lastAction4Paragraph = true;
-		}
+			CurItem->itemTextSaxed = CurItem->getItemTextSaxed(doc->appMode == modeEdit? PageItem::PARAGRAPH : PageItem::STORY);
                doc->itemSelection_EraseParagraphStyle();
                CharStyle emptyCStyle;
                doc->itemSelection_SetCharStyle(emptyCStyle);
                if (CurItem->asTextFrame())
-			CurItem->asTextFrame()->updateUndo(doc->appMode == modeEdit ? PageItem::PARAMSEL : PageItem::PARAMFULL);
+			CurItem->asTextFrame()->updateUndo(doc->appMode == modeEdit ? PageItem::SELECTION : PageItem::STORY, ETEAdoClearPStyle);
        }
 }

@@ -4913,10 +4884,10 @@
        if (!HaveDoc || !HaveItem || !m_ScMW || m_ScMW->scriptIsRunning())
                return;
        if (CurItem->asTextFrame())
-		CurItem->itemTextSaxed = CurItem->getItemTextSaxed(doc->appMode == modeEdit? PageItem::SELECTION : PageItem::FRAME);
+		CurItem->itemTextSaxed = CurItem->getItemTextSaxed(doc->appMode == modeEdit? PageItem::SELECTION : PageItem::STORY);
        doc->itemSelection_SetFillColor(TxFill->currentColor());
        if (CurItem->asTextFrame())
-		CurItem->asTextFrame()->updateUndo(CurItem->HasSel? PageItem::PARAMSEL : PageItem::PARAMFULL);
+		CurItem->asTextFrame()->updateUndo(CurItem->HasSel? PageItem::SELECTION : PageItem::STORY, ETEAnewTxtFill);
 }

 void PropertiesPalette::newTxtStroke()
@@ -4924,10 +4895,10 @@
        if (!HaveDoc || !HaveItem || !m_ScMW || m_ScMW->scriptIsRunning())
                return;
        if (CurItem->asTextFrame())
-		CurItem->itemTextSaxed = CurItem->getItemTextSaxed(doc->appMode == modeEdit? PageItem::SELECTION : PageItem::FRAME);
+		CurItem->itemTextSaxed = CurItem->getItemTextSaxed(doc->appMode == modeEdit? PageItem::SELECTION : PageItem::STORY);
        doc->itemSelection_SetStrokeColor(TxStroke->currentColor());
        if (CurItem->asTextFrame())
-		CurItem->asTextFrame()->updateUndo(CurItem->HasSel? PageItem::PARAMSEL : PageItem::PARAMFULL);
+		CurItem->asTextFrame()->updateUndo(CurItem->HasSel? PageItem::SELECTION : PageItem::STORY, ETEAnewTxtStroke);

 }

@@ -4937,7 +4908,7 @@
                return;
        int b;
        if (CurItem->asTextFrame())
-		CurItem->itemTextSaxed = CurItem->getItemTextSaxed(doc->appMode == modeEdit? PageItem::SELECTION : PageItem::FRAME);
+		CurItem->itemTextSaxed = CurItem->getItemTextSaxed(doc->appMode == modeEdit? PageItem::SELECTION : PageItem::STORY);
        if (PM1 == sender())
        {
                b = PM1->getValue();
@@ -4949,7 +4920,7 @@
                doc->itemSelection_SetFillShade(b);
        }
        if (CurItem->asTextFrame())
-		CurItem->asTextFrame()->updateUndo(CurItem->HasSel? PageItem::PARAMSEL : PageItem::PARAMFULL);
+		CurItem->asTextFrame()->updateUndo(CurItem->HasSel? PageItem::SELECTION : PageItem::STORY, ETEAsetActShade);
 }

 void PropertiesPalette::setActFarben(QString p, QString b, double shp, double shb)
@@ -5097,10 +5068,6 @@
                return;
        CurItem->fillRule = EvenOdd->isChecked();
        CurItem->update();
-	qDebug() << "PropertiesPalette::handleFillRule() updateUNDO";
-	if (CurItem->asTextFrame())
-		CurItem->asTextFrame()->updateUndo();
-
        emit DocChanged();
 }

@@ -5142,6 +5109,7 @@
                if (CurItem->itemName() != NameEdit->text())
                {
                        CurItem->setItemName(NameEdit->text());
+			CurItem->AutoName = false;
                        emit DocChanged();
                }
        }
@@ -5184,10 +5152,7 @@
                if (dia->exec())
                {
                        if (CurItem->asTextFrame())
-			{
-				CurItem->itemTextSaxed = CurItem->getItemTextSaxed(doc->appMode == modeEdit? PageItem::PARAGRAPH : PageItem::FRAME);
-//				CurItem->asTextFrame()->lastAction4Paragraph = true;
-			}
+				CurItem->itemTextSaxed = CurItem->getItemTextSaxed(doc->appMode == modeEdit? PageItem::PARAGRAPH : PageItem::STORY);
                        if (doc->appMode != modeEdit)
                        {
                                ParagraphStyle newStyle(CurItem->itemText.defaultStyle());
@@ -5202,7 +5167,7 @@
                        }
                        CurItem->update();
                        if (CurItem->asTextFrame())
-				CurItem->asTextFrame()->updateUndo();
+				CurItem->asTextFrame()->updateUndo(doc->appMode == modeEdit? PageItem::PARAGRAPH : PageItem::STORY, ETEAManageTabs);

                        emit DocChanged();
                }
@@ -5915,11 +5880,11 @@
                return;
 // 	qDebug("%s", QString("rF %1").arg(radioFlop).toAscii());
        if( radioFlop == 0)
-		CurItem->setFirstLineOffset(FLOPRealGlyphHeight);
+		CurItem->setFirstLineOffset(FLOPRealGlyphHeight, true);
        else if( radioFlop == 1)
-		CurItem->setFirstLineOffset(FLOPFontAscent);
+		CurItem->setFirstLineOffset(FLOPFontAscent, true);
        else if( radioFlop == 2)
-		CurItem->setFirstLineOffset(FLOPLineSpacing);
+		CurItem->setFirstLineOffset(FLOPLineSpacing, true);
        CurItem->update();
        emit DocChanged();
 }
Index: Scribus/scribus/undomanager.cpp
===================================================================
--- Scribus/scribus/undomanager.cpp	(wersja 16552)
+++ Scribus/scribus/undomanager.cpp	(kopia robocza)
@@ -882,6 +882,7 @@
        UndoManager::StartAndEndArrow   = tr("Set start and end arrows");
        UndoManager::CreateTable        = tr("Create table");
        UndoManager::RowsCols           = tr("Rows: %1, Cols: %2");
+	UndoManager::setColsGapDist     = tr("Set columns, gap and text distances");
        UndoManager::SetFont            = tr("Set font");
        UndoManager::SetFontSize        = tr("Set font size");
        UndoManager::SetFontWidth       = tr("Set font width");
@@ -896,6 +897,7 @@
        UndoManager::SetLanguage        = tr("Set language");
        UndoManager::AlignText          = tr("Align text");
        UndoManager::SetFontEffect      = tr("Set font effect");
+	UndoManager::SetFirstLineOffset = tr("Set first line offset");
        UndoManager::ImageFrame         = tr("Image frame");
        UndoManager::TextFrame          = tr("Text frame");
        UndoManager::LatexFrame         = tr("Render frame");
@@ -1094,6 +1096,7 @@
 QString UndoManager::StartAndEndArrow   = "";
 QString UndoManager::CreateTable        = "";
 QString UndoManager::RowsCols           = "";
+QString UndoManager::setColsGapDist     = "";
 QString UndoManager::SetFont            = "";
 QString UndoManager::SetFontSize        = "";
 QString UndoManager::SetFontWidth       = "";
@@ -1108,6 +1111,7 @@
 QString UndoManager::SetLanguage        = "";
 QString UndoManager::AlignText          = "";
 QString UndoManager::SetFontEffect      = "";
+QString UndoManager::SetFirstLineOffset = "";
 QString UndoManager::ImageFrame         = "";
 QString UndoManager::TextFrame          = "";
 QString UndoManager::LatexFrame         = "";
Index: Scribus/scribus/actionmanager.h
===================================================================
--- Scribus/scribus/actionmanager.h	(wersja 16552)
+++ Scribus/scribus/actionmanager.h	(kopia robocza)
@@ -37,6 +37,7 @@

 #include "scribusapi.h"
 #include "scraction.h"
+#include "scribusstructs.h"

 class ScribusDoc;
 class ScribusMainWindow;
@@ -69,6 +70,7 @@
                static QString defaultMenuNameEntryTranslated(const QString& index);
                static QVector< QPair<QString, QStringList> >* defaultMenus() {return &defMenus;};
                static QVector< QPair<QString, QStringList> >* defaultNonMenuActions() {return &defNonMenuActions;};
+		QMap<exactlyTextEditAct,QString> textEditActionDescriptions;
                void createActions();
                void disconnectModeActions();
                void connectModeActions();
@@ -104,6 +106,7 @@
                static void initUnicodeActions(QMap<QString, QPointer<ScrAction> > *actionMap, QWidget *actionParent, QStringList *actionNamesList);
                void initSpecialActions();
                static void languageChangeUnicodeActions(QMap<QString, QPointer<ScrAction> > *actionMap);
+		void initTextEditActionsDescriptions();
                void languageChangeActions();
                static QKeySequence defaultKey(const QString &actionName);

Index: Scribus/scribus/loremipsum.cpp
===================================================================
--- Scribus/scribus/loremipsum.cpp	(wersja 16552)
+++ Scribus/scribus/loremipsum.cpp	(kopia robocza)
@@ -311,7 +311,7 @@
                        continue;
                if (currItem->itemText.length() != 0)
                {
-			currItem->itemTextSaxed = currItem->getItemTextSaxed(PageItem::FRAME);
+			currItem->itemTextSaxed = currItem->getItemTextSaxed(PageItem::STORY);
                        m_Doc->itemSelection_ClearItem();
                        /* ClearItem() doesn't return true or false so
                        the following test has to be done */
@@ -346,9 +346,9 @@
                QString Lorip = lp->createLorem(paraCount, random);
                currItem->itemText.insertChars(0, Lorip);
                if (currItem->itemTextSaxed.isEmpty())
-			currItem->asTextFrame()->updateUndo(PageItem::INS,Lorip);
+			currItem->asTextFrame()->updateUndo(PageItem::INS, ETEAinsertLoremIpsum, Lorip);
                else
-			currItem->asTextFrame()->updateUndo(PageItem::REPSAX, currItem->getTextSaxed(Lorip));
+			currItem->asTextFrame()->updateUndo(PageItem::REPSAX, ETEAinsertLoremIpsum, currItem->getTextSaxed(Lorip));
                delete lp;

                //if (ScMW->view->SelItem.at(i)->Doc->docHyphenator->AutoCheck)
Index: Scribus/scribus/undomanager.h
===================================================================
--- Scribus/scribus/undomanager.h	(wersja 16552)
+++ Scribus/scribus/undomanager.h	(kopia robocza)
@@ -508,6 +508,7 @@
        static QString StartAndEndArrow;
        static QString CreateTable;
        static QString RowsCols;
+	static QString setColsGapDist;
        static QString SetFont;
        static QString SetFontSize;
        static QString SetFontWidth;
@@ -522,6 +523,7 @@
        static QString SetLanguage;
        static QString AlignText;
        static QString SetFontEffect;
+	static QString SetFirstLineOffset;
        static QString ImageFrame;
        static QString TextFrame;
        static QString LatexFrame;
Index: Scribus/scribus/hruler.cpp
===================================================================
--- Scribus/scribus/hruler.cpp	(wersja 16552)
+++ Scribus/scribus/hruler.cpp	(kopia robocza)
@@ -34,6 +34,7 @@
 #include "canvasgesture_rulermove.h"
 #include "hruler.h"
 #include "page.h"
+#include "pageitem_textframe.h"
 #include "prefsmanager.h"
 #include "scribus.h"
 #include "scribusdoc.h"
@@ -241,14 +242,17 @@
                {
                        bool mustApplyStyle = false;
                        ParagraphStyle paraStyle;
-			double ColWidth = (textWidth() - ColGap * (Cols - 1)) / Cols;
+			double ColWidth = (textWidth() - ColGap * (Cols - 1)) / Cols;
+			exactlyTextEditAct ETEA = ETEAsetIndentMargs;
                        switch (RulerCode)
                        {
                                case rc_leftFrameDist:
+				    currDoc->m_Selection->itemAt(0)->setUndoColsGapDist(Cols, ColGap, Extra, RExtra, currDoc->m_Selection->itemAt(0)->textToFrameDistTop(), currDoc->m_Selection->itemAt(0)->textToFrameDistBottom());
                                        currDoc->m_Selection->itemAt(0)->setTextToFrameDistLeft(Extra);
                                        emit DocChanged(false);
                                        break;
                                case rc_rightFrameDist:
+				    currDoc->m_Selection->itemAt(0)->setUndoColsGapDist(Cols, ColGap, Extra, RExtra, currDoc->m_Selection->itemAt(0)->textToFrameDistTop(), currDoc->m_Selection->itemAt(0)->textToFrameDistBottom());
                                        currDoc->m_Selection->itemAt(0)->setTextToFrameDistRight(RExtra);
                                        emit DocChanged(false);
                                        break;
@@ -269,6 +273,7 @@
                                        emit DocChanged(false);
                                        break;
                                case rc_tab:
+				ETEA = ETEAManageTabs;
                                        if (m->button() == Qt::RightButton)
                                        {
                                                TabValues[ActTab].tabType += 1;
@@ -284,9 +289,11 @@
                        }
                        if (mustApplyStyle)
                        {
+				currItem->itemTextSaxed = currItem->getItemTextSaxed(PageItem::PARAGRAPH);
                                Selection tempSelection(this, false);
                                tempSelection.addItem(currItem);
                                currDoc->itemSelection_ApplyParagraphStyle(paraStyle, &tempSelection);
+				currItem->asTextFrame()->updateUndo(PageItem::PARAGRAPH, ETEA);
                        }
                        else
                        {
@@ -297,6 +304,7 @@
                {
                        if (RulerCode == rc_tab)
                        {
+				currItem->itemTextSaxed = currItem->getItemTextSaxed(PageItem::PARAGRAPH);
                                TabValues.removeAt(ActTab);
                                ActTab = 0;
                                ParagraphStyle paraStyle;
@@ -304,6 +312,7 @@
                                Selection tempSelection(this, false);
                                tempSelection.addItem(currItem);
                                currDoc->itemSelection_ApplyParagraphStyle(paraStyle, &tempSelection);
+				currItem->asTextFrame()->updateUndo(PageItem::PARAGRAPH, ETEAManageTabs);
                                emit DocChanged(false);
                                qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
                        }
Index: Scribus/scribus/charselect.cpp
===================================================================
--- Scribus/scribus/charselect.cpp	(wersja 16552)
+++ Scribus/scribus/charselect.cpp	(kopia robocza)
@@ -113,7 +113,7 @@
        {
                m_Item->itemTextSaxed = m_Item->getItemTextSaxed(PageItem::SELECTION);
                m_Item->asTextFrame()->deleteSelectedTextFromFrame();
-		m_Item->asTextFrame()->lastUndoAction = PageItem::NOACTION;
+		m_Item->asTextFrame()->clearLastUndoAction();
        }
        if (m_Item->asTextFrame())
                m_Item->asTextFrame()->invalidateLayout();
@@ -133,9 +133,9 @@
                txtIns.append(ch);
        }
        if (m_Item->itemTextSaxed.isEmpty())
-		m_Item->asTextFrame()->updateUndo(PageItem::INS, txtIns);
+		m_Item->asTextFrame()->updateUndo(PageItem::INS, ETEAinsertingSpecChar, txtIns);
        else
-		m_Item->asTextFrame()->updateUndo(PageItem::REPSAX, m_Item->getTextSaxed(txtIns));
+		m_Item->asTextFrame()->updateUndo(PageItem::REPSAX, ETEAinsertingSpecChar, m_Item->getTextSaxed(txtIns));
        m_doc->updateFrameItems();
        m_doc->view()->DrawNew();
        m_doc->changed();
@@ -150,7 +150,7 @@
        {
                m_Item->itemTextSaxed = m_Item->getItemTextSaxed(PageItem::SELECTION);
                m_Item->asTextFrame()->deleteSelectedTextFromFrame();
-		m_Item->asTextFrame()->lastUndoAction = PageItem::NOACTION;
+		m_Item->asTextFrame()->clearLastUndoAction();
        }
        if (m_Item->asTextFrame())
                m_Item->asTextFrame()->invalidateLayout();
@@ -162,9 +162,9 @@
        m_Item->oldCPos = m_Item->CPos;
        m_Item->itemText.insertChars(m_Item->CPos, ch, true);
        if (m_Item->itemTextSaxed.isEmpty())
-		m_Item->asTextFrame()->updateUndo(PageItem::INS, QString(ch));
+		m_Item->asTextFrame()->updateUndo(PageItem::INS, ETEAinsertingSpecChar, QString(ch));
        else
-		m_Item->asTextFrame()->updateUndo(PageItem::REPSAX, m_Item->getTextSaxed(QString(ch)));
+		m_Item->asTextFrame()->updateUndo(PageItem::REPSAX, ETEAinsertingSpecChar, m_Item->getTextSaxed(QString(ch)));
        m_doc->updateFrameItems();
        m_Item->CPos += 1;
        m_doc->view()->DrawNew();
Index: Scribus/scribus/canvasmode_edit.cpp
===================================================================
--- Scribus/scribus/canvasmode_edit.cpp	(wersja 16552)
+++ Scribus/scribus/canvasmode_edit.cpp	(kopia robocza)
@@ -413,7 +413,7 @@
        PageItem *currItem = 0;
        if (GetItem(&currItem) && (m_doc->appMode == modeEdit) && currItem->asTextFrame())
        {
-		currItem->asTextFrame()->lastUndoAction = PageItem::NOACTION;
+		currItem->asTextFrame()->clearLastUndoAction();
                //CB if annotation, open the annotation dialog
                if (currItem->isAnnotation())
                {
@@ -660,7 +660,7 @@
                                        if (currItem->asTextFrame())
                                        {
                                                m_view->slotSetCurs(m->globalPos().x(), m->globalPos().y());
-						currItem->asTextFrame()->lastUndoAction = PageItem::NOACTION;
+						currItem->asTextFrame()->clearLastUndoAction();
                                        }
                                }
                                else
@@ -678,7 +678,7 @@
                //CB Where we set the cursor for a click in text frame
                if (currItem->asTextFrame())
                {
-			currItem->asTextFrame()->lastUndoAction = PageItem::NOACTION;
+			currItem->asTextFrame()->clearLastUndoAction();
                        inText = m_view->slotSetCurs(m->globalPos().x(), m->globalPos().y());
                        //CB If we clicked outside a text frame to go out of edit mode and deselect the frame
                        if (!inText)
@@ -688,7 +688,7 @@
                                //m_view->slotDoCurs(true);
                                m_view->requestMode(modeNormal);
                                if (currItem->isTextFrame())
-					currItem->asTextFrame()->lastUndoAction = PageItem::NOACTION;
+					currItem->asTextFrame()->clearLastUndoAction();
                                return;
                        }

@@ -713,7 +713,7 @@
                                                        oldP = currItem->itemText.endOfSelection();
                                                }
                                                currItem->asTextFrame()->itemText.extendSelection(oldP, currItem->CPos);
-						currItem->asTextFrame()->lastUndoAction = PageItem::NOACTION;
+						currItem->asTextFrame()->clearLastUndoAction();
                                                oldCp = currItem->CPos;
                                        }
                                        else
@@ -729,7 +729,7 @@
                                                                currItem->CPos = currItem->itemText.startOfParagraph(currItem->itemText.nrOfParagraph(currItem->CPos));
                                                }
                                                currItem->asTextFrame()->ExpandSel(dir, oldP);
-						currItem->asTextFrame()->lastUndoAction = PageItem::NOACTION;
+						currItem->asTextFrame()->clearLastUndoAction();
                                                oldCp = oldP;
                                        }
                                }
@@ -737,7 +737,7 @@
                                {
                                        oldCp = currItem->CPos;
                                        currItem->itemText.deselectAll();
-					currItem->asTextFrame()->lastUndoAction = PageItem::NOACTION;
+					currItem->asTextFrame()->clearLastUndoAction();
                                        currItem->HasSel = false;
                                }
                                currItem->emitAllToGUI();
@@ -754,7 +754,7 @@
                                                // K.I.S.S.:
                                                currItem->oldCPos = 0;
                                                currItem->itemText.insertChars(0, cc, true);
-						currItem->asTextFrame()->updateUndo(PageItem::INS,cc);
+						currItem->asTextFrame()->updateUndo(PageItem::INS, ETEAinsertingText, cc);
                                                if (m_doc->docHyphenator->AutoCheck)
                                                        m_doc->docHyphenator->slotHyphenate(currItem);
                                                m_ScMW->BookMarkTxT(currItem);
Index: Scribus/scribus/pageitem.h
===================================================================
--- Scribus/scribus/pageitem.h	(wersja 16552)
+++ Scribus/scribus/pageitem.h	(kopia robocza)
@@ -170,21 +170,15 @@
        //enum for actions in updateUndo and restoreEditText
        typedef enum {
                NOACTION = -1, //it is for checking if sequence of actions was done - after deselect text frame new sequence will be
-		PARAMFULL = 0, //parameters for whole frame
-		PARAMSEL = 1,  //paramaters for selected text
-		DELSAX = 2,	//delete with styles
-		INSSAX = 3,	//insert with styles
-		REPSAX = 4,	//replace with styles
-		INS = 5		//inserting chars without styles (from keyboard)
+		STORY = 0,
+		PARAGRAPH = 1,
+		SELECTION = 2,
+		DELSAX = 3,	//delete with styles
+		INSSAX = 4,	//insert with styles
+		REPSAX = 5,	//replace with styles
+		INS = 6		//inserting chars without styles (from keyboard)
        } EditAct;
-
-	typedef enum {  // for recognise what was changing during text edition/changing
-		FRAME = 1,
-		PARAGRAPH = 2,
-		SELECTION = 3,
-		CHAR = 4
-	} EditActPlace;
-
+
        /* these do essentially the same as a dynamic cast but might be more readable */
        virtual PageItem_ImageFrame * asImageFrame() { return NULL; }
        virtual PageItem_Line * asLine() { return NULL; }
@@ -468,8 +462,7 @@
   // for itemText undo purpose
        int oldCPos;
        QString itemTextSaxed;
-	QString getItemTextSaxed(EditActPlace undoItem);
-	QString getItemTextSaxed(int selStart, int selLength);
+	QString getItemTextSaxed(EditAct action);
        QString getTextSaxed(QString str);
   /** Flag fuer PDF-Bookmark */
        bool isBookmark;
@@ -649,12 +642,15 @@
        void setTextToFrameDistRight(double);
        void setTextToFrameDistTop(double);
        void setTextToFrameDistBottom(double);
+	void setColsGapDist(int newCols, double newGap, double newLeft, double newRight, double newTop, double newBottom);
+	void setUndoColsGapDist(int newCols, double newGap, double newLeft, double newRight, double newTop, double newBottom);
        void setColumns(int);
        void setColumnGap(double);
        void setGridOffset(double);
        void setGridDistance(double);
        FirstLineOffsetPolicy firstLineOffset()const;
        void setFirstLineOffset(FirstLineOffsetPolicy);
+	void setFirstLineOffset(FirstLineOffsetPolicy, bool createundo);
        /**
         * \brief Set the text to frame distances all at once
         * @param newLeft left distance
@@ -1068,7 +1064,7 @@
        void restoreArrow(SimpleState *state, bool isUndo, bool isStart);

        void restorePStyle(SimpleState *state, bool isUndo);
-
+	void restoreColsGapDist(SimpleState *state, bool isUndo);
        void restoreType(SimpleState *state, bool isUndo);
        void restoreTextFlowing(SimpleState *state, bool isUndo);
        void restoreImageScaleMode(SimpleState *state, bool isUndo);
@@ -1087,6 +1083,8 @@
        void restoreEditText(SimpleState *state, bool isUndo);
        void restoreLinkTextFrame(UndoState *state, bool isUndo);
        void restoreUnlinkTextFrame(UndoState *state, bool isUndo);
+	void restoreFirstLineOffset(SimpleState *state, bool isUndo);
+
        /*@}*/

        /**
Index: Scribus/scribus/scribusstructs.h
===================================================================
--- Scribus/scribus/scribusstructs.h	(wersja 16552)
+++ Scribus/scribus/scribusstructs.h	(kopia robocza)
@@ -472,6 +472,54 @@
        }
 };

+
+//ETEA = Exactly Text Edit Action
+//for Undo state comparising and detailed description
+typedef enum {
+	ETEAotherEditAction = 0,
+	ETEAsetLineSpacingMode = 1,
+	ETEAsetOpticalMargins = 2,
+	ETEAsetMinWordTracking = 3,
+	ETEAsetNormWordTracking = 4,
+	ETEAsetMinGlyphExtension = 5,
+	ETEAsetMaxGlyphExtension = 6,
+	ETEANewTScaleV = 7,
+	ETEANewTBase = 8,
+	ETEANewTScale = 9,
+	ETEANewLineSpacing = 10,
+	ETEANewSize = 11,
+	ETEANewTracking = 12,
+	ETEANewAlignement = 13,
+	ETEAsetTypeStyle = 14,
+	ETEAnewShadowOffs = 15,
+	ETEAnewUnderline = 16,
+	ETEAnewStrike = 17,
+	ETEAnewOutlineW = 18,
+	ETEAdoClearCStyle = 19,
+	ETEAdoClearPStyle = 20,
+	ETEAnewTxtFill = 21,
+	ETEAnewTxtStroke = 22,
+	ETEAsetActShade = 23,
+	ETEAManageTabs = 24,
+	ETEASetNewFont = 25,
+	ETEAsetItemFSize = 26,
+	ETEAsetItemShade = 27,
+	ETEAsetNewParStyle = 28,
+	ETEAsetNewCharStyle = 29,
+	ETEAclearContents = 30,
+	ETEAslotGetContent = 31,
+	ETEAslotFileAppend = 32,
+	ETEAinsertingText = 33,
+	ETEAinsertingSpecChar = 34,
+	ETEAinsertLoremIpsum = 35,
+	ETEAreplacingText = 36,
+	ETEAdeletingText = 37,
+	//ETEAinsertingTabs = 38,
+	ETEAsetColsGapDist = 39,
+	ETEAsetIndentMargs = 40,
+	ETEAsetFirstLineOffset = 41
+} exactlyTextEditAct;
+
 #endif


Index: Scribus/scribus/actionmanager.cpp
===================================================================
--- Scribus/scribus/actionmanager.cpp	(wersja 16552)
+++ Scribus/scribus/actionmanager.cpp	(kopia robocza)
@@ -19,11 +19,14 @@
 *                                                                         *
 ***************************************************************************/

+#include <QMap>
+
 #include "actionmanager.h"
 #include "scribus.h"
 #include "scribuscore.h"
 #include "scribusdoc.h"
 #include "scribusview.h"
+#include "scribusstructs.h"
 #include "selection.h"
 #include "text/storytext.h"
 #include "undomanager.h"
@@ -94,9 +97,56 @@
        initUnicodeActions(scrActions, mainWindow, unicodeCharActionNames);
        enableUnicodeActions(scrActions, false);
        initSpecialActions();
-
+	initTextEditActionsDescriptions();
 }

+void ActionManager::initTextEditActionsDescriptions()
+{
+	textEditActionDescriptions.clear();
+	textEditActionDescriptions.insert(ETEAotherEditAction, QObject::tr("Other action"));
+	textEditActionDescriptions.insert(ETEAsetLineSpacingMode, QObject::tr("Set line spacing mode"));
+	textEditActionDescriptions.insert(ETEAsetOpticalMargins, QObject::tr("Set optical margins"));
+	textEditActionDescriptions.insert(ETEAsetMinWordTracking, QObject::tr("Set min word tracking"));
+	textEditActionDescriptions.insert(ETEAsetNormWordTracking, QObject::tr("Set normla word tracking"));
+	textEditActionDescriptions.insert(ETEAsetMinGlyphExtension, QObject::tr("Set min glyph extension"));
+	textEditActionDescriptions.insert(ETEAsetMaxGlyphExtension, QObject::tr("Set max glyph extension"));
+	textEditActionDescriptions.insert(ETEANewTScaleV, QObject::tr("Set T scale V"));
+	textEditActionDescriptions.insert(ETEANewTBase, QObject::tr("Set T base"));
+	textEditActionDescriptions.insert(ETEANewTScale, QObject::tr("Set T scale"));
+	textEditActionDescriptions.insert(ETEANewLineSpacing, QObject::tr("Set line spacing"));
+	textEditActionDescriptions.insert(ETEANewSize, QObject::tr("Set size"));
+	textEditActionDescriptions.insert(ETEANewTracking, QObject::tr("Set tracking"));
+	textEditActionDescriptions.insert(ETEANewAlignement, QObject::tr("Apply alignment"));
+	textEditActionDescriptions.insert(ETEAsetTypeStyle, QObject::tr("Set text effects"));
+	textEditActionDescriptions.insert(ETEAnewShadowOffs, QObject::tr("Set shadow offset"));
+	textEditActionDescriptions.insert(ETEAnewUnderline, QObject::tr("Set underline"));
+	textEditActionDescriptions.insert(ETEAnewStrike, QObject::tr("Set strike"));
+	textEditActionDescriptions.insert(ETEAnewOutlineW, QObject::tr("Set outline"));
+	textEditActionDescriptions.insert(ETEAdoClearCStyle, QObject::tr("Clear character formatting"));
+	textEditActionDescriptions.insert(ETEAdoClearPStyle, QObject::tr("Clear paragraph style"));
+	textEditActionDescriptions.insert(ETEAnewTxtFill, QObject::tr("Set fill color"));
+	textEditActionDescriptions.insert(ETEAnewTxtStroke, QObject::tr("Set text stroke"));
+	textEditActionDescriptions.insert(ETEAsetActShade, QObject::tr("Set shade"));
+	textEditActionDescriptions.insert(ETEAManageTabs, QObject::tr("Manage tabs"));
+	textEditActionDescriptions.insert(ETEASetNewFont, QObject::tr("Set font name"));
+	textEditActionDescriptions.insert(ETEAsetItemFSize, QObject::tr("Set font size"));
+	textEditActionDescriptions.insert(ETEAsetItemShade, QObject::tr("Apply shade"));
+	textEditActionDescriptions.insert(ETEAsetNewParStyle, QObject::tr("Apply paragraph style"));
+	textEditActionDescriptions.insert(ETEAsetNewCharStyle, QObject::tr("Apply character style"));
+	textEditActionDescriptions.insert(ETEAclearContents, QObject::tr("Clear contents"));
+	textEditActionDescriptions.insert(ETEAslotGetContent, QObject::tr("Load text file"));
+	textEditActionDescriptions.insert(ETEAslotFileAppend, QObject::tr("Append text file"));
+	textEditActionDescriptions.insert(ETEAinsertingText, QObject::tr("Inserting text"));
+	textEditActionDescriptions.insert(ETEAinsertingSpecChar, QObject::tr("Inserting special char"));
+	textEditActionDescriptions.insert(ETEAinsertLoremIpsum, QObject::tr("Inserting text example"));
+	textEditActionDescriptions.insert(ETEAreplacingText, QObject::tr("Replacing text"));
+	textEditActionDescriptions.insert(ETEAdeletingText, QObject::tr("Deleting text"));
+	// better merge it with "ManageTabs"
+	//textEditActionDescriptions.insert(ETEAinsertingTabs, QObject::tr("Inserting Tabs"));
+	textEditActionDescriptions.insert(ETEAsetColsGapDist, QObject::tr("Manage columns, gaps, distances"));
+	textEditActionDescriptions.insert(ETEAsetIndentMargs, QObject::tr("Manage indents and margins"));
+	textEditActionDescriptions.insert(ETEAsetFirstLineOffset, QObject::tr("Set first line offset"));
+}
 void ActionManager::initFileMenuActions()
 {
        QString name;
@@ -1499,6 +1549,7 @@
        (*scrActions)["specialUnicodeSequenceBegin"]->setTexts( tr("Insert Unicode Character Begin Sequence"));
        languageChangeUnicodeActions(scrActions);
        languageChangeActions();
+	initTextEditActionsDescriptions();
 }

 void ActionManager::languageChangeUnicodeActions(QMap<QString, QPointer<ScrAction> > *actionMap)
Index: Scribus/scribus/pageitem_textframe.h
===================================================================
--- Scribus/scribus/pageitem_textframe.h	(wersja 16552)
+++ Scribus/scribus/pageitem_textframe.h	(kopia robocza)
@@ -34,6 +34,7 @@
 class ScribusDoc;

 #include "text/nlsconfig.h"
+#include "scribusstructs.h"

 #ifdef NLS_PROTO
 #include "text/sctextengine.h"
@@ -66,8 +67,8 @@
        void deleteSelectedTextFromFrame();
        void setNewPos(int oldPos, int len, int dir);
        void ExpandSel(int dir, int oldPos);
-	void ExpandParSel(); //expand selection to whole paragrpah(s)
        void expandParaSelection(bool includeEOL = false);
+	void restoreTextSelection(int selStart, int selLength);
        void deselectAll();

        virtual void invalidateLayout();
@@ -104,12 +105,20 @@
        bool cursorBiasBackward;

        void setShadow();
-	void restoreTextSelection(int selStart, int selLength);
        QString currentShadow;
        QMap<QString,StoryText> shadows;
+
+	EditAct lastTextUndoAction;
+	exactlyTextEditAct lastETEA;
+
 public:
-	void updateUndo(EditAct action = PARAMFULL, QString str = "");
-	EditAct lastUndoAction;
+	void clearLastUndoAction() { lastTextUndoAction = PageItem::NOACTION; };
+	EditAct getLastUndoAction() { return lastTextUndoAction; };
+	exactlyTextEditAct getLastETEA() { return lastETEA; };
+	void setLastUndoAction(EditAct action) { lastTextUndoAction = action; };
+	void setLastETEA(exactlyTextEditAct ETEA) { lastETEA = ETEA; };
+	void updateUndo(EditAct action, exactlyTextEditAct newAction, QString str = "");
+	void updateUndo(EditAct action, QString str = "") { updateUndo(action, ETEAotherEditAction, str); };
 private slots:
        void slotInvalidateLayout();
 };
