mtext_pop_prop(3m17n)

πŸ“¦
version 1.8.4 Β· 2 versions
, in debian trixie, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

🌸 mtext_pop_prop β€” from the m17n Library, bestie πŸ’–

okay so we're diving into mtext_pop_prop(3m17n) and honestly? it's giving "quietly essential" and i'm obsessed. let's get into it πŸŽ€


✨ NAME ✨

mtext_pop_prop β€” the little function that yeets the topmost text property off your characters πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

int mtext_pop_prop (MText * mt, int from, int to, MSymbol key)

like look at that signature. clean. simple. iconic. no notes πŸ‘‘


πŸ’œ DESCRIPTION πŸ’œ

@brief Pop a text property.

so here's the tea β˜• β€” mtext_pop_prop() removes the topmost text property whose key is key from the characters between from (inclusive, bestie, we count it) and to (exclusive, we do NOT count it) inside mt.

and listen β€” if the characters in that region have no such text property? this function literally does nothing. no drama, no error, just vibes. πŸ™ˆ

with this function, this:

                    FROM                    TO
M-text: |<------------|-------- MT ---------|------------>|
PROP  :  <------------------ OLD_VAL -------------------->

becomes this:

                    FROM                    TO
M-text: |<------------|-------- MT ---------|------------>|
PROP  :  <--OLD_VAL-->|                     |<--OLD_VAL-->|

like?? the way it just scoops OLD_VAL right out of the middle and leaves it chillin' on both sides 🧚✨ the range in between? cleared. gone. unbothered. that's the whole point of a pop β€” topmost property only, no cap 🫢

πŸ’– Return value πŸ’–

if the operation was successful, mtext_pop_prop() returns 0 β€” slay, we love a zero πŸŽ‰

otherwise it returns -1 and assigns an error code to the external variable #merror_code β€” so always check that variable if you get a -1, fr fr 😭

πŸ“ Errors πŸ“

  • MERROR_RANGE
  • MERROR_SYMBOL

those are the two you might catch, so keep an eye out πŸ‘€

🌈 See Also 🌈

  • mtext_put_prop()
  • mtext_put_prop_values()
  • mtext_get_prop()
  • mtext_get_prop_values()
  • mtext_push_prop()
  • mtext_prop_range()

the whole text-property friend group, honestly πŸ’• go say hi to all of them.


Copyright (C) 2001 Information-technology Promotion Agency (IPA)

Copyright (C) 2001-2011 National Institute of Advanced Industrial Science and Technology (AIST)

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License <http://www.gnu.org/licenses/fdl.html>.


and that's the whole page, bestie πŸ’– this was Version 1.8.4, dated Mon Sep 25 2023 β€” m17n Library, mtext_pop_prop(3m17n), periodt. now go pop those props and stay hydrated πŸ«Άβœ¨πŸŽ€

πŸ“¦ where this page comes from