Bug 139447 - having fun with the auto replace feature
Summary: having fun with the auto replace feature
Status: RESOLVED FIXED
Alias: None
Product: konversation
Classification: Applications
Component: general (show other bugs)
Version: 1.0.1
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Konversation Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-12-31 16:07 UTC by Frederik Schwarzer
Modified: 2009-04-17 22:38 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
autoreplace patch for regexp commas (2.26 KB, patch)
2009-04-05 05:48 UTC, Travis McHenry
Details
allow commas in regexp (3.03 KB, patch)
2009-04-05 21:02 UTC, Travis McHenry
Details
updater to update the config file for new ordering (257 bytes, text/x-perl)
2009-04-06 04:47 UTC, Travis McHenry
Details
patch for konversation.upd (438 bytes, patch)
2009-04-06 04:50 UTC, Travis McHenry
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Frederik Schwarzer 2006-12-31 16:07:13 UTC
Version:           1.0.1 (using KDE Devel)
Installed from:    Compiled sources

1. Go to Settings->Configure Konversation...->Behavior->Auto Replace
2. create a new item
3. type "#([0-9]{5,6})" into the find field
4. type "http://bugs.kde.org/show_bug.cgi?id=%1" into the replace with field
5. press OK to apply changes

Issue 1: the line in konversationrc contains the comma from the regexp what breaks the readout

6. open the configuration dialog again

Issue 2: the entries in find and replace with fields are splitted at the wrong comma (actually same as Issue 1)

7. correct the wrongly splitted fields to the former desired values

Issue 3: action cannot be applied (Apply button is inactive)

8. check the RegEx checkbox to activate the Apply button
9. press Apply

Issue 4: the line in konversationrc still shows item as unchecked ("0") and from now on it toggles its status turned (checked==1;unchecked==0)
Comment 1 Travis McHenry 2009-04-05 05:48:40 UTC
Created attachment 32606 [details]
autoreplace patch for regexp commas

The config file uses commas to seperate the autoreplace information. (checked,input/output,regexp,url). A comma is valid syntax for regexp so this causes problems. The original code uses .section(',',2,2) to grab the regexp which in the above test case stops at 5. Then it uses .section(',',3) to grab everything after that 3rd comma adding part regexp to the beginning of the url.

The simplest solution I could see is putting the url before the regexp (checked,input/output,url,regexp) since a url will never have a comma (afaik). 

BUT: This causes current configurations to flip the regexp and url in the autoreplace configuration menu. After you edit the preferences to fix that however everything works just as it should including for the test case.

Perhaps there's some way to counteract this caveat?
Comment 2 Travis McHenry 2009-04-05 21:02:56 UTC
Created attachment 32637 [details]
allow commas in regexp

Oops, I forgot a change. This new patch also changes the order of the default configuration for autoreplace that's created in config/preferences.cpp
Comment 3 Travis McHenry 2009-04-06 04:47:32 UTC
Created attachment 32649 [details]
updater to update the config file for new ordering
Comment 4 Travis McHenry 2009-04-06 04:50:19 UTC
Created attachment 32650 [details]
patch for konversation.upd

Script and patch are to get konversation.upd to update the config file to be compat. with the new order of the autoreplace info.
Comment 5 Eike Hein 2009-04-17 22:38:15 UTC
Fixed in SVN revision 955466 using the newer patch from bug 153761.