Commit Graph

9790 Commits

Author SHA1 Message Date
Maxime Coste
72e181e099 Merge remote-tracking branch 'AnthonyYoManz/3743-support-focus-in-sway' 2022-06-03 15:57:33 +10:00
Maxime Coste
503e5bc507 Only set fd to non-block if there is an EventManager
Fixes #4630
2022-06-03 15:57:25 +10:00
DixiE
0048e9f488 Support focus Within Sway WM
While Wayland offers nothing general to help us support `focus` on all
window managers, WM-specific implementations are generally possible.
Sway is a tiling window manager that mimics i3, and has a reasonably
powerful CLI that can help us achieve this.

In addition to supporting `focus` for Sway, this change paves the way
for additional WM-specific Wayland functionality by adding a detection
step to wayland.kak, in a similar fashion to detection.kak.
2022-06-02 10:57:28 +01:00
Masanori Ogino
1d439f0ab8 Add a workflow to upload Linux build on releases
Building static binaries with Alpine Linux's musl libc-based toolchain
should make them work on any distros with Linux kernel 2.6.39 and newer.

Fixes https://github.com/mawww/kakoune/issues/4555

References:

- https://wiki.musl-libc.org/supported-platforms.html

Signed-off-by: Masanori Ogino <masanori.ogino@gmail.com>
2022-05-31 17:13:11 +09:00
Maxime Coste
ac6f928ad4 Fix switch completion 2022-05-30 19:27:18 +10:00
Johannes Altmanninger
66078243ec Run InsertCompletionHide hook before insertions that close completion menu
Insert mode completions are accepted by typing any key.  For example,
if there is a completion "somefunction()", then typing

	some<c-n>;

will insert

	somefunction();

and then the InsertCompletionHide hook will fire.  The hook parameter
is a range that contains the entire thing: the actual completion plus
the trailing semicolon that closed the completion menu.

The [original motivation] for the hook parameter was to support
removing text inserted by completion, so we can apply text edits
or expand snippets instead. One problem is that we don't want to
remove the semicolon. Another problem came up in a discussion
about [snippets]: let's say we have a snippet "add" that expands to

	add(?, ?)

where ? are placeholders. After snippet expansion the cursor replaces
the first placeholder. If I type "ad<c-n>1" I expect to get "add(1, ?)".
If the InsertCompletionHide hook only runs after processing the "1"
keystroke, this is not possible without evil hacks.

Fix these problems by running InsertCompletionHide when a completion is
accepted _before_ inserting anything else into the buffer.  This should
make it much easier to fully implement [LSP text edits]. I doubt
that anyone besides kak-lsp is using the hook parameter today so this
should be a low-risk fix.

[original motivation]: https://github.com/mawww/kakoune/issues/2898
[snippets]: https://github.com/kak-lsp/kak-lsp/pull/616#discussion_r883208858
[LSP text edits]: https://github.com/kak-lsp/kak-lsp/issues/40
2022-05-29 15:24:38 +02:00
Johannes Altmanninger
6595aae23e make clean: also clean up generated version files
We also discussed using "git clean -dXf" but that could remove files
that were not generated by make.

Closes #4619
2022-05-29 10:31:59 +02:00
Johannes Altmanninger
6f28178b91 rc filetype: add trim-indent hooks to all languages that have indent hooks
An indent hook automatically adds whitespace, so it seems prudent to
add the hook to remove unwanted whitespace again. This is what we do
in most languages already.
2022-05-29 08:23:33 +02:00
Johannes Altmanninger
19806a4b4c rc coq: remove unconventional indentation
The next commit will touch this file.
2022-05-29 08:23:33 +02:00
Johannes Altmanninger
fea851b78b rc filetype: add some missing ModeChange hooks for trim-indent
Some languages have a trim-indent command but don't use it (for no
apparent reason). Make them trim trailing spaces when exiting insert
mode, like most other languages support scripts do.
2022-05-29 08:23:33 +02:00
DixiE
e1fd534637 AnthonyYoManz Copyright Waiver
I dedicate any and all copyright interest in this software to the
  public domain.  I make this dedication for the benefit of the public at
  large and to the detriment of my heirs and successors.  I intend this
  dedication to be an overt act of relinquishment in perpetuity of all
  present and future rights to this software under copyright law.
2022-05-27 09:02:41 +01:00
Johannes Altmanninger
b929748f8e rc filetype: fix double space in trim-indent hooks 2022-05-26 17:08:15 +02:00
Johannes Altmanninger
4c7207991a rc crystal: stop using ruby-trim-indent 2022-05-26 17:08:15 +02:00
Maxime Coste
d9ea62666b Filter out switches when completing commands
Fixes #4625
Fixes #4209
Fixes #4040
2022-05-26 19:54:09 +10:00
Maxime Coste
a63465aba8 Fix indent commands not being committed as an undo group
2edabde919 removed the
ScopedEdition that took care of committing the undo
group after indenting operations.
2022-05-26 19:54:09 +10:00
Sidharth Kshatriya
5a5fc50c12 highlighter doc: some clarificatory edits 2022-05-23 16:52:30 +05:30
Johannes Altmanninger
1529cfb2c2 Stop using deprecated std::iterator
As reported in #4615 and others, GCC 12.1 emits deprecation warnings
because we use std::iterator. Replace it with the modern equivalent.

Closes #4615
2022-05-21 15:10:03 +02:00
Maxime Coste
4c7c4a1454 Simplify Buffer::do_insert and Buffer::do_erase 2022-05-20 08:30:43 +10:00
Pound_Hash
3a661bd27c Amended grammar, punctuation, and word choice. 2022-05-17 10:39:06 -07:00
Maxime Coste
a8f289000c Merge branch 'readme' of http://github.com/Pound-Hash/kakoune 2022-05-16 19:49:22 +10:00
Maxime Coste
e570dc0a61 Merge remote-tracking branch 'sidkshatriya/ocaml-comment-convenience' 2022-05-16 19:48:02 +10:00
Maxime Coste
860be32ddd Merge branch 'command_parsing' of http://github.com/Pound-Hash/kakoune 2022-05-16 19:46:58 +10:00
Sidharth Kshatriya
70f9d8fbef OCaml: Recognize '\"' as a char literal and not the start of a string literal 2022-05-15 11:23:06 +05:30
Sidharth Kshatriya
8cfe59fcb0 OCaml: Automatically insert closing comment when user starts a comment
An OCaml comment is `(* Some comment *)`. Like the C-family this can be
a multiline comment.

Recognize when the user is trying to commence a comment when they type `(*` and
then automatically insert `*)` on behalf of the user. A small convenience.

Co-authored-by: Maxime Coste <mawww@kakoune.org>
2022-05-13 12:58:30 +05:30
Pound_Hash
a3c0665acc 1) Modified some wording to be more precise
2) Reformatted paragraphs to wrap at column 80
3) Added periods are the end of several lines for overall consistency
2022-05-10 09:53:03 -07:00
Maxime Coste
459c6f589f Merge branch 'cjs' of http://github.com/clarfonthey/kakoune 2022-05-10 22:37:43 +10:00
Maxime Coste
a28dd16b2e Merge remote-tracking branch 'adamchristiansen/gitignore-highlighting' 2022-05-10 22:36:44 +10:00
Maxime Coste
ae001a1f91 Run EventManager whenever writing to a file descriptor would block
This approach is not very elegant as it hooks into the event manager
deep inside the call graph, but solves the exiting issue and is an
okay stop gap solution until a better design comes up.

Fixes #4605
2022-05-10 22:36:13 +10:00
ltdk
fadbad51ca Mark .cjs as javascript 2022-05-09 13:20:27 -04:00
Adam Christiansen
1735aae85f Fixed extra + sign leftover from patch
An extra + sign was removed that was a remnant of a suggested
patch/diff.
2022-05-09 09:30:39 -06:00
Adam Christiansen
70013f5174 Fix gitignore highlighter glob handling
Fixes the handling of multiple backslashes before gitignore * and ?
glob patterns. Adds character classes to gitignore highlighting.

Co-authored-by: Johannes Altmanninger <aclopte@gmail.com>
2022-05-09 09:30:33 -06:00
Maxime Coste
3882b0e21b Merge branch 'gitmodules' of http://github.com/clarfonthey/kakoune 2022-05-09 20:07:47 +10:00
Maxime Coste
7f245e92fb Merge branch 'doc_doc' of http://github.com/Pound-Hash/kakoune 2022-05-09 20:04:53 +10:00
Maxime Coste
e036c4556a Merge remote-tracking branch 'c7skasku/highlight-0X' 2022-05-09 20:03:37 +10:00
Maxime Coste
34e4c53c50 Merge remote-tracking branch 'in0ni/master' 2022-05-09 20:03:02 +10:00
Johannes Altmanninger
987e367955 Work around incomplete std::to_chars() support in libstdc++ 10
Ubuntu 20.04 ships GCC's libstdc++ 10 from 2020 which implements
std::to_chars() for integers but not for floats. Use the float overload
only if the library advertises support via the feature testing macro.

This can be removed once we require GCC 11 (see
https://www.gnu.org/software/gcc/gcc-11/changes.html).

Closes #4607
2022-05-08 14:00:27 +02:00
Adam Christiansen
ed99e056b6 Add gitignore highlighting 2022-05-07 20:14:29 -06:00
Adam Christiansen
fc0a9cbab0 Adam Christiansen Copyright Waiver
I dedicate any and all copyright interest in this software to the
public domain.  I make this dedication for the benefit of the public at
large and to the detriment of my heirs and successors.  I intend this
dedication to be an overt act of relinquishment in perpetuity of all
present and future rights to this software under copyright law.
2022-05-07 20:07:06 -06:00
Pound_Hash
ac5ebe70ae Wrapped the lines at the 80th column 2022-05-06 10:33:12 -07:00
Cormac Stephenson
6a630ae3e6 c-family: highlight 0X style int literals 2022-05-05 13:41:35 +01:00
Maxime Coste
56c3ab4ff8 Fix parsing of INT_MIN %arg
Fixes #4601
2022-05-05 20:05:24 +10:00
Maxime Coste
d2f9bc8d80 Use std::to_chars to int to str conversion 2022-05-05 08:42:04 +10:00
in0ni
0cf5105df1
Merge branch 'mawww:master' into master 2022-05-03 22:15:42 -04:00
Andrés González
9b49c5db0d fix single line comment behavior on insert, remove unnecessary commented blocks 2022-05-03 22:11:28 -04:00
ltdk
e809b9bfcc Mark gitmodules as ini 2022-05-03 17:49:10 -04:00
Maxime Coste
5c6238ef11 Remove invalid assert in ScopedForceNormal destructor
commit 90db664635 introduced logic
to handle the case where the mode had been removed, but did not
get rid of the assert.
2022-05-01 20:59:29 +10:00
Maxime Coste
a1940a3745 Merge branch 'patch-5' of http://github.com/throwawayaccount12345-1/kakoune 2022-05-01 20:54:43 +10:00
Maxime Coste
3e83c17ec8 Merge remote-tracking branch 'krobelus/fix-autorestore-regression' 2022-05-01 20:53:54 +10:00
Johannes Altmanninger
8a7109f9c5 Fix compilation due to failing template deduction for aggregates
gcc 11.2.0 compiles us just fine but clang 13.0.1 fails with this error

	clang++ -DKAK_DEBUG -O0 -pedantic -std=c++2a -g -Wall -Wextra -Wno-unused-parameter -Wno-sign-compare -Wno-address -frelaxed-template-template-args -Wno-ambiguous-reversed-operator -MD -MP -MF .ranges.debug.d -c -o .ranges.debug.o ranges.cc
	ranges.cc:30:17: error: no viable constructor or deduction guide for deduction of template arguments of 'Array'
	    check_equal(Array{{""_sv, "abc"_sv, ""_sv, "def"_sv, ""_sv}} | flatten(), "abcdef"_sv);
	                ^
	./constexpr_utils.hh:14:8: note: candidate template ignored: couldn't infer template argument 'T'
	struct Array
	       ^
	./constexpr_utils.hh:14:8: note: candidate function template not viable: requires 0 arguments, but 1 was provided
	1 error generated.

The same error can be reproduced with this C++ input

	template<typename T, int N>
	struct Array
	{
	    T m_data[N];
	};
	void test() {
	    (void)Array{{1, 2}};
	}

Since "Array" has no constructor, the compiler uses aggregate
initialization. Only recent g++ seems to be smart enough to deduce
template arguments in this case. Help other compilers by adding a
deduction guide. The deduction guide needs to count the array elements
to infer the array size, hence we need to remove braces. Happily,
this is allowed and it's also what std::array does.

Closes #4597
2022-04-28 19:34:36 +02:00
Johannes Altmanninger
52a7c58670 rc autorestore: fix regression due to ! breaking change
Commit 85b78dda (src: Select the data inserted by `!` and `<a-!>`,
merged on 2021-03-06) broke autorestore by making it delete the
restored content.  I've been using it for 6 months but never noticed
since I didn't use autorestore

Reproducer:

	HOME=$PWD kak -s foo README.asciidoc -e 'exec iUNSAVED-CONTENT'
	# In another terminal:
	ps aux | awk '/kak -s foo/ {print $2; exit}' | xargs kill -HUP
	HOME=$PWD kak -s foo README.asciidoc

Delete the trailing newline instead of the restored content.

While at it, remove some <space> commands from execute-keys, to make
it work on the breaking-cleanups branch which swaps <space> and ",".

Closes #4335
2022-04-28 19:32:24 +02:00