[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-bugs-dist
Subject: [Bug 94693] Cursor up isn't working with a certain kind of wrapping
From: Dominik Haumann <dhdev () gmx ! de>
Date: 2007-05-27 20:00:05
Message-ID: 20070527200005.11074.qmail () ktown ! kde ! org
[Download RAW message or body]
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
http://bugs.kde.org/show_bug.cgi?id=94693
dhdev gmx de changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
------- Additional Comments From dhdev gmx de 2007-05-27 22:00 -------
SVN commit 668824 by dhaumann:
fix: tabs in wrapped line broke cursor navigation
Is there a better/faster way? - todo: forward port
Thanks to Ruud Koolen for the patch!
CCMAIL: kwrite-devel kde org
BUG: 94693
M +5 -5 katerenderer.cpp
M +16 -1 kateviewinternal.cpp
--- branches/KDE/3.5/kdelibs/kate/part/katerenderer.cpp #668823:668824
@ -798,6 +798,11 @
Q_ASSERT(width);
x += width;
+ // How should tabs be treated when they word-wrap on a print-out?
+ // if startcol != 0, this messes up (then again, word wrapping messes up anyway)
+ if (unicode[z] == QChar('\t'))
+ x -= x % width;
+
if (unicode[z].isSpace())
{
lastWhiteSpace = z+1;
@ -816,11 +821,6 @
}
}
- // How should tabs be treated when they word-wrap on a print-out?
- // if startcol != 0, this messes up (then again, word wrapping messes up anyway)
- if (unicode[z] == QChar('\t'))
- x -= x % width;
-
if (x <= maxwidth)
{
if (lastWhiteSpace > -1)
--- branches/KDE/3.5/kdelibs/kate/part/kateviewinternal.cpp #668823:668824
@ -1653,7 +1653,22 @
if (maxX && range.wrap) {
QChar lastCharInLine = textLine(range.line)->getChar(range.endCol - 1);
- maxX -= m_view->renderer()->config()->fontMetrics()->width(lastCharInLine);
+
+ if (lastCharInLine == QChar('\t')) {
+ int lineSize = 0;
+ int lastTabSize = 0;
+ for(int i = range.startCol; i < range.endCol; i++) {
+ if (textLine(range.line)->getChar(i) == QChar('\t')) {
+ lastTabSize = m_view->tabWidth() - (lineSize % m_view->tabWidth());
+ lineSize += lastTabSize;
+ } else {
+ lineSize++;
+ }
+ }
+ maxX -= lastTabSize * m_view->renderer()->spaceWidth();
+ } else {
+ maxX -= m_view->renderer()->config()->fontMetrics()->width(lastCharInLine);
+ }
}
return maxX;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic