From kde-bugs-dist Sun Apr 30 06:03:01 2000 From: owner () bugs ! kde ! org (Stephan Kulow) Date: Sun, 30 Apr 2000 06:03:01 +0000 To: kde-bugs-dist Subject: Bug#1039: marked as done (Simple kedit fix ( now it saves cursor position in text )) X-MARC-Message: https://marc.info/?l=kde-bugs-dist&m=95707472504372 Your message dated Sat, 29 Apr 2000 22:54:40 -0700 with message-id <00042922544004.11544@wantelbos> and subject line Fixed has caused the attached bug report to be marked as done. This means that you claim that the problem has been dealt with. If this is not the case it is now your responsibility to reopen the bug report if necessary, and/or fix the problem forthwith. (NB: If you are a system administrator and have no idea what I'm talking about this indicates a serious mail system misconfiguration somewhere. Please contact me immediately.) Stephan Kulow (administrator, KDE bugs database) Received: (at submit) by bugs.kde.org; 22 Mar 1999 08:30:19 +0000 From rlewczuk@elka.pw.edu.pl Mon Mar 22 09:30:19 1999 Received: from elektron.elka.pw.edu.pl ([148.81.63.249]:43447 "EHLO elektron.elka.pw.edu.pl" ident: "root") by alpha.tat.physik.uni-tuebingen.de with ESMTP id <106119-19604>; Mon, 22 Mar 1999 09:30:16 +0100 Received: from elektron.elka.pw.edu.pl ([148.81.63.249]:46984 "EHLO elektron.elka.pw.edu.pl" ident: "TIMEDOUT2") by elektron.elka.pw.edu.pl with ESMTP id <224283-21559>; Mon, 22 Mar 1999 09:28:13 +0100 Date: Mon, 22 Mar 1999 09:28:03 +0100 (MET) From: Rafal Marcin Lewczuk To: submit@bugs.kde.org Subject: Simple kedit fix ( now it saves cursor position in text ) Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Return-Path: X-Orcpt: rfc822;submit@bugs.kde.org There's a simple patch, which allows kedit to save a cursor position while saving session. It may be not a perfect one, but resetting a cursor pos after logging in was annoying me, so anything like this should exist in kedit ( in my opinion ). Rafal Lewczuk ----------> wuebben@kde.org diff -c --recursive kdeutils-1.1/kedit/kedit.cpp kdeutils-1.1-patched/kedit/kedit.cpp *** kdeutils-1.1/kedit/kedit.cpp Sun Jan 10 01:51:00 1999 --- kdeutils-1.1-patched/kedit/kedit.cpp Sun Mar 21 23:00:34 1999 *************** *** 413,424 **** void TopLevel::saveProperties(KConfig* config){ if(strcmp(eframe->getName(), i18n("Untitled"))== 0 && !eframe->isModified()) return; config->writeEntry("filename",eframe->getName().data()); config->writeEntry("modified",eframe->isModified()); ! if(eframe->isModified()){ QString fullname; --- 413,430 ---- void TopLevel::saveProperties(KConfig* config){ + int curLine, curColumn; + if(strcmp(eframe->getName(), i18n("Untitled"))== 0 && !eframe->isModified()) return; config->writeEntry("filename",eframe->getName().data()); config->writeEntry("modified",eframe->isModified()); ! // Save current cursor position ! eframe->getCursorPosition( &curLine, &curColumn ); ! config->writeEntry("currentLine", curLine ); ! config->writeEntry("currentColumn", curColumn ); ! if(eframe->isModified()){ QString fullname; *************** *** 445,451 **** QString filename = config->readEntry("filename",""); int modified = config->readNumEntry("modified",0); ! if(!filename.isEmpty() && modified){ bool ok; --- 451,459 ---- QString filename = config->readEntry("filename",""); int modified = config->readNumEntry("modified",0); ! int curLine = config->readNumEntry("currentLine", 0); ! int curColumn = config->readNumEntry("currentColumn", 0); ! if(!filename.isEmpty() && modified){ bool ok; *************** *** 456,462 **** file.detach(); eframe->loadFile(file,KEdit::OPEN_READWRITE); eframe->setModified(); ! eframe->setFileName(filename.data()); setFileCaption(); } --- 464,471 ---- file.detach(); eframe->loadFile(file,KEdit::OPEN_READWRITE); eframe->setModified(); ! eframe->setFileName(filename.data()); ! eframe->setCursorPosition( curLine, curColumn ); setFileCaption(); } *************** *** 464,470 **** else{ if(!filename.isEmpty()){ ! eframe->loadFile(filename,KEdit::OPEN_READWRITE); } } } --- 473,480 ---- else{ if(!filename.isEmpty()){ ! eframe->loadFile(filename,KEdit::OPEN_READWRITE); ! eframe->setCursorPosition( curLine, curColumn ); } } } diff -c --recursive kdeutils-1.1/kedit/keditcl1.cpp kdeutils-1.1-patched/kedit/keditcl1.cpp *** kdeutils-1.1/kedit/keditcl1.cpp Sun Mar 21 22:08:30 1999 --- kdeutils-1.1-patched/kedit/keditcl1.cpp Sat Mar 20 22:58:49 1999 *************** *** 573,579 **** getCursorPosition(&line,&col); QString linetext = textLine(line); ! // O.K here is the deal: The function getCursorPosition returns the character // position of the cursor, not the screenposition. I.e,. assume the line // consists of ab\tc then the character c will be on the screen on position 8 // whereas getCursorPosition will return 3 if the cursors is on the character c. --- 573,579 ---- getCursorPosition(&line,&col); QString linetext = textLine(line); ! // O.K here is the deal: The function getCursorPositoin returns the character // position of the cursor, not the screenposition. I.e,. assume the line // consists of ab\tc then the character c will be on the screen on position 8 // whereas getCursorPosition will return 3 if the cursors is on the character c.