marick
I’d like to be able to attach attributes to ranges within a string. Since I’m writing prototypes/spikes in Elixir for an eventual MacOS app, it’d be nice if the capabilities were similar to NSAttributedString - even better, a process that makes a mutable version of that (equivalent to NSMutableAttributedString). However, anything that saves me the trouble of dealing with all the fiddly cases around maintaining attributes as the underlying string changes is more than fine.
Trending in Questions
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
Hello,
I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New
Other Trending Topics
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Hi everyone!
The first release candidate for the Expert language server project is now available!
We’ve published a press release detai...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #hex
- #security










Showing Posts 1 to 4- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
benwilson512
In one sense I’m not sure how to answer this question. The entire framing is that you want a thing that doesn’t look anything like an Elixir string in that it has attributes, and those attributes are mutable. Can you expand on the larger problem you are trying to solve, and elaborate on how this specific data structure helps accomplish a solution to that problem?
outlog
I’m not quite sure I understand the exact problem you are seeking to solve - but have a look at liveview native GitHub - liveview-native/live_view_native: A framework for building native applications with Phoenix LiveView · GitHub - they are doing a bunch of stuff/abstractions around Swift (ui) code/modifiers etc. - so you might find inspiration there..
marick
Consider a text editor, which manages a mutable string. Ranges of characters can be assigned particular attributes. Conceptually, every character in the string comes with a key/value map named “attributes”. Some keys are predefined, but apps can define their own custom attributes.
You can ask questions like:
:italicattribute set for character 34?:italicattribute set?I’m writing an app to explore coding in a style inspired by ecological and embodied cognition. Mainly for fun and to keep me off the streets.
marick
In particular: the editing app is conceptualized as (for example) watching a paragraph the way a cat watches a mousehole. More specifically, there’ll be a process focused on a paragraph. I’m imagining implementing that as the text in the paragraph having a
:watcherattribute whose value is a process. The stockNSMutableAttributedStringcode will handle things like adding and deleting characters while keeping the attributes correctly attached. Code wrapped around that will send achangedmessage to the watcher process (sort of likeObserver), which is watching for certain sorts of changes.For example, if I split a paragraph in two with two blank lines between the chunks, that’s a signal that I’m revising a paragraph. That’s one of the ways I customarily start revisions, and I want the app to asynchronously do certain things to help me out.
So the “paragraph-observer” process will be replaced by a different, “paragraph-editing-observer” process that is alert for different, editing-specific affordances. In particular, it will act to tag internal sentence fragments that will cause the editor display (in the MacOS version) to sweep them off to the side of main editor window. Because I think actions like that will save me hours of frustration at the cost of mere months of coding.
I cover this app in more detail in the last of five Oddly Influenced podcast episodes on ecological and embodied cognition. (Transcript available.)