Commit Graph

9850 Commits

Author SHA1 Message Date
Maxime Coste
2688893156 Fix pasting after when selections are overlapping
With overlapping selections, pasting after breaks assumption of
SelectionList::for_each as our changes are no longer happening in
increasing locations.

We hence cannot rely on the ForwardChangeTracker in that case and
have to rely on the more general (and more costly) ranges update logic.

This interacts poorly with paste linewise pastes and we try to preserve
the current behaviour by tracking the last paste position.

Overall, this change really begs for overlapping selections to be
removed, but we will fix them like that for now.

Fixes #4779
2022-11-28 20:27:44 +11:00
Maxime Coste
760a45556c Merge remote-tracking branch '2xsaiko/outgoing/newlines-for-iterm2' 2022-11-21 08:51:21 +11:00
Marco Rebhan
5530f49c14 Deduplicate iterm2 escaping code
This fixes PATH and TMPDIR not being escaped in the iterm-terminal-window and
iterm-terminal-tab commands.
2022-11-20 14:00:34 +01:00
Marco Rebhan
c57805a926 Handle spawning iTerm and screen commands with arguments containing newlines
Before, sed would add quotes to every line of the single multiline argument,
causing the final quoted argument to "split ... command" or screen to contain
unquoted newlines such as this (from kakoune-cr):

	tell application "iTerm"
	    tell current session of current window
	        tell (split vertically with same profile command "env PATH='...' 'sh' '-c' ''
	'    export KAKOUNE_SESSION=$1'
	'    export KAKOUNE_CLIENT=$2'
	'    shift 3'
	''
	'    [ $# = 0 ] && set \"$SHELL\"'
	''
	'    \"sh\"'
	'  ' '--' '51909' 'client0' 'terminal' ") to select
	    end tell
	end tell

Instead of using sed to do this which operates on single lines at a time, simply
use printf to insert ' quotes before and after the entire argument.
2022-11-20 14:00:09 +01:00
Maxime Coste
d1e1f5df32 Merge remote-tracking branch 'Ssamm45/master' 2022-11-20 17:06:12 +11:00
Maxime Coste
5314e2375e Merge branch 'fix/hare-comment-insert' of http://github.com/stacyharper/kakoune 2022-11-20 17:03:14 +11:00
Maxime Coste
d548b0863d Merge branch 'ctags-kak-awk-compatibility' of http://github.com/lobre/kakoune 2022-11-20 17:01:34 +11:00
Maxime Coste
b7b036c210 Change BufferIterator comparison to assert same buffer
Comparing iterators between buffers should never happen, and the
only place we did was with default constructed BufferIterator which
we replace by casting the iterator to bool.

This should improve performance on iterator heavy code.
2022-11-20 16:59:08 +11:00
Marco Rebhan
df12bc8dbd Marco Rebhan 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-11-20 02:32:32 +01:00
Stacy Harper
becb1ef843
Fix hare new line insert indentation after comments
At the moment, inserting a new line while being in a comment result in a
"//<indentation>" instead of "<indentation>//".

To fix this, we just re-order both InsertChar hooks.
2022-11-19 08:34:54 +01:00
Loric Brevet
84d72eb4ba
Make ctags.kak compatible with original awk
Positional arguments in awk’s printf is a feature that is only available
in the GNU implementation of awk (gawk). So the ctags auto-completion feature
was broken in Kakoune if the installed version of awk was nawk or mawk.
This simple change makes it retro-compatible with those versions.

See https://www.gnu.org/software/gawk/manual/html_node/Printf-Ordering.html
2022-11-18 12:37:55 +01:00
Sam Larkin
acee9d8328 switch from using '&' to '<a-&>' when indenting javascript comments to allow the
type of indentation to be preserved
2022-11-17 13:52:22 -07:00
Sam Larkin
76086628a2 Samuel Larkin 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-11-17 13:48:43 -07:00
Maxime Coste
91d45a100a Merge remote-tracking branch 'krobelus/undo-selection-change' 2022-11-10 08:56:42 +11:00
Maxime Coste
bfa3c568cc Small fixup on how non-modified keys are written in README 2022-11-06 20:10:33 +11:00
Maxime Coste
253347cd40 Merge remote-tracking branch 'arrufat/update-x-behavior-in-readme' 2022-11-06 20:10:02 +11:00
Maxime Coste
e67fdf94c6 Merge remote-tracking branch 'occivink/add-selection-count-value' 2022-11-06 20:09:38 +11:00
Maxime Coste
e40ee184a6 Merge remote-tracking branch 'jwnrt/rust-union-keyword' 2022-11-06 20:09:02 +11:00
Olivier Perret
84379f4466 Add a %val{selection_count} expansion 2022-11-04 19:16:38 +01:00
Maxime Coste
dcdafdea77 Remove wrong rejection of upper case mappings in goto mode
Mapping upper case keys is legitimate, for exampled so that they behave
the same as a lower case mapping. The current rejection of those mappings
is a misguided attempt to prevent mapping *to* upper case keys as those
will never get triggered.

Closes #4769
2022-11-04 16:43:55 +11:00
Maxime Coste
ca6a701b80 Add -to-shell-script echo switch
This feature simplifies various small use cases and is a good
companion to the existing -to-file switch.
2022-11-04 16:40:07 +11:00
Adria Arrufat
32e7e57873
Reflect the new behavior of x and <a-x> 2022-11-03 13:56:02 +09:00
James Wainwright
078e5900a4 Add "union" as a keyword for Rust syntax 2022-11-01 21:29:07 +00:00
James Wainwright
79321989c0 James Wainwright 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-11-01 21:24:58 +00:00
Maxime Coste
98b84f2b05 Kakoune 2022.10.31 2022-10-31 09:05:58 +11:00
Maxime Coste
0a21dc0e99 Fix memory domain for cached command completion 2022-10-29 16:10:41 +11:00
Tim Allen
cc66237bf5 command-parsing: Put balanced string examples in the right section.
Addressing code-review comments.
2022-10-25 16:51:26 +11:00
Tim Allen
1b8381461d command-parsing: You *cannot* escape the delimiters of balanced strings.
Originally the page said:

> No other escaping takes place in balanced strings.

...but in the course of a general readability rewrite (56287da) this was
changed to:

> Characters may be escaped in the same manner as those for quoted strings.

...which is not actually true; probably this change made it in because there
were a lot of good changes in those commits and we didn't read them all closely
enough.

Now the documentation is correct again, and I've added some examples covering
the problems people occasionally ask about (see #2760).
2022-10-20 23:11:20 +11:00
Tim Allen
7b095a6465 command-parsing: Link to Balanced Strings when we mention that section. 2022-10-20 23:02:25 +11:00
Maxime Coste
cb33918fa2 Merge remote-tracking branch 'eraserhd/codeowners' 2022-10-19 20:39:11 +11:00
Maxime Coste
b42cb090ee Merge remote-tracking branch 'krobelus/fix-man-jump' 2022-10-19 20:37:19 +11:00
Maxime Coste
e43c7d6aba Use complete-command for the :doc command 2022-10-19 20:35:05 +11:00
Maxime Coste
d1bfc5ecdc Shell-highlight complete-command shell completion parameters 2022-10-19 20:34:35 +11:00
Maxime Coste
875668f1c2 Add regression test for #4750 2022-10-19 20:33:22 +11:00
Maxime Coste
65f4bf78e9 Merge remote-tracking branch 'krobelus/file-completion' 2022-10-19 20:23:39 +11:00
Maxime Coste
2cbcdf2fb4 Merge remote-tracking branch 'krobelus/write-autoinfo2' 2022-10-19 20:23:18 +11:00
Maxime Coste
5de90920d4 Merge remote-tracking branch 'krobelus/modeline-readonly-fix' 2022-10-19 20:22:25 +11:00
Maxime Coste
39fe2438f7 Merge remote-tracking branch 'krobelus/url-at-word-boundary' 2022-10-19 20:20:47 +11:00
Maxime Coste
e8eb1c8732 Merge branch 'typescript-filetype' of http://github.com/clarfonthey/kakoune 2022-10-19 20:20:07 +11:00
Maxime Coste
aa77078a2e Merge remote-tracking branch 'krobelus/select-make-buffer-at-last' 2022-10-19 20:19:03 +11:00
Maxime Coste
2dea0dfcb9 Merge remote-tracking branch 'krobelus/readme-updates' 2022-10-19 20:18:29 +11:00
Maxime Coste
bd23dbda00 Merge branch 'patch-4' of https://github.com/blaggacao/kakoune 2022-10-19 20:17:28 +11:00
Maxime Coste
ae6ee02cb2 Refactor insert_output command to avoid intermediate vector
This is like a paste with a different source, so the same logic
should work. This means we now correctly fix overflowing selections.

Fixes #4750
2022-10-19 20:16:09 +11:00
Maxime Coste
d1ac4dbff3 Remove unused History MemoryDomain 2022-10-19 20:16:09 +11:00
Johannes Altmanninger
62bd1af3f0 rc modeline: fix error trying to write readonly global variable
When running modeline-parse on this file:

	# kakoune: filetype=ledger:indentwidth=4

I get this error from dash (and a similar one from bash):

	sh: 53: readonly: key: is read only

This is because the readonly variable "key" is used elsewhere, both
times as global. Fix this by making both variables local. While
at it, remove an unused variable.

Fixes #4478
2022-10-17 19:23:30 +02:00
Maxime Coste
287217b987 Fix splitting of display atoms accross multi-columns codepoint
Honor the split request by inserting an empty atom to make sure
client code can assume splitting does replace one atom with two

Fixes #4753
2022-10-17 17:48:39 +11:00
ltdk
ab8b02720b Treat .cts and .mts as typescript 2022-10-16 20:23:05 -04:00
Johannes Altmanninger
daabb5da4e rc make: make-next-error to switch toolsclient to *make* buffer
This is equivalent to a change to grep.kak in 649e252f7 (bring *grep*
buffer to front in context of toolsclient, 2020-08-14).

If a toolsclient is set, make-next-error (and make-previous-error) will
jump to %opt{make_current_error_line}. This is wrong if the toolsclient
does not show the *make* buffer. In that case make_current_error_line
is undefined and we end up showing the goto menu. This has occasionally
been annoying me for a long time but I never bothered investigating.

Fix this by switching to the *make* buffer. The potential downside
is if make-next-error is run from the toolsclient, where we no longer
jump to the error but that's fine because we can use <ret>.

We can maybe improve this later by extending the logic, see
https://github.com/mawww/kakoune/pull/3656#pullrequestreview-472052285
2022-10-16 20:00:22 +02:00
Johannes Altmanninger
4f15f4179c README: clarify that change commands work on each selection
I think "current selection" could be misinterpreted as "main
selection", so let's use "each selection".
2022-10-16 20:00:22 +02:00
Johannes Altmanninger
4b3749c492 README: don't emphasize that <a-p> selects because now p does too
Note that these sentences talk about the "current" selection but
actually mean "each" selection. The next commit will change this.
2022-10-16 19:57:39 +02:00