Get the latest tech news

Implementing attributes for plain text using subranges like Emacs


- Inserting/deleting text before a range moves it. - Inserting/deleting text after a range leaves it unchanged.

Emacs-style ranges on a text buffer that I can now hang attributes like color, decorations and click handlers on to. This quickly blew up the implementation to 500 lines, and I was juggling 27 manual tests of which half were failing. But I blindly assumed a fully normalized design with a first-class notion of a pivot must be a good idea.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of plain text

plain text

Photo of emacs

emacs

Photo of attributes

attributes

Related news:

News photo

Lessons from Plain Text

News photo

Meta Fined $102 Million For Storing 600 Million Passwords In Plain Text

News photo

Meta has been fined €91M ($101M) after it was discovered that to 600 million Facebook and Instagram passwords had been stored in plain text.