New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IDLE: Improve Mock_Text #62704
Comments
Following the Idle: mock Text class and test thereof created bpo-18365 For this I am trying to write regular expressions to extract the parts of index. I have attached a checklist of several indexes. So you can easily run them and get an understanding of my approach. |
Further changes should be aimed at actual idlelib uses. Wordstart and wordend are used once each in AutoExpand.py (and wordstart a couple of times for tag.start positions). So forget them. Does idlelib really have indexes like "2.3 + 1c" ('2.4'), "2.3-1c" ('2.2'), and "22.33-1chars" ('22.32')? The grammar we need to parse is something like Rather than parse an entire index at once, parse, interpret as position, and remove base from input. While remainder, parse, apply to position, and remove from remainder. Whether the parsing is done with base and modifier REs with groups or code or some mixture does not much matter. |
Yes,correcting myself. I should aim indexes which actual idlelib uses. Thank you Terry for the grammar. Fighting with the index parsing last week, and finally came up with a level to break the index into base and modifier and decode it along with using regular expressions. The problem now I am dealing with is, there are four exceeding conditions I have to handle which make errors. For example, in parsing base the return line may exceed last line but the modifier will say '-2lines' doing that, now the return line is not exceeding last line. |
This patch tries to enable mock_Tk.Text._decode to handle the following patterns These additions are required for testing AutoExpand and are written keeping the same in mind. Also, adds respective tests for test_decode in test_text.py. I would like to know if my approach is acceptable or whether it needs changes. bpo-18292 is about adding unittests for AutoExpand. (A 2.7 patch will be submitted once the above changes become acceptable) |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: