View Issue Details

IDProjectCategoryView StatusLast Update
0002570ScribusStory Editor / Text Framespublic2005-11-30 23:40
Reporterintrigeri Assigned Tofschmid  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
PlatformppcOSDebianOS Versionsarge
Product Version1.3.1cvs 
Fixed in Version1.3.1cvs 
Summary0002570: Special characters, when copied to search/replace dialog, are replaced by their raw display character
DescriptionWhen a non-breaking space is copied in the story editor then pasted into the search/replace dialog, an underscore is pasted instead of a non-breaking space.

It's really annoying to be compelled to exit the story editor, edit a text frame containing a nbsp, copy it, go back to the story editor, then run search/replace.
Additional InformationThat's why I hacked SEditor:copy() in story.cpp so that the special characters' Scribus Unicode char is copied into tBuffer, and thus can be pasted into the search/replace dialog.

Two problems are remaining with this patch :
   * when pasted into another application, the copied text results in weird
     Unicode chars ; this is not worse than before : underscore were copied
     instead of nbsp, etc/
   * it slows down selection, which has to be scanned for special chars,
     instead of using the quick selectedText() Qt function.
TagsNo tags attached.
Patch

Relationships

related to 0002602 closedfschmid Text selection in the story editor is mighty slow 
related to 0002635 closed Special characters, when copied to search dialog and searched, are not found in the text 

Activities

2005-09-16 01:26

 

story-copy_cvs20050915.diff (2,032 bytes)   
--- Scribus/scribus/story.cpp	2005-09-11 23:21:42.000000000 +0200
+++ Scribus-work/scribus/story.cpp	2005-09-16 03:05:56.000000000 +0200
@@ -1566,7 +1566,56 @@
 	{
 		disconnect(QApplication::clipboard(), SIGNAL(dataChanged()), this, SLOT(ClipChange()));
 		disconnect(QApplication::clipboard(), SIGNAL(selectionChanged()), this, SLOT(SelClipChange()));
-		tBuffer = selectedText();
+		tBuffer = "";
+		int PStart, PEnd, SelStart, SelEnd, start, end;
+		int p, i;
+		QChar origChar;
+		QChar nextOrigChar;
+		QColor dispColor;
+		QChar destChar;
+		getSelection(&PStart, &SelStart, &PEnd, &SelEnd);
+		getCursorPosition(&p, &i);
+		for (int pa = PStart; pa < PEnd+1; ++pa)
+		{
+			if (pa == PStart)
+				start = SelStart;
+			else
+				start = 0;
+			if (pa == PEnd)
+				end = SelEnd;
+			else
+				end = paragraphLength(pa);
+			for (int ca = start; ca < end; ++ca)
+			{
+				origChar = text(pa)[ca];
+				setCursorPosition(pa,ca+1);
+				dispColor = color();
+				// special chars are displayed in red
+				if (dispColor == QColor(red))
+				{
+					if (origChar == '#')
+						destChar = QChar(ScApp->scrActions["specialPageNumber"]->actionInt());
+					else if (origChar == '_')
+						destChar = QChar(ScApp->scrActions["specialNonBreakingSpace"]->actionInt());
+					else if (origChar == '*')
+						destChar = QChar(ScApp->scrActions["specialNewLine"]->actionInt());
+					else if (origChar == '|')
+						destChar = QChar(ScApp->scrActions["specialFrameBreak"]->actionInt());
+					else if (origChar == '^')
+						destChar = QChar(ScApp->scrActions["specialColumnBreak"]->actionInt());
+					else if (origChar == '=')
+						destChar = QChar(ScApp->scrActions["specialNonBreakingHyphen"]->actionInt());
+					else
+						destChar = origChar;
+				}
+				else
+					destChar = origChar;
+				tBuffer.append(destChar);
+			}
+			if (pa != PEnd)
+			        tBuffer.append("\n");
+		}		
+		setCursorPosition(p,i);
 		copyStyledText();
 		QApplication::clipboard()->setText(tBuffer, QClipboard::Clipboard);
 		ClipData = 1;
story-copy_cvs20050915.diff (2,032 bytes)   

cbradney

2005-09-23 22:29

administrator   ~0006689

This causes 2602

Issue History

Date Modified Username Field Change
2005-09-16 01:26 intrigeri New Issue
2005-09-16 01:26 intrigeri File Added: story-copy_cvs20050915.diff
2005-09-16 12:13 plinnell Assigned To => fschmid
2005-09-16 12:13 plinnell Status new => assigned
2005-09-16 20:59 fschmid Status assigned => resolved
2005-09-16 20:59 fschmid Fixed in Version => 1.3.1cvs
2005-09-16 20:59 fschmid Resolution open => fixed
2005-09-23 22:29 cbradney Relationship added related to 0002602
2005-09-23 22:29 cbradney Note Added: 0006689
2005-09-23 22:29 cbradney Status resolved => assigned
2005-09-24 08:02 fschmid Status assigned => resolved
2005-10-01 04:58 ringerc Relationship added related to 0002635
2005-11-30 23:40 cbradney Status resolved => closed
2015-09-17 20:08 Kunda Category Story Editor / Text Frames => Story Ed/Txt Frames
2015-09-17 20:12 Kunda Category Story Ed/Txt Frames => Story Editor / Text Frames