mtext_replace(3m17n)

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

✨ NAME ✨

mtext_replace β€” bestie, this is the one that swaps out a chunk of one M-text for a chunk of another πŸ’– (ngl the original manpage left this part blank, so we're all just vibing off the title)


🌸 SYNOPSIS 🌸

int mtext_replace (MText * mt1, int from1, int to1, MText * mt2, int
from2, int to2)

That's the whole function signature, character for character, no notes πŸ‘‘


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so picture this: you've got two M-texts and you want to do a little surgical swap. That's literally it.

The mtext_replace() function replaces sub-text of M-text mt1 between from1 (inclusive) and to1 (exclusive) with the sub-text of M-text mt2 between from2 (inclusive) and to2 (exclusive).

and the cutest part?? the new sub-text inherits text properties of the old sub-text. it's giving glow-up-by-association πŸ’…βœ¨

lowkey important: from is in, to is out. half-open ranges, bestie, we love a consistent boundary 🫢

πŸ’œ RETURN VALUE πŸ’œ

  • If the operation was successful, mtext_replace() returns 0. πŸŽ‰ slay.
  • Otherwise, it returns -1 and assigns an error code to the external variable merror_code. 😭 not the vibe, check the variable.

πŸŽ€ ERRORS πŸŽ€

  • MERROR_MTEXT
  • MERROR_RANGE

yep, those are the two. if you see either of these in merror_code, that's your culprit πŸ•΅οΈβ€β™€οΈ


🌈 SEE ALSO 🌈

  • mtext_insert()

go read that one too, they're besties fr fr πŸ’–


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 of the m17n Library docs, dated Mon Sep 25 2023, and yeah, it's mtext_replace(3m17n) through and through. go forth and replace some sub-text πŸ’–βœ¨

πŸ“¦ where this page comes from