Support for live unicode character replacement
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Gwibber |
Triaged
|
Wishlist
|
Unassigned |
Bug Description
As requested here (https:/
Specifically, "..." and "--" can be simplified to "…" and "—".
I hacked together a patch for this, but I admit it is not pretty. It does work for me, but the console doesn't love it, as I get:
found ... trying to replace
/usr/bin/
You must use marks, character numbers, or line numbers to preserve a position across buffer modifications.
You can apply tags and insert marks without invalidating your iterators,
but any mutation that affects 'indexable' buffer contents (contents that can be referred to by character offset)
will invalidate all outstanding iterators
gtk.main()
/usr/bin/
gtk.main()
/usr/bin/
gtk.main()
** (gwibber:11855): CRITICAL **: enchant_dict_check: assertion `len' failed
/usr/bin/
gtk.main()
I can't seem to find a good example of searching for a string in a textbuf, and replacing it in place whenever found. I did it without using marks or iters, which is why the warnings get thrown. I'm attaching this patch as a starting point, with the hope that someone who understands textbufs better than I do will clean it up a bit so it is no longer such a warning generator.
Changed in gwibber: | |
importance: | Undecided → Wishlist |
This patch works with the text added event rather than the changed event so it should fire closer to when the event occurs. It uses iterator methods so that we don't get the warnings listed in the last comment. It handles both adding characters one at a time and pasting a string with multiple instances of the replacement charaxters in it.