bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#39517: [PATCH] Add new option 'word-wrap-boundary'


From: Jaehwang Jerry Jung
Subject: bug#39517: [PATCH] Add new option 'word-wrap-boundary'
Date: Wed, 12 Feb 2020 00:43:06 +0900
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1



On 11/02/2020 01:10, Eli Zaretskii wrote:
From: Jaehwang Jerry Jung <address@hidden>
Cc: address@hidden
Date: Tue, 11 Feb 2020 00:36:01 +0900

I noticed that word wrapping looks a bit weird when the text contains
long URLs.  So I wanted to add non-word ASCII characters so that URLs
can be wrapped more naturally as in other editors, while not changing
the default behavior.
OK, but is that the only relevant use case?  Maybe we have others.  We
need to think in more general terms, in case the other use cases might
suggest different solutions.

Not that I know of.

-  ((it->what == IT_CHARACTER && (it->c == ' ' || it->c == '\t'))      \
+#define IT_DISPLAYING_WORD_WRAP_BOUNDARY(it)                           \
+  ((it->what == IT_CHARACTER                                                \
+    && strchr ((char *) SDATA (BVAR (current_buffer, word_wrap_boundary)), \
+               it->c))                                                      \

This cannot be right: characters are stored in Lisp strings in a
multibyte encoding that is superset of UTF-8, so the above will only
support pure-ASCII boundary characters, which is probably not what you
had in mind.

You're right. Actually I think it would be simpler to hard-code a better
list of boundary characters in that macro.
I don't think we can hardcode them, because the set of characters must
be buffer-local: we don't want to wrap on '/' in a general text-mode
buffer, let alone in a C-mode buffer, right?

It's not uncommon to wrap on '/'. For example,
* Vim: http://vimdoc.sourceforge.net/htmldoc/options.html#'breakat'
* Visual Studio Code: 
https://github.com/microsoft/vscode/blob/39370d9c988c584fa2e834728d8ffa56259ff1ad/src/vs/editor/common/config/editorOptions.ts#L279-L283

Anyway, I agree with configurability. Perhaps I'll need some more time
to implement it with multibyte characters in mind. Or we could use the
syntax table.

  Last, but not least, for a contribution this large, we will need you
to assign the copyright to the FSF.  If you agree, I will send you the
form to fill and the instructions to send it.

Yes, I agree.
Form sent off-list.

Thanks.

Thanks. I sent the request.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]