Commit Graph

47 Commits (c8b6e331de95419de72546964f6b255dccddcd93)

Author SHA1 Message Date
June McEnroe c8b6e331de Assert return values in edit tests 2022-02-20 16:05:24 -05:00
June McEnroe e39bba1a8a Move mbs out of struct Edit, use a global buffer
This saves 4K in the edit buffers, not to mention all the heap
allocations for the separate mbs buffers!

There might be a way to be more clever about capacities, but I don't
think it's worth it.
2022-02-20 15:42:24 -05:00
June McEnroe 8065fcabc3 Make sure new cap is actually larger than new length 2022-02-20 12:24:54 -05:00
June McEnroe 157be8a8d7 Remove unused mbs.len field from struct Edit 2022-02-20 11:54:06 -05:00
June McEnroe a2a118c857 Fix edit.[ch] license notice additional permissions 2022-02-19 14:51:26 -05:00
June McEnroe 1a2477ef7a Implement new line editing "library"
Losing tab complete and text macros, for now.

This new implementation works on an instance of a struct and does
not interact with the rest of catgirl, making it possible to copy
into another project. Unlike existing line editing libraries, this
one is entirely abstract and can be rendered externally.

My goal with this library is to be able to implement vi mode. Since
it operates on struct instances rather than globals, it might also
be possible to give catgirl separate line editing buffers for each
window, which would be a nice UX improvement.
2022-02-18 23:47:11 -05:00
June McEnroe 0036e6e9f0 Fix M-f ordering 2022-02-18 22:40:16 -05:00
June McEnroe 9c384de6db Treat any amount of space and punctuation as word boundaries
This matches behaviour of, e.g. zsh -o emacs.
2022-02-09 17:55:33 -05:00
C. McEnroe 9c1b241c17 Cycle between adding colon suffix and not in tab complete
Allows completing a nick at the beginning of a message without a
colon by continuing to press tab, as well as after another nick
already followed by a colon without turning it into a comma-separated
list of nicks all followed by a colon. For example, tab can be used
to cycle between the following pairs:

    nick1: |
	nick1 |

	nick1, nick2: |
	nick1: nick2 |
2021-11-19 14:44:16 -05:00
C. McEnroe 56139227a4 Use (bright) red for \com text macro 2021-07-26 18:25:05 -04:00
C. McEnroe 60ff44cf4e Stop at previous \ when expanding macros
There was no reason to ever require whitespace before the macro
name.
2021-06-24 14:10:49 -04:00
C. McEnroe e18c585701 Add \com text macro 2021-06-14 14:29:16 -04:00
C. McEnroe 3b9e778dac Don't insert wchar_t if it can't be converted to mbs
Otherwise it could hit the assertion in editBuffer while converting
to mbs for consumption by the rest of the program.

It's possibly to trigger this with LC_ALL=C and typing C-z C-v M-a,
for example.
2021-02-15 19:15:38 -05:00
C. McEnroe a92f1260ea Don't expand macro if it can't be converted to mbs
Otherwise expanding a macro could hit the assertion in editBuffer
while converting to mbs for consumption by the rest of the program.
2021-02-15 18:41:46 -05:00
C. McEnroe a1dece3df9 Use wmemcpy/wmemmove 2020-11-08 16:21:34 -05:00
C. McEnroe 1891c77535 Preserve colon from previous tab-complete
This fixes the case when pinging multiple nicks and one of them needs to
be cycled through.
2020-08-18 10:09:54 -04:00
C. McEnroe 814c36223a Say "OpenSSL" in additional permission notices
LibreSSL is "a modified version of that library".
2020-08-04 12:19:14 -04:00
C. McEnroe 9bd10d768d Add \banhammer macro
From the Textual extras command /banhammer.
2020-08-02 18:08:08 -04:00
C. McEnroe 3e03b7502b Add current topic to tab-complete so it can edited 2020-07-13 10:22:33 -04:00
C. McEnroe 721c3a9ee6 Add additional permission for linking with LibreSSL
https://www.gnu.org/licenses/gpl-faq.en.html#GPLIncompatibleLibs
2020-06-08 17:48:07 -04:00
C. McEnroe e3f7362241 Add M-q to collapse whitespace 2020-04-07 10:48:44 -04:00
C. McEnroe 8495d12216 Fix multi-mention tab completion condition
I don't know why I ever programmed it this way. It was really annoying
when trying to write "some phrase, nick".
2020-04-01 14:42:07 -04:00
C. McEnroe 77a7c02435 Pass correct length to mbstowcs
Too used to sizeof being the right thing for regular strings.
2020-04-01 12:15:44 -04:00
C. McEnroe 84f661ab05 Add \blush 2020-03-31 20:12:04 -04:00
C. McEnroe 13ae7cec59 Add \bear, \cool, \hug, \unflip, \wave 2020-03-31 10:50:42 -04:00
C. McEnroe a0dde10cb6 Add text macros 2020-03-30 14:56:26 -04:00
C. McEnroe 407eaf9dbf Tab complete from last iswspace 2020-03-30 13:27:35 -04:00
C. McEnroe 7ea1a416a1 Bump edit buffer cap to 1024
With message splitting it's reasonable to allow this to be larger.
2020-03-23 13:45:28 -04:00
C. McEnroe 700b5d5870 Replace small integers in size_t with uint 2020-02-15 22:19:55 -05:00
C. McEnroe eb3a92c99e Don't copy into cut buffer during tab complete 2020-02-14 04:04:07 -05:00
C. McEnroe 456713e561 Simplify transpose swap 2020-02-12 01:19:07 -05:00
C. McEnroe 14ae13f781 Add C-t transpose
Also in emacs, weechat.
2020-02-12 01:16:40 -05:00
C. McEnroe 0dd8ac36f4 Avoid VLAs in tab complete 2020-02-09 14:17:04 -05:00
C. McEnroe 02ca8e972b Use iswspace for word movement 2020-02-09 07:32:35 -05:00
C. McEnroe 2aa2005339 Add C-y
This is weechat's binding for it.
2020-02-09 07:09:56 -05:00
C. McEnroe 5e637324c9 Add C-w and M-d 2020-02-09 04:32:32 -05:00
C. McEnroe 3cd830681e Rename kill ops 2020-02-09 04:22:41 -05:00
C. McEnroe b08c2d03ef Add M-b and M-f 2020-02-09 04:20:07 -05:00
C. McEnroe d7c96fc81b Add C-k
Also rename all the edit ops to something consistent.
2020-02-09 03:58:13 -05:00
C. McEnroe 282de9af30 Add C-d 2020-02-09 03:45:44 -05:00
C. McEnroe 40e362f505 Hook up tab-complete 2020-02-09 02:33:53 -05:00
C. McEnroe 2d62ea9e30 Simplify edit buffer conversion and input rendering 2020-02-09 01:28:24 -05:00
C. McEnroe fe5fd89705 Populate completion with commands 2020-02-07 21:39:56 -05:00
C. McEnroe af244ad3cd Add some real line editing operations 2020-02-07 01:56:23 -05:00
C. McEnroe 4cce893eab Add extremely basic editing and message sending 2020-02-05 00:20:39 -05:00
C. McEnroe 0df8bd51aa Convert editHead and editTail from wchar_t 2020-02-04 21:27:52 -05:00
C. McEnroe 9944dc484b Split showing style codes and word wrapping 2020-02-04 20:23:55 -05:00