1 Aug 2012 19:47
[ jedit-Patches-3543916 ] Fixed Issue replacing start of line match with empty string
<SourceForge.net>
2012-08-01 17:47:50 GMT
2012-08-01 17:47:50 GMT
Patches item #3543916, was opened at 2012-07-13 23:48 Message generated for change (Comment added) made by jarekczek You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=300588&aid=3543916&group_id=588 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: texteditor Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Swetha (swetha1910) >Assigned to: Jarek Czekalski (jarekczek) Summary: Fixed Issue replacing start of line match with empty string Initial Comment: Problem: With regular expressions enabled, and if the search pattern having '^' then the 'replace all' option performs repeated replacing for every character in the line and not 'start of the line' matches. Details: Example I: Input: Twinkle Twinkle Little Star How I wonder what you are Search for: ^. meaning I want a search for the first character of every line Replace with: replace every matched character with nothing (literally deleting the first character from every line) Expected Output when I click REPLACE ALL: winkle Twinkle ittle Star ow I wonder what you re What actually happens here is that the buffer is emptied because every character is replaced with an empty string. Output when I click REPLACE: winkle Twinkle Little Star How I wonder what you are Output when I click REPLACE AND FIND: winkle Twinkle Little Star How I wonder what you are NOTE: In the last case, the find function will now match 'w' in the second line input text. Example II: Input: Twinkle Twinkle Little Star How I wonder what you are Search for: ^. meaning I want a search for the first character of every line Replace with: p replace every matched character with the letter 'p' Expected Output when I click REPLACE ALL: pwinkle Twinkle pittle Star pow I wonder what you pre Output when I click REPLACE: pwinkle Twinkle Little Star How I wonder what you are Output when I click REPLACE AND FIND: pinkle Twinkle Little Star How I wonder what you are NOTE: In the last case, the find function will now match 'L' in the input text because in regular expressions '^' symbol should check only for the beginning of the line. But the result in the current version empties the buffer whenever replace all is given for Example 1 which is wrong. It violates the meaning of the regular expression '^' itself. Example III: Input text: AABBBA Search: ^A Expected Output: ABBBA But Actual Result of the current version: BBBA How the bug was fixed: 1. Check if the regex option is selected 2. If yes, then check if the search pattern has '^' 3. If yes, then set the offset value accordingly. Patch Details: Version of jEdit : 4.5.2 Platform: Windows Edited file: SearchAndReplace.java Package: org/gjt/sp/jedit/Search ---------------------------------------------------------------------- >Comment By: Jarek Czekalski (jarekczek) Date: 2012-08-01 10:47 Message: 1. It's not the output of svn diff 2. Still can't compile "string" ---------------------------------------------------------------------- Comment By: Swetha (swetha1910) Date: 2012-07-31 00:08 Message: It's fine with me. Leave it in original state. ---------------------------------------------------------------------- Comment By: Jarek Czekalski (jarekczek) Date: 2012-07-30 13:01 Message: For you the condition is more logical. For the original author it was more logical to make infinite loop. If it is not necessary to change this line, I suggest to leave it in the original state. Would you agree? ---------------------------------------------------------------------- Comment By: Swetha (swetha1910) Date: 2012-07-30 11:09 Message: There is no particular meaning for an infinite loop in the _replace function (SearchAndReplace.java file). The replace should not take place beyond the end value and so is more logical when the condition "offset < end" is added. ---------------------------------------------------------------------- Comment By: Jarek Czekalski (jarekczek) Date: 2012-07-27 10:49 Message: This patch does not compile, because of this line: string current_line = buffer.getLineOfOffset(offset); Cannot find symbol string. If you resubmit the patch please pay attention to following: 1. prepare it using "svn diff" command run from the root directory (directory containing org directory), preferrably having checked out the most recent version (from trunk) 2. check type of whitespace you insert (match the ones used in the file) 3. explain, to help me understand the patch: why is the condition "offset < end" in "for" loop needed now, while previously it wasn't there ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=300588&aid=3543916&group_id=588 ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ -- -- ----------------------------------------------- jEdit Developers' List jEdit-devel <at> lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jedit-devel
RSS Feed