alexherbo2 / auto-pairs.kak

Auto-pairing of characters for Kakoune
https://kakoune.org
77 stars 18 forks source link

Using ksh, auto-pairs acts very wonky #35

Closed somasis closed 4 years ago

somasis commented 4 years ago

When using oksh as /bin/sh (which is just a portable version of OpenBSD's ksh- in fact, this happens with loksh, another port, and mksh, so it's affecting all ksh derivatives), auto-pairs.kak acts very strangely.

When hitting enter to create a new line, it will create a new line, then indent it, create a new line after the indented line, and then leave your cursor at the indentation point. It also seems to be duplicating spaces once you have leading spaces and hit space multiple times.

Here's a recording demonstrating the problem:

asciicast

I have a hunch it's the printf statements printing spaces somewhere in there, resulting in auto-pairs thinking that it needs to "complete" a bracket represented by a `. Looking it though, I'm not quite sure what exactly the problem would be. It could also be related to bash'sprintfbuilt-in not being used (andkshand friends having noprintfbuilt-in), but I've tested this possibility by replacingprintfusage with/bin/printfwithout any differences from this cropping up. I also thought it *could* be related to busybox'sprintfimplementation (which is being used, as the system I'm runningkakunder uses busybox for coreutils, includingprintf), but again, changing outprintfto explicitly usebusybox printfchanged nothing, and it worked fine underbash`.

With all plugins except auto-pairs.kak disabled, this still occurs, so I feel pretty confident the problems lies here.

somasis commented 4 years ago

I found a similar issue caused by using ksh for the plug.kak, it might be relevant to mention here. https://gitlab.com/andreyorst/plug.kak/-/issues/75

somasis commented 4 years ago

Aaaand unfortunately this is just me missing the OpenBSD-related fix in the README. https://github.com/mawww/kakoune#22-installing just says to use dash for a shell so that plugins work, so this probably isn't really relevant to this repo in particular. Oh well