[prev in list] [next in list] [prev in thread] [next in thread]
List: kwrite-devel
Subject: [PATCH] Kate Part - make static word wrap work
From: Christoph Cullmann <crossfire () babylon2k ! de>
Date: 2002-03-06 21:25:50
[Download RAW message or body]
Hi,
here is a patch from Anders + me to make the static word wrap working again in
Kate part, if nobody has objections, I will commit ;) (That will solve 3-4
bugs)
cu
Christoph
--
Christoph "Crossfire" Cullmann
Kate/KDE developer
cullmann@kde.org
http://kate.kde.org
["wordwrap.diff" (text/x-diff)]
? wordwrap.diff
Index: part/katedocument.cpp
===================================================================
RCS file: /home/kde/kdelibs/kate/part/katedocument.cpp,v
retrieving revision 1.162
diff -u -3 -p -r1.162 katedocument.cpp
--- part/katedocument.cpp 2002/03/03 23:00:31 1.162
+++ part/katedocument.cpp 2002/03/06 21:23:23
@@ -639,7 +639,7 @@ void KateDocument::editStart (bool withU
editIsRunning = true;
noViewUpdates = true;
editWithUndo = withUndo;
-
+
buffer->noHlUpdate = true;
editTagLineStart = 0xffffff;
@@ -670,12 +670,10 @@ void KateDocument::editEnd ()
if (editSessionNumber == 0)
return;
- /*
// wrap the new/changed text
if (editSessionNumber == 1)
if (myWordWrap)
wrapText (editTagLineStart, editTagLineEnd, myWordWrapAt);
- */
editSessionNumber--;
@@ -714,7 +712,7 @@ bool KateDocument::wrapText (uint startL
{
if (endLine < startLine)
return false;
-
+
if (col == 0)
return false;
@@ -739,6 +737,7 @@ bool KateDocument::wrapText (uint startL
if (!(z < 1))
{
+ z++; // (anders: avoid the space at the beginning of the line)
editWrapLine (line, z);
endLine++;
}
@@ -915,8 +914,22 @@ bool KateDocument::editWrapLine ( uint l
{
view = myViews.at(z2);
view->myViewInternal->insLine(line+1);
- }
+ // correct cursor position
+ if (view->cursorCache.line > (int)line)
+ {
+ view->cursorCache.line++;
+ view->cursorCacheChanged = true;
+ }
+ else if ( view->cursorCache.line == (int)line
+ && view->cursorCache.col >= (int)col )
+ {
+ view->cursorCache.col = tl->length();
+ view->cursorCache.line++;
+ view->cursorCacheChanged = true;
+ }
+
+ }
editEnd ();
return true;
@@ -1639,8 +1652,6 @@ void KateDocument::readConfig(KConfig *c
myWordWrap = config->readBoolEntry("Word Wrap On", false);
myWordWrapAt = config->readNumEntry("Word Wrap At", 80);
- if (myWordWrap)
- wrapText (myWordWrapAt);
setTabWidth(config->readNumEntry("TabWidth", 8));
setUndoSteps(config->readNumEntry("UndoSteps", 256));
@@ -1650,6 +1661,15 @@ void KateDocument::readConfig(KConfig *c
colors[0] = config->readColorEntry("Color Background", &colors[0]);
colors[1] = config->readColorEntry("Color Selected", &colors[1]);
+ if (myWordWrap)
+ {
+ editStart (false);
+ wrapText (myWordWrapAt);
+ editEnd ();
+ setModified(false);
+ emit textChanged ();
+ }
+
tagAll();
updateEditAccels();
updateViews();
@@ -1998,7 +2018,13 @@ bool KateDocument::openFile()
setMTime();
if (myWordWrap)
+ {
+ editStart (false);
wrapText (myWordWrapAt);
+ editEnd ();
+ setModified(false);
+ emit textChanged ();
+ }
int hl = hlManager->wildcardFind( m_file );
Index: part/kateview.cpp
===================================================================
RCS file: /home/kde/kdelibs/kate/part/kateview.cpp,v
retrieving revision 1.112
diff -u -3 -p -r1.112 kateview.cpp
--- part/kateview.cpp 2002/03/03 23:00:31 1.112
+++ part/kateview.cpp 2002/03/06 21:23:25
@@ -2162,7 +2162,6 @@ void KateView::doReplaceAction(int resul
int pos;
rlen = replaceWith.length();
-
int tmpRlen = rlen;
// anders: allow backreferences in replace strings:)
_______________________________________________
kwrite-devel mailing list
kwrite-devel@mail.kde.org
http://mail.kde.org/mailman/listinfo/kwrite-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic