Consider the following selections in a text editor:

enter image description here

At the end of the second line, there is an non-bold space.

For each example, when you click the Bold button, should it bold or unbold the selection?

  • 1
    Have you looked at any existing implementations (e.g. Microsoft Word, Gmail, whatever Apple's word processor is)? From what I remember, they tend to bold the whole line if the selection contains any non-bold characters, and unbold if the entire selection is bold. Seeing as it's perfectly ambiguous which way it would format it first (bold or unbold), I think it's probably most helpful to be consistent with existing patterns, if there are any. – maxathousand Mar 24 at 17:51
  • Yes of course, I was just wondering if it was really the best option. Sometime this software inherits from old behaviors. – Fifi Mar 24 at 19:04

I agree with @maxathousand, most text editors will complete the action of "bolding" the selection before being able to toggle it back to normal. Even sites like Medium use that common behavior so I'd aslo suggest not reinventing the wheel here.

|improve this answer|||||
  • On the example 1, the first click will unbold the text ... – Fifi Mar 26 at 9:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.