Bug 253191 - bug in block selection mode and replacement in Kate
Summary: bug in block selection mode and replacement in Kate
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-04 02:17 UTC by Alessandro Ghersi
Modified: 2015-11-25 16:00 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.11


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alessandro Ghersi 2010-10-04 02:17:31 UTC
Version:           unspecified (using KDE 4.3.2) 
OS:                Linux

Bug reported here:
https://bugs.launchpad.net/ubuntu/+source/kdesdk/+bug/588449

Kate 3.3.2 (KDE 4..3.2)
Kubuntu karmic koala
Description: Ubuntu 9.10
Release: 9.10
kate:
  Installed: 4:4.3.2-0ubuntu1

The bug happens when I do block selection (CTRL+SHIFT+B) and replacement in Kate:

I select a column that I want to replace, I set the "Selection only" option and click on "Replace All" (if I use the simple "Replace" nothing happens, the bug may rather be this one), and then it does the replacement.

The column is correctly replaced, but the problem is that any occurrence of the item to be replaced in a further column (that should stay unchanged) will also be replaced. It's annoying, since I use extensively this feature...

An example: I want to change the first column of integer from "1" to "2"

# ----------
# Start point
aa 1 2
ab 1 3
ac 1 1
ad 1 1
ae 1 4
# ----------

The expected result is
# ----------
# expected
aa 2 2
ab 2 3
ac 2 1
ad 2 1
ae 2 4
# ----------

But the resulting block replacement is
# ----------
# actual block replacement
aa 2 2
ab 2 3
ac 2 2
ad 2 2
ae 2 4
# ----------

Note that the occurrence of "1" in the third column has also changed to "2", what is not intended.

Hope you can improve this! BTW is Kate still developed or the project is stopped?

Best regards,

           Anastaze

ProblemType: Bug
Architecture: amd64
Date: Tue Jun 1 21:19:15 2010
DistroRelease: Ubuntu 9.10
ExecutablePath: /usr/bin/kate
NonfreeKernelModules: nvidia
Package: kate 4:4.3.2-0ubuntu1
ProcEnviron:
 SHELL=/bin/bash
 PATH=(custom, no user)
 LANG=en_US.UTF-8
 LANGUAGE=
ProcVersionSignature: Ubuntu 2.6.31-21.59-generic
SourcePackage: kdesdk
Uname: Linux 2.6.31-21-generic x86_64

Reproducible: Didn't try
Comment 1 Dominik Haumann 2013-08-14 11:59:50 UTC
@Andrey: is this still an issue with your recent patches?
Comment 2 Andrey Matveyakin 2013-08-16 13:28:22 UTC
Dominik, looks like the bug was fixed long before my patches.

Still I think it would be better to add something like this to searchbar_test

// Make sure Kate doesn't replace anything outside selection in block mode (see bug 253191)
void SearchBarTest::testReplaceInBlockMode() {
  KateDocument doc(false, false, false);
  KateView view(&doc, 0);
  KateViewConfig config(&view);

  doc.setText("111\n111");
  view.setBlockSelection(true);
  view.setSelection(KTextEditor::Range(0, 1, 1, 2));

  KateSearchBar bar(true, &view, &config);

  bar.setSearchPattern("1");
  bar.setReplacementPattern("2");
  bar.replaceAll();

  QCOMPARE(doc.text(), QString("121\n121"));
}

Shall I commit this test?
Comment 3 Dominik Haumann 2013-08-16 14:21:02 UTC
Yes: Having this test is a very good idea in my opinion. Thanks for the work!

Can you close the bug when committing the unit test?
Comment 4 Andrey Matveyakin 2013-08-16 14:48:58 UTC
It turned out I can't since I don't have permit to close bugs. The
http://community.kde.org/Sysadmin/GitKdeOrgManual
manual says I should request for bug edit permission through this link:
https://bugs.kde.org/enter_sysadmin_request.cgi
but when I click it I only see
“Sorry, entering a bug into the product sysadmin has been disabled.”
Looks like a bug in KDE bug tracker manual :-)
Comment 5 Dominik Haumann 2013-08-16 14:57:40 UTC
You can edit bugs now ;)

PS: sysadmin requests now go to http://sysadmin.kde.org/tickets/
Comment 6 Andrey Matveyakin 2013-08-16 15:30:42 UTC
Thank you, Dominik!

Btw, looks like https://bugs.kde.org/page.cgi?id=fields.html#status page is also outdated. While it describes 

UNCONFIRMED
CONFIRMED
IN_PROGRESS
RESOLVED
VERIFIED

statuses, I actually see

UNCONFIRMED
CONFIRMED
ASSIGNED
RESOLVED
NEEDSINFO

and after I select “RESOLVED”, 13 various resolutions appear in the second combobox, bug only 5 of them are documented.

Where should bugs in KDE info pages be filed?
Comment 7 Dominik Haumann 2013-08-16 16:17:23 UTC
Again sysadmins I guess.
Comment 8 Bleicher 2015-11-25 16:00:38 UTC
I just found out that this bug seems to be still around - I have a machine running CentOS 6.5, KDE 4.3.4 and I have the same problem if I use Kate or Kwrite.