Summary: GUI buttons shouldn't insert closing wiki tags after trailing spaces of selected text
Created: 2005-09-12 02:56
Status: Closed - fixed for 2.0.6
Description: When editing a wiki page, single words can usually be selected by double-clicking. In most browsers, this will also select the subsequent whitepsace after the word that has been double-clicked. Now hitting a GUI button to format the selected text will insert the closing wiki tag at the end of the selection (which is after the trailing space), instead of just encapsulating the selected word. This seems a bit unusual, it's more difficult to read the wiki page source, and the resulting XHTML also seems a bit "untidy" (at least HTML Tidy would correct this...).
Example from PmWiki when formatting a double-clicked word using the GUI buttons:
Update: in the first example, it's also difficult to select the next word (has) by double-clicking, as this will also select the leading
Another Update: the GUI buttons of DokuWiki (http://wiki.splitbrain.org/) work as expected.
What browser are you using for this? My browser (Firefox 1.0.6) works as expected... i.e., white spaces following the selected text are not included in the styling of the word.
There's those weak moments when I'm using Internet Explorer, still... (if only Firefox would start up as fast as IE). I'm sorry I didn't notice the behaviour in Firefox is different. On Windows however, it's usual that trailing spaces are also selected when double-clicking words, so I thought it would make sense to consider this for the GUI buttons.
while (p1 > p0 && tarea.value.substring(p1-1, p1) == ' ') p1--;
so I'm left to conclude that the substring function isn't working here, or else there's something else bizarre taking place.
What version of IE are you using?
I'm using IE 6 on XP Sp2, with regular Windows Update. Possibly a substring() bug!?
I've now been able to review the guiedit.js code and it should be fixed for IE now. You can test it on pmwiki.org, and it'll be available in the 2.0.6 release. Thanks!