[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: Re: koffice/kspread
From: James Michael Greenhalgh <jgreenhalgh () opendoorsoftware ! com>
Date: 2003-08-22 3:51:01
[Download RAW message or body]
On August 21, 2003 02:00 pm, Ariya Hidayat wrote:
> --- koffice/kspread/kspread_editors.cc #1.55:1.56
> @@ -209,11 +209,19 @@ void KSpreadTextEditor::handleKeyPressEv
>
> int cur = m_pEdit->cursorPosition();
> - QString tmp( m_pEdit->text().left( cur ) );
> - QString tmp2( m_pEdit->text().right( m_pEdit->text().length() - cur )
> ); + QString tmp, tmp2;
> + int n = -1;
>
> - int n = exp.search(tmp);
> + // this is ugly, and sort of hack
> + // FIXME rewrite to use the real KSpreadTokenizer
> + for( unsigned i = 0; i < 10; i++ )
> + {
> + tmp = m_pEdit->text().left( cur+i );
> + tmp2 = m_pEdit->text().right( m_pEdit->text().length() - cur - i );
>
> - if (n == -1)
> - return;
> + n = exp.search(tmp);
> + if( n >= 0 ) break;
> + }
> +
> + if (n == -1) return;
>
> QString newPart;
> @@ -229,5 +237,5 @@ void KSpreadTextEditor::handleKeyPressEv
> QString newString = tmp.left(n);
> newString += newPart;
> - cur = newString.length();
> + cur = newString.length() - i;
> newString += tmp2;
This now fails to compile for me using gcc version 3.3.2 20030812 (Debian
prerelease):
../../kspread/kspread_editors.cc: In member function `virtual void
KSpreadTextEditor::handleKeyPressEvent(QKeyEvent*)':
../../kspread/kspread_editors.cc:239: error: name lookup of `i' changed for
new
ISO `for' scoping
../../kspread/kspread_editors.cc:216: error: using obsolete binding at `i
I patched to fix the problem (inline below), but not sure if this was the
correct course of action:.
@@ -213,7 +213,8 @@ void KSpreadTextEditor::handleKeyPressEv
// this is ugly, and sort of hack
// FIXME rewrite to use the real KSpreadTokenizer
- for( unsigned i = 0; i < 10; i++ )
+ unsigned int i;
+ for( i = 0; i < 10; i++ )
{
tmp = m_pEdit->text().left( cur+i );
tmp2 = m_pEdit->text().right( m_pEdit->text().length() - cur - i );
-James
--
James Michael Greenhalgh
jgreenhalgh@opendoorsoftware.com
https://opendoorsoftware.com
open minds providing open source solutions
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic