简体   繁体   中英

NSTextView with custom space width

I need to implement custom space separator with custom width between two part of paragraph in text view:

AAAA AA A -------- BBB BBBBB B

This is separator must be included as non-editable character. So user can't delete it or modify. I understand, that i must overload standard behavior of textview in some points (for example, when user press "delete" right after separator nothing will be deleted)

I have several ideas how accomplish this task:

  1. Use elastic glyph attribute (there are mentions in documentation about it). But I can't find any documentation about how to use it.

  2. Use tab symbol and NSTextTab for each paragraph, and in any modification to the paragraph recalculate position of tab.

I will be very grateful for any right direction.

I had a similar problem and wound up inserting blank images of the desired width into the textview. The code for implementing this is here: Changing the width of the space character in NSTextView

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM