View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0009917 | Scribus | Story Editor / Text Frames | public | 2011-04-09 18:43 | 2011-12-30 16:26 |
Reporter | wolfpack-nav | Assigned To | fschmid | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Platform | LINUX | OS | Ubuntu 10.10 | OS Version | 10.10 |
Product Version | 1.5.0svn | ||||
Fixed in Version | 1.5.0svn | ||||
Summary | 0009917: Cursor not visible in an empty Text Frame | ||||
Description | When I select an empty Text Frame the cursor inside Text frame is not visible. | ||||
Tags | No tags attached. | ||||
Patch | |||||
|
void CanvasMode_Edit::drawTextCursor ( QPainter *p, PageItem_TextFrame* textframe ) { //CB: If we have this test in we get no initial cursor placed for a new text frame // but if we do, we crash when we resize.. 0009886 if(textframe->lastInFrame() < 0) return; |
|
http://lists.scribus.net/pipermail/scribus-dev/2011-August/001237.html proposed a patch commit 644bbf2dae1187a43a79eda1aec0e6da2ef9243e Author: Elvis Stansvik <elvstone@gmail.com> Date: Thu Aug 18 22:41:41 2011 +0200 Fix crash / no initial cursor dilemma bug: The PageItem::lastInFrame() function will return -1 when: 1) The frame is empty (no text). 2) The frame is so small that no text is visible (overflowing). This led to a crash in CanvasMode::commonDrawTextCursor(...) which tried to use this -1 as a parameter to StoryText::item(...). The old "fix" that was in place for this in the edit canvas mode was to simply not paint the cursor when lastInFrame() returns < 0. This fixed the crash but had the unwanted side effect that no cursor was painted when activating the edit mode on an empty frame. This new fix instead changes CanvasMode::commonDrawTextCursor(...) to still paint the cursor, but also make sure that it's never using a < 0 index. (Note: CanvasMode::commonDrawTextCursor(...) is called CanvasMode_Edit::drawTextCursor(...) in 1.5svn. It was moved/renamed in my tables repository) diff --git a/Scribus/scribus/canvasmode.cpp b/Scribus/scribus/canvasmode.cpp index 51b0bbc..28a94cb 100644 --- a/Scribus/scribus/canvasmode.cpp +++ b/Scribus/scribus/canvasmode.cpp @@ -756,7 +756,7 @@ void CanvasMode::commonDrawTextCursor(QPainter* p, PageItem_TextFrame* textframe { // Happens often when typing directly into frame. // And the cursor curses nothing, vertigo. - textCursorPos = textframe->lastInFrame(); + textCursorPos = qMax(0, textframe->lastInFrame()); QChar textCursorChar = textframe->itemText.text(textCursorPos); if (textCursorChar == SpecialChars::PARSEP || textCursorChar == SpecialChars::LINEBREAK) { diff --git a/Scribus/scribus/canvasmode_edit.cpp b/Scribus/scribus/canvasmode_edit.cpp index b29a729..2c6f5f2 100644 --- a/Scribus/scribus/canvasmode_edit.cpp +++ b/Scribus/scribus/canvasmode_edit.cpp @@ -206,10 +206,6 @@ void CanvasMode_Edit::drawControls(QPainter* p) void CanvasMode_Edit::drawTextCursor ( QPainter *p, PageItem_TextFrame* textframe ) { - //CB: If we have this test in we get no initial cursor placed for a new text frame - // but if we do, we crash when we resize.. 0009886 - if(textframe->lastInFrame() < 0) - return; if ((!m_longCursorTime && m_blinkTime.elapsed() > qApp->cursorFlashTime() / 2 ) || (m_longCursorTime && m_blinkTime.elapsed() > qApp->cursorFlashTime() ) ) diff --git a/Scribus/scribus/canvasmode_edittable.cpp b/Scribus/scribus/canvasmode_edittable.cpp index 4b7c467..63002e8 100644 --- a/Scribus/scribus/canvasmode_edittable.cpp +++ b/Scribus/scribus/canvasmode_edittable.cpp @@ -337,16 +337,6 @@ void CanvasMode_EditTable::handleMouseDrag(QMouseEvent* event) void CanvasMode_EditTable::drawTextCursor(QPainter* p) { - if (m_table->activeCell().textFrame()->lastInFrame() < 0) - { - /* - * Happens when a single-line text frame overflows and going - * further will the call to commonDrawTextCursor(...) below - * would result in a crash, so we just return instead. - */ - return; - } - if ((!m_longBlink && m_blinkTime.elapsed() > qApp->cursorFlashTime() / 2) || (m_longBlink && m_blinkTime.elapsed() > qApp->cursorFlashTime())) { |
|
ELVIS no cursor in new frame PATCH.txt (3,257 bytes)
commit 644bbf2dae1187a43a79eda1aec0e6da2ef9243e Author: Elvis Stansvik <elvstone@gmail.com> Date: Thu Aug 18 22:41:41 2011 +0200 Fix crash / no initial cursor dilemma bug: The PageItem::lastInFrame() function will return -1 when: 1) The frame is empty (no text). 2) The frame is so small that no text is visible (overflowing). This led to a crash in CanvasMode::commonDrawTextCursor(...) which tried to use this -1 as a parameter to StoryText::item(...). The old "fix" that was in place for this in the edit canvas mode was to simply not paint the cursor when lastInFrame() returns < 0. This fixed the crash but had the unwanted side effect that no cursor was painted when activating the edit mode on an empty frame. This new fix instead changes CanvasMode::commonDrawTextCursor(...) to still paint the cursor, but also make sure that it's never using a < 0 index. (Note: CanvasMode::commonDrawTextCursor(...) is called CanvasMode_Edit::drawTextCursor(...) in 1.5svn. It was moved/renamed in my tables repository) diff --git a/Scribus/scribus/canvasmode.cpp b/Scribus/scribus/canvasmode.cpp index 51b0bbc..28a94cb 100644 --- a/Scribus/scribus/canvasmode.cpp +++ b/Scribus/scribus/canvasmode.cpp @@ -756,7 +756,7 @@ void CanvasMode::commonDrawTextCursor(QPainter* p, PageItem_TextFrame* textframe { // Happens often when typing directly into frame. // And the cursor curses nothing, vertigo. - textCursorPos = textframe->lastInFrame(); + textCursorPos = qMax(0, textframe->lastInFrame()); QChar textCursorChar = textframe->itemText.text(textCursorPos); if (textCursorChar == SpecialChars::PARSEP || textCursorChar == SpecialChars::LINEBREAK) { diff --git a/Scribus/scribus/canvasmode_edit.cpp b/Scribus/scribus/canvasmode_edit.cpp index b29a729..2c6f5f2 100644 --- a/Scribus/scribus/canvasmode_edit.cpp +++ b/Scribus/scribus/canvasmode_edit.cpp @@ -206,10 +206,6 @@ void CanvasMode_Edit::drawControls(QPainter* p) void CanvasMode_Edit::drawTextCursor ( QPainter *p, PageItem_TextFrame* textframe ) { - //CB: If we have this test in we get no initial cursor placed for a new text frame - // but if we do, we crash when we resize.. #9886 - if(textframe->lastInFrame() < 0) - return; if ((!m_longCursorTime && m_blinkTime.elapsed() > qApp->cursorFlashTime() / 2 ) || (m_longCursorTime && m_blinkTime.elapsed() > qApp->cursorFlashTime() ) ) diff --git a/Scribus/scribus/canvasmode_edittable.cpp b/Scribus/scribus/canvasmode_edittable.cpp index 4b7c467..63002e8 100644 --- a/Scribus/scribus/canvasmode_edittable.cpp +++ b/Scribus/scribus/canvasmode_edittable.cpp @@ -337,16 +337,6 @@ void CanvasMode_EditTable::handleMouseDrag(QMouseEvent* event) void CanvasMode_EditTable::drawTextCursor(QPainter* p) { - if (m_table->activeCell().textFrame()->lastInFrame() < 0) - { - /* - * Happens when a single-line text frame overflows and going - * further will the call to commonDrawTextCursor(...) below - * would result in a crash, so we just return instead. - */ - return; - } - if ((!m_longBlink && m_blinkTime.elapsed() > qApp->cursorFlashTime() / 2) || (m_longBlink && m_blinkTime.elapsed() > qApp->cursorFlashTime())) { |
|
Someone already applied this patch. |
Date Modified | Username | Field | Change |
---|---|---|---|
2011-04-09 18:43 | wolfpack-nav | New Issue | |
2011-04-16 08:58 | cbradney | Note Added: 0026098 | |
2011-04-16 08:58 | cbradney | Relationship added | related to 0009886 |
2011-08-24 14:54 | JLuc | Note Added: 0026779 | |
2011-08-24 14:56 | JLuc | File Added: ELVIS no cursor in new frame PATCH.txt | |
2011-12-28 09:20 | fschmid | Note Added: 0027400 | |
2011-12-28 09:20 | fschmid | Status | new => resolved |
2011-12-28 09:20 | fschmid | Fixed in Version | => 1.5.0svn |
2011-12-28 09:20 | fschmid | Resolution | open => fixed |
2011-12-28 09:20 | fschmid | Assigned To | => fschmid |
2011-12-30 16:26 | 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 |