profile
viewpoint

byuu/bsnes 443

bsnes is a Super Nintendo (SNES) emulator focused on performance, features, and ease of use.

byuu/higan 388

higan is a multi-system emulator focused on accuracy, preservation, and configurability.

vitiral/path_abs 33

ergonomic paths and files in rust

hwayne/hacker-test-history 28

Let's explain all the hacker test questions!

Screwtapello/beat 1

Create and apply patches to binary files in the BPS format

Screwtapello/80x40 0

80 by 40 canvas that anyone can draw on.

Screwtapello/bsnes 0

bsnes is a Super Nintendo (SNES) emulator focused on performance, features, and ease of use.

Screwtapello/cpulimit 0

CPU usage limiter for Linux

Screwtapello/exitcode 0

Preferred system exit codes as defined by sysexits.h

Screwtapello/hacker-test-history 0

Let's explain all the hacker test questions!

Pull request review commentphilgee1981/kakoune

fix :send-text to work faster (and at all...)

 define-command x11-send-text -docstring "send the selected text to the repl wind     nop %sh{         printf %s\\n "${kak_selection}" | xsel -i         wid=$(xdotool getactivewindow)-        xdotool search --name kak_repl_window windowactivate-        xdotool key --clearmodifiers "Shift+Insert"+        xdotool search --name kak_repl_window key --clearmodifiers Shift+Insert         xdotool windowactivate $wid

Since we're no longer using windowactivate to tell xdotool which window to send Shift+Insert to, we shouldn't need the getactivewindow or windowactivate $wid lines either.

philgee1981

comment created time in 3 days

issue commentmawww/kakoune

Escape < and > in exec with %reg (and possibly other symbols)

You could also exec "<a-/><c-r>a" to search for text matching the contents of a register. If exec didn't treat <div> as a key, it wouldn't treat <a-/> as a key either.

kanashimia

comment created time in 3 days

pull request commentmawww/kakoune

expansions.asciidoc: Add an example of file expansion.

In some circumstances (such as piping to kak -p) you can use NUL as the argument delimiter. Since NUL cannot legally appear in a filename, it's safe to use it to delimit filenames. However, bash doesn't like NUL bytes appearing in command-substitutions, and I can't figure out how to type NUL directly in bash, or in Kakoune, so it's not a universally-applicable solution.

Screwtapello

comment created time in 4 days

pull request commentmawww/kakoune

expansions.asciidoc: Add an example of file expansion.

Admission: Earlier today I wanted to link somebody to the %file{} docs, so I searched for %file. When I didn't find it, I decided to make a PR documenting it, only to find it had actually been documented all along. So this is as much for the benefit of my laziness as anybody else. :)

Screwtapello

comment created time in 4 days

PR opened mawww/kakoune

expansions.asciidoc: Add an example of file expansion.

Properly speaking, all expansions are of the form "%abc{}" where "abc" is the expansion type. All expansion types are listed in the documentation, as they should be. However, when searching through the documentation, a keyword like "file" is likely to hit a lot of false-positives, so a smart user is likely to search for the more-unique "%file" instead. Unfortunately, unlike every other expansion-type, file-expansions did not include an example, so a search for "%file" resulted in no hits, potentially leading people to believe it was undocumented.

Now there's an example, so people searching for "%file" will find what they're looking for.

+7 -0

0 comment

1 changed file

pr created time in 4 days

create barnchScrewtapello/kakoune

branch : document-file-expansion

created branch time in 4 days

Pull request review commentmawww/kakoune

doc faq: Subsections, more items

 However, you can easily declare key mappings in your configuration file to be able to use those control-based shortcuts in insert mode. (See <<mapping#,`:doc mapping`>>) -== How can I explore the filesystem the way Vim's NerdTree does ?+Also note that a subset of "readline shortcuts" is implemented for command+prompts. -The builtin file completion engine used when opening a file for editing-(using the `:edit` command and letting the suggestions popup in the menu-beneath) is much more convenient than Vim's, which should suit basic needs.--However, if you need an actual explorer to interact with the editor,-you can create a Kakoune script that will spawn the tool in question,-which should in return send an "edit" command followed by the path of the-file you selected to the current Kakoune session (e.g. `echo "eval -client-$kak_client edit /path/to/file" | kak -p $kak_session`).--== Why aren't there other scopes similar to `%sh{}` e.g. python ?--Supporting custom scopes would add hard dependencies to the project, which-is too much of a drawback when balanced against the low cost of using-an interpreter in a regular shell scope (e.g. `%sh{ python -c "..." }`).-The shell scope allows users to spawn any interpreter they want, for a minimal-cost in terms of performance, it is therefore the reason why it's the only-one available by default.--== What shell is used to expand `%sh{}` scopes ?--The server expands shell scopes using the `sh` binary, stored in one of the-directories where all the POSIX standard utilities can be found -this list-of directories is stored in a system configuration variable, and queried-by Kakoune at startup.--In most distributions, `/bin/sh` will end up being used.--== Can I disable auto-indentation completely ?+=== Can I disable auto-indentation completely?  All the indentation hooks are conventionally named `<lang>-indent`, which allows us to use the `disabled_hooks` variable to disable indentation globally with the following command: `set global disabled_hooks '.+-indent'` -== How to enable syntax highlighting ?+=== How to enable syntax highlighting? -The mimetype of the files opened in new buffers is detected using the+The MIME type of the files opened in new buffers is detected using the `file` command, and syntax highlighting enabled automatically when possible. -== My file seems to be highlighted with the wrong colors, I thought syntax highlighting was detected automatically ?+=== My file seems to be highlighted with the wrong colors, I thought syntax highlighting was detected automatically?  The `file` utility has several shortcomings, such as detecting the-wrong mimetype for a file containing data with different syntax, e.g.+wrong MIME type for a file containing data with different syntax, e.g. a Python script containing hardcoded HTML templates detected as an HTML file. -Kakoune does its best at detecting file types (using known extensions-for a given format for instance), but not much can be done about those-ambiguous cases. You might consider writing a custom `$HOME/.magic` file-if needed.+Kakoune does its best to detect file types (using known extensions for a+given format for instance), but not much can be done about those ambiguous+cases. You might consider writing a custom `$HOME/.magic` file if needed. -== Can I disable syntax highlighting completely ?+=== Can I disable syntax highlighting completely?  Similarly to the indentation hooks, the name format followed by the highlighting hooks is `<lang>-highlight`. You can thus disable syntax highlighting using the following command: `set global disabled_hooks '.+-highlight'` -== Why does a dot `.` in a regex select newline characters ?+== The editing language++=== Why aren't there other scopes similar to `%sh{}` e.g. python?++Supporting custom scopes would add hard dependencies to the project, which+is too much of a drawback when balanced against the low cost of using+an interpreter in a regular shell scope (e.g. `%sh{ python -c "..." }`).+The shell scope allows users to spawn any interpreter they want, for a minimal+cost in terms of performance, it is therefore the reason why it's the only+one available by default.++=== What shell is used to expand `%sh{}` scopes?++The server expands shell scopes using the `sh` binary, located in one of+the directories containing all the POSIX standard utilities. This list of+directories is stored in a system configuration variable, and queried by+Kakoune at startup.++In most distributions, `/bin/sh` will end up being used.++=== Why does a dot `.` in a regex select newline characters?  Data in buffers is a stream of characters, and newlines do not receive special treatment compared to other characters, with regards to regex matching. In order to select data in a line without any trailing newline characters, one could use the `[^\n]+` pattern, which is arguably a good compromise when balanced against the ability to select data over several lines. -== Can I split the window to display different buffers in them ?+You can instruct the regex engine to stop matching newline characters with+`.` by disabling the appropriate flag (`(?S)`). -As a fairly compliant follower of the UNIX philosophy, Kakoune does not-try to implement features that are best handled by separate, dedicated-tools. Window splitting in terminals is a prime example of that-concept, where the editor provides commands to interact with several-terminal multiplexers (e.g. `tmux`), as opposed to emulating their-functionalities.--In order to open buffers in the same window simultaneously using `tmux`-(or one of the supported multiplexers), run Kakoune in a `tmux` session,-and simply use the `:new` command to spawn new clients as you would-have otherwise in an X11 environment.--== Why does `a` extend the current selection, but `i` leaves it untouched ?+=== Why does `a` extend the current selection, but `i` leaves it untouched?  Selections are ranges of characters whose delimiters are an "anchor" and-a "cursor", and inserting characters is always done before the cursor in+a "cursor", and inserting characters is always done before the anchor in

Sorry, I didn't mean to imply that there was some obvious better alternative that you'd missed. Kakoune's selections are minimum-length-1 for reasons I'm confident I can explain, which means that a newly-inserted character must go to the left or the right — but I wasn't confident I could explain why either choice was better than the other.

Now that I've had time to think about it a little more, I think the real source of Kakoune's left-bias is the fact that it's designed for Latin script (like terminals and the QWERTY keyboard layout), which is written left-to-right. So, when you insert text, the left-end of the selection moves right to make room for it. When you append text, the right-end of the selection moves right to make room for it. Kakoune's behaviour is mechanically consistent, it's just not visually consistent because of the way the Latin script works. So, here's another attempt at answering this FAQ:

A selection is a range of characters from the "cursor" (the end you move around directly, sometimes called the head) to the "anchor" (the end that follows the previous position of the cursor, sometimes called the tail). When you type a letter in insert mode, Kakoune will always place it under the cursor (shifting any existing text to the right to make room), and then move the cursor to the right ready for the next letter.

When you enter insert mode with i, Kakoune will ensure that each selection's cursor is at the left-hand end before you start typing, so that the text you type appears before the originally selected text. As you type, the cursor (and any following text) move right to make room, leaving the new text outside the selection.

When you enter insert mode with a, Kakoune will ensure each selection's cursor is at the right-hand end before you start typing, so that the text you type appears after the originally selected text. As you type, the cursor (and any following text) move right to make room, leaving the new text inside the selection.

Although it's visually inconsistent for appended text to wind up inside the selection and inserted text to be outside it, it's mechanically consistent.

lenormf

comment created time in 4 days

Pull request review commentmawww/kakoune

doc faq: Subsections, more items

 However, you can easily declare key mappings in your configuration file to be able to use those control-based shortcuts in insert mode. (See <<mapping#,`:doc mapping`>>) -== How can I explore the filesystem the way Vim's NerdTree does ?+Also note that a subset of "readline shortcuts" is implemented for command+prompts. -The builtin file completion engine used when opening a file for editing-(using the `:edit` command and letting the suggestions popup in the menu-beneath) is much more convenient than Vim's, which should suit basic needs.--However, if you need an actual explorer to interact with the editor,-you can create a Kakoune script that will spawn the tool in question,-which should in return send an "edit" command followed by the path of the-file you selected to the current Kakoune session (e.g. `echo "eval -client-$kak_client edit /path/to/file" | kak -p $kak_session`).--== Why aren't there other scopes similar to `%sh{}` e.g. python ?--Supporting custom scopes would add hard dependencies to the project, which-is too much of a drawback when balanced against the low cost of using-an interpreter in a regular shell scope (e.g. `%sh{ python -c "..." }`).-The shell scope allows users to spawn any interpreter they want, for a minimal-cost in terms of performance, it is therefore the reason why it's the only-one available by default.--== What shell is used to expand `%sh{}` scopes ?--The server expands shell scopes using the `sh` binary, stored in one of the-directories where all the POSIX standard utilities can be found -this list-of directories is stored in a system configuration variable, and queried-by Kakoune at startup.--In most distributions, `/bin/sh` will end up being used.--== Can I disable auto-indentation completely ?+=== Can I disable auto-indentation completely?  All the indentation hooks are conventionally named `<lang>-indent`, which allows us to use the `disabled_hooks` variable to disable indentation globally with the following command: `set global disabled_hooks '.+-indent'` -== How to enable syntax highlighting ?+=== How to enable syntax highlighting? -The mimetype of the files opened in new buffers is detected using the+The MIME type of the files opened in new buffers is detected using the `file` command, and syntax highlighting enabled automatically when possible. -== My file seems to be highlighted with the wrong colors, I thought syntax highlighting was detected automatically ?+=== My file seems to be highlighted with the wrong colors, I thought syntax highlighting was detected automatically?  The `file` utility has several shortcomings, such as detecting the-wrong mimetype for a file containing data with different syntax, e.g.+wrong MIME type for a file containing data with different syntax, e.g. a Python script containing hardcoded HTML templates detected as an HTML file. -Kakoune does its best at detecting file types (using known extensions-for a given format for instance), but not much can be done about those-ambiguous cases. You might consider writing a custom `$HOME/.magic` file-if needed.+Kakoune does its best to detect file types (using known extensions for a+given format for instance), but not much can be done about those ambiguous+cases. You might consider writing a custom `$HOME/.magic` file if needed. -== Can I disable syntax highlighting completely ?+=== Can I disable syntax highlighting completely?  Similarly to the indentation hooks, the name format followed by the highlighting hooks is `<lang>-highlight`. You can thus disable syntax highlighting using the following command: `set global disabled_hooks '.+-highlight'` -== Why does a dot `.` in a regex select newline characters ?+== The editing language++=== Why aren't there other scopes similar to `%sh{}` e.g. python?++Supporting custom scopes would add hard dependencies to the project, which+is too much of a drawback when balanced against the low cost of using+an interpreter in a regular shell scope (e.g. `%sh{ python -c "..." }`).+The shell scope allows users to spawn any interpreter they want, for a minimal+cost in terms of performance, it is therefore the reason why it's the only+one available by default.++=== What shell is used to expand `%sh{}` scopes?++The server expands shell scopes using the `sh` binary, located in one of+the directories containing all the POSIX standard utilities. This list of+directories is stored in a system configuration variable, and queried by+Kakoune at startup.++In most distributions, `/bin/sh` will end up being used.++=== Why does a dot `.` in a regex select newline characters?  Data in buffers is a stream of characters, and newlines do not receive special treatment compared to other characters, with regards to regex matching. In order to select data in a line without any trailing newline characters, one could use the `[^\n]+` pattern, which is arguably a good compromise when balanced against the ability to select data over several lines. -== Can I split the window to display different buffers in them ?+You can instruct the regex engine to stop matching newline characters with+`.` by disabling the appropriate flag (`(?S)`). -As a fairly compliant follower of the UNIX philosophy, Kakoune does not-try to implement features that are best handled by separate, dedicated-tools. Window splitting in terminals is a prime example of that-concept, where the editor provides commands to interact with several-terminal multiplexers (e.g. `tmux`), as opposed to emulating their-functionalities.--In order to open buffers in the same window simultaneously using `tmux`-(or one of the supported multiplexers), run Kakoune in a `tmux` session,-and simply use the `:new` command to spawn new clients as you would-have otherwise in an X11 environment.--== Why does `a` extend the current selection, but `i` leaves it untouched ?+=== Why does `a` extend the current selection, but `i` leaves it untouched?  Selections are ranges of characters whose delimiters are an "anchor" and-a "cursor", and inserting characters is always done before the cursor in+a "cursor", and inserting characters is always done before the anchor in

If I understand correctly, the real answer to this FAQ is something like:

  • A selection is a range of characters from the "cursor" (the end you move around directly, sometimes called the head) to the "anchor" (the end that follows the previous position of the cursor, sometimes called the tail)
  • Kakoune has (somewhat arbitrarily) decided that inserted text always appears to the left of the cursor
  • When you enter insert mode, Kakoune ensures that each selection's cursor is at the left-hand end of the selection — because inserted text appears to the left of the cursor, it appears to the left of the selection, and is therefore not part of the selection
  • When you enter append mode, Kakoune ensures that each selection's cursor is at the right-hand end of the selection, and grows the selection by one character — because inserted text appears to the left of the cursor, it appears just inside the selection and is therefore part of the selection

I don't know if there's a specific reason why inserted text always appears to the left of the cursor.

lenormf

comment created time in 5 days

issue commentmawww/kakoune

Can't define mapping for the unit separator (^_, 0x1F, C-_, C-/)

See #2553.

You can map US by typing <c-v><c-/> (Kakoune should display to represent the control code) but at the moment there's no printable-ASCII name for that keystroke.

enricozb

comment created time in 5 days

issue openedmawww/kakoune

Allow custom mappings in the "combine selections" menu

Feature <!-- what do you want implemented that is not already available in the development version? -->

The :mapcommand takes a "mode" argument that restricts the availability of the mapping. As well as the obvious modes (insert, normal) and some UI-based modes (prompt, menu, user) there's specific modes for the various normal-mode commands that are prefixes: goto, view, and object. A user can add a mapping (with a docstring) to those modes, and the mapping will show up alongside the built-in/official mappings, so plugins can extend Kakoune in a way that feels completely normal and familiar.

However, there's one normal-mode prefix that does not accept custom mappings: the "combine selections" menu that appears after you press <a-z> or <a-Z>.

The specific list of changes requested by this issue are:

  • the :map command should accept a new "mode" ("combine_selections"? "combsel"?) that represents the "combine selections" menu
  • mappings in the "combine_selections" mode should have access to the %val{count} and %val{register} expansions (like mappings in "object" do)
  • mappings will probably need an additional %val{combine_direction} expansion to distinguish between <a-z> (from register) and <a-Z> (to register)

Usecase <!-- what use do you have for the feature, if it's not self-evident (e.g. a hook, option)? -->

People coming to Kakoune for the first time frequently expect the "combine selections" menu to do mathematical-style set operations (union, intersection, left-subtraction, right-subtraction) on the set of selected characters:

  • https://github.com/mawww/kakoune/issues/3560
  • https://github.com/mawww/kakoune/issues/3504
  • https://discuss.kakoune.com/t/selection-combining-operator-u-union-is-little-bit-misleading/724
  • https://discuss.kakoune.com/t/invert-selection/1037
  • https://github.com/mawww/kakoune/issues/2850

However, the existing items in the combine selections menu don't work like that. There's good reasons why they don't work like that, but experimenting with different kinds of selection operations is difficult because they must be implemented in C++.

If custom mappings could be added to the "combine selections" menu, people could implement different selection operations themselves. If any of those experiments turned out to be particularly useful, they could be ported to C++ later.

created time in 6 days

issue commentmawww/kakoune

Invisible character from YouTube chat copying

hexdump -C says:

00000000  43 6f 70 79 20 74 68 69  73 20 6c 69 6e 65 2e 20  |Copy this line. |
00000010  20 54 68 65 72 65 20 69  73 20 61 20 63 68 61 72  | There is a char|
00000020  61 63 74 65 72 20 62 65  74 77 65 65 6e 20 5b e2  |acter between [.|
00000030  80 8b 5d 2e 0a                                    |..]..|
00000035

The bytes between [] are E2 80 8B, which is the UTF-8 encoding of U+200B ZERO WIDTH SPACE. The h and l keys in Kakoune navigate by Unicode code-point, but not all code-points are visible on-screen, so sometimes the cursor disappears when a zero-width string is selected. Unicode combining characters (which are also zero-width) have the same effect: try pasting Z̭̯̹͈͢a̜̰͇̘̿̎͋ͥḽ̝̺̳̩̩̗g͎̺̩̞o̧ ̤̭̀ͬͧͅt͚̯͉̃̇̇ĕ̟͇͑xt into Kakoune and see what happens.

alexherbo2

comment created time in 6 days

issue commentmawww/kakoune

Combine selection subtraction

I see the buffer as a set of characters. Each selection is a ("connected") set. Multiple selections are also a set (but not "connected").

If you think of the buffer as a set of characters, and selections as an arbitrary subset, then these sorts of set operations are very natural and make perfect sense.

Kakoune doesn't quite work like that, though: there's a very distinct difference between a selection covering the word "hello" and five selections covering the letters "h", "e", "l", "l" and "o". It's certainly possible to "flatten" Kakoune's selections into "a set of selected characters", then perform a set intersection and then reconstruct the original selections by gluing together adjacent selections, and that will work most of the time, but not always.

The current "pairwise" selection operations are, I think, about as flexible as you're going to get while respecting Kakoune's selection model. I'd definitely love to see more "mathematical" selection operations (I've missed them myself) but I don't think it would be appropriate for them to replace the current operations. Perhaps it would be a good experiment to implement these operations with a plugin?

mreppen

comment created time in 8 days

issue commentmawww/kakoune

Use integers for the underlying value of boolean options

But in the shell, 0 is true and 1 is false, which is the opposite convention from what you suggested.

alexherbo2

comment created time in 8 days

issue commentmawww/kakoune

Entering diacritics on macOS with Alt key produces weird characters

I think you have swapped the "Outcome" and "Expected" sections of the template? You expected ą but you got "a weird character" instead? Can you paste this weird character, or a screenshot?

Traditionally on macOS, the Option (Alt) key is used to produce diacritics, and most macOS terminal emulators will (by default) match the behaviour of any other application. However, many terminal apps (including Kakoune) expect the Alt key to be available for their own key-bindings, so macOS terminal emulators typically have an option to send Alt-modified keys through to the app, instead of interpreting them as diacritics. Alt-A in Kakoune (in normal mode) is supposed to bring up the "Select surrounding object" menu, for example, although in insert mode it does nothing.

marekkowalczyk

comment created time in 10 days

issue commentmawww/kakoune

Not respecting KAKOUNE_POSIX_SHELL on NixOS

I guess the most basic test would be: in a terminal, where you would normally run kak, try running $KAKOUNE_POSIX_SHELL instead. If you get some kind of "file not found" error, that's a good thing to know. Otherwise, if you get a bare $ prompt, it's probably dash, and if you get your regular bash prompt, or something like sh-5.0$, it's probably bash. To be completely sure, you can try a bash-specific command like fc and see if it's recognised.

Parasrah

comment created time in 11 days

issue commentmawww/kakoune

Not respecting KAKOUNE_POSIX_SHELL on NixOS

Looking at how Kakoune handles that environment variable, it looks like if the shell doesn't exist or isn't executable, Kakoune will immediately crash, rather than starting up normally:

$ KAKOUNE_POSIX_SHELL=/does/not/exist kak
Fatal error: KAKOUNE_POSIX_SHELL '/does/not/exist' is not executable

Where and how are you setting this variable?

Parasrah

comment created time in 11 days

issue commentbsnes-emu/bsnes

DX11 Support / XAudio Update / Xinput

Emulators for 3D consoles might benefit from new technologies because those consoles' graphics work quite differently from OpenGL and DX9, and the increased flexibility in Vulkan and DX11 can make it easier to implement.

bsnes does not use OpenGL or DX9 for anything beyond drawing two textured triangles, sixty times a second. DirectX1 would probably be overkill, nevermind DirectX 9.

Likewise, newer versions of XAudio and XInput don't provide anything bsnes could realistically use. bsnes will probably need to be updated to use newer APIs eventually, when the current ones finally stop working, but I think that's still a long way off.

IPeluchito

comment created time in 13 days

issue closedbsnes-emu/bsnes

DX11 Support / XAudio Update / Xinput

Please update the drivers to more modern versions, the ones included in the emulator are outdated .... mainly DX9-> DX11, XAudio2.1-> Newer Version and Xinput

God bless you...

closed time in 13 days

IPeluchito

issue openedmawww/kakoune

Segfault

Steps <!-- how to reproduce the issue? -->

Using the latest master branch:

echo abc > /tmp/abc && kak -n -e 'execute-keys Oa<c-n>; execute-keys -draft <a-h>d' /tmp/abc

Outcome <!-- what is the result of the above steps? -->

Received SIGSEGV, exiting.
Pid: 1583404
Callstack:
./src/kak.debug(Kakoune::Backtrace::Backtrace()+0x2b) [0x55cd5ea798fd]
./src/kak.debug(Kakoune::signal_handler(int)+0xbd) [0x55cd5ec3fb42]
/lib/x86_64-linux-gnu/libc.so.6(+0x3b800) [0x7fcd6e70d800]
./src/kak.debug(Kakoune::Buffer::char_prev(Kakoune::BufferCoord) const+0x221) [0x55cd5ea81e4b]
./src/kak.debug(+0x5f2ae6) [0x55cd5ec01ae6]
./src/kak.debug(+0x5f44ab) [0x55cd5ec034ab]
./src/kak.debug(+0x5f45a3) [0x55cd5ec035a3]
./src/kak.debug(Kakoune::InsertCompleter::reset()+0x376) [0x55cd5ec0206c]
./src/kak.debug(Kakoune::InsertCompleter::update(bool)+0x55) [0x55cd5ec016e7]
./src/kak.debug(Kakoune::InputModes::Insert::Insert(Kakoune::InputHandler&, Kakoune::InsertMode, int)::{lambda(Kakoune::Timer&)#1}::operator()(Kakoune::Timer&) const+0x39) [0x55cd5ebec15b]
./src/kak.debug(std::_Function_handler<void (Kakoune::Timer&), Kakoune::InputModes::Insert::Insert(Kakoune::InputHandler&, Kakoune::InsertMode, int)::{lambda(Kakoune::Timer&)#1}>::_M_invoke(std::_Any_data const&, Kakoune::Timer&)+0x37) [0x55cd5ebf72b3]
./src/kak.debug(std::function<void (Kakoune::Timer&)>::operator()(Kakoune::Timer&) const+0x49) [0x55cd5eb69c1b]
./src/kak.debug(Kakoune::Timer::run(Kakoune::EventMode)+0x62) [0x55cd5eb68660]
./src/kak.debug(Kakoune::EventManager::handle_next_events(Kakoune::EventMode, __sigset_t*, bool)+0x916) [0x55cd5eb69168]
./src/kak.debug(Kakoune::run_server(Kakoune::StringView, Kakoune::StringView, Kakoune::StringView, Kakoune::Optional<Kakoune::BufferCoord>, Kakoune::ServerFlags, Kakoune::UIType, Kakoune::DebugFlags, Kakoune::ArrayView<Kakoune::StringView const>)+0xdcd) [0x55cd5ec3e2fe]
./src/kak.debug(main+0x2611) [0x55cd5ec425f9]

Expected <!-- what should have been the result of the above steps? -->

No crash.

Notes

Originally reported on the forum.

created time in 19 days

issue commentmawww/kakoune

Default theme's colour constrast is kinda bad.

For whatever historical reasons, a bunch of terminals ship with a default colour scheme with poor contrast (dark-blue vs. black is a common problem) or merely unpleasant (like the yellow in Delapouite's screenshot). On the other hand, some terminals ship with really nice colour-schemes, like the Tango colour scheme that libVTE-based terminals use:

image

If your terminal's colour-scheme has poor contrast, or is not to your taste, the easiest thing to do is adjust the terminal, not each app inside the terminal. There's tons of great colour-schemes for Alacritty you can play with. Some of them get pretty wild, but if you're looking for something conservative I recommend Tango (pictured above) or the new Windows Console colour-scheme Campbell as starting points.

ewtoombs

comment created time in 20 days

issue commentbsnes-emu/bsnes

DX11 Support / XAudio Update / Xinput

Are these older versions causing you problems? If so, what?

IPeluchito

comment created time in 20 days

issue commentmawww/kakoune

[builtin-terminal-ui] Artifact on click

I'm pretty sure it's not the escape sequence in set_cursor_pos() (line 30) because in the screenshot the glitched sequence is immediately followed by the next line of text, which suggests it occurs during a repaint.

The escape sequence that's immediately followed by an M sequence (line 260) does not do any painting; it's not possible for it to glitch two lines together as the screenshots show, so I don't think it's that on either.

The escape sequences on lines 273 and 275 are mutually exclusive on each iteration of the loop, so I guess if the problem is caused by the previous iteration, it could be either of them... but that still narrows it down pretty far.

I note that Kitty has an option to record the bytes sent by the application running in the terminal (--dump-bytes=/path/to/file), so if we ever find a way to reproduce the glitch, we can record it and find out exactly what was sent before the glitch occurred.

lenormf

comment created time in 24 days

issue commentmawww/kakoune

[builtin-terminal-ui] Artifact on click

H is the identifier of the CUrsor Position sequence. It's normally used with two arguments (a line and a column), but when used with one argument it goes to the beginning of the named line.

If we grep the Kakoune codebase for H" (i.e. an H at the end of a string), the only time it's used with exactly one argument is line 275 of terminal_ui.cc, which is during the repaint loop. Unfortunately, because it comes at the start of the loop, there's all kinds of things that could have happened during the previous iteration, so it's hard to guess what the previous output might have been.

lenormf

comment created time in 25 days

CommitCommentEvent

PR opened higan-emu/higan

CI testing

Basically the same changes as I recently made for bsnes.

+5 -5

0 comment

1 changed file

pr created time in a month

create barnchScrewtapello/higan

branch : ci-testing

created branch time in a month

delete branch Screwtapello/bsnes

delete branch : ci-testing

delete time in a month

PR opened bsnes-emu/bsnes

Fix Cirrus CI builds

Fixes #27

+5 -4

0 comment

2 changed files

pr created time in a month

create barnchScrewtapello/bsnes

branch : ci-testing

created branch time in a month

fork Screwtapello/bsnes

bsnes is a Super Nintendo (SNES) emulator focused on performance, features, and ease of use.

fork in a month

push eventScrewtapello/bsnes

Tim Allen

commit sha 92ebbae4ceb87d49f75cff46fedf7c211d3904c1

Make CirrusCI use a supported version of FreeBSD.

view details

Tim Allen

commit sha f6d2645fd471a88fc174663939483aa2471f285d

Apparently the MinGW compiler automatically appends the .exe extension now.

view details

Tim Allen

commit sha 35598cf6226eb1c064f362835e0855cbbca3e900

Prevent Debian packages from prompting for configuration. At some point the Debian tzdata package started waiting for somebody to tell it what timezone it was in, causing CI builds to timeout.

view details

push time in a month

push eventScrewtapello/bsnes

Tim Allen

commit sha 2fcb4794520a1012b3e1854bb782edcd395ee2e9

Apparently the MinGW compiler automatically appends the .exe extension now.

view details

Tim Allen

commit sha 9baadc7524d71cfabca08f1418ba84539b5d871b

Prevent Debian packages from prompting for configuration. At some point the Debian tzdata package started waiting for somebody to tell it what timezone it was in, causing CI builds to timeout.

view details

push time in a month

push eventScrewtapello/bsnes

Tim Allen

commit sha 375766a648c13542386c7bbab123b44027a17772

Apparently the MinGW compiler automatically appends the .exe extension now.

view details

push time in a month

push eventScrewtapello/bsnes

Tim Allen

commit sha 85d5238185a19ae0e390da94edfbe91e760c6c23

Try updating to the latest stable version of FreeBSD.

view details

push time in a month

push eventScrewtapello/bsnes

Tim Allen

commit sha f843911d357a3b41ea176113b688b3de1b2160e5

CirrusCI now suggests a different syntax for FreeBSD VMs.

view details

push time in a month

issue commentbsnes-emu/bsnes

bsnes-emu/bsnes Cirrus CI builds failing

I feel like a Windows-targeting compilation would result in a bsnes.exe.

You'd think that, but it certainly didn't do that previously. I'm gonna take a look.

RokkumanX

comment created time in a month

create barnchScrewtapello/bsnes

branch : ci-testing

created branch time in a month

issue commentmawww/kakoune

[builtin-terminal-ui] Artifact on click

It would also help to mention what terminal you're using. I've never seen artifacts on libvte-based terminals, for example.

lenormf

comment created time in a month

issue commentmawww/kakoune

[builtin-terminal-ui] Artifact on click

If you (or anyone else) can screenshot or otherwise record the exact sequences involved (usually beginning with a [, optionally some semicolon-separated numbers, then ending with a letter) that should help pin down what Kakoune was doing at the time, and maybe what previous sequence got corrupted or ignored to cause this sequence to be displayed rather than interpreted.

lenormf

comment created time in a month

Pull request review commenthigan-emu/libco

Proper cross-platform settings.h

    do not use this unless you are certain your application won't use SSE */ /* #define LIBCO_NO_SSE */ -#if defined(LIBCO_C)-  #if defined(LIBCO_MP)-    #define thread_local __thread-  #else+#if !defined(thread_local) // User can override thread_local for obscure compilers+  #if !defined(LIBCO_MP) // Running in single-threaded environment     #define thread_local+  #else // Running in multi-threaded environment+    #if defined(__STDC_VERSION__) // Compiling as C Language+      #if defined(_MSC_VER) // Don't rely on MSVC's C11 support+        #define thread_local __declspec(thread)+      #elif __STDC_VERSION__ < 201112L // If we are on C90/99+        #if defined(__clang__) || defined(__GNUC__) // Clang and GCC+          #define thread_local __thread+        #else // // Otherwise, we ignore the directive (unless user provides their own)

Is this double-comment (// //) deliberate for alignment, or a mistake?

namandixit

comment created time in a month

Pull request review commenthigan-emu/libco

Proper cross-platform settings.h

    do not use this unless you are certain your application won't use SSE */ /* #define LIBCO_NO_SSE */ -#if defined(LIBCO_C)-  #if defined(LIBCO_MP)-    #define thread_local __thread-  #else+#if !defined(thread_local) // User can override thread_local for obscure compilers+  #if !defined(LIBCO_MP) // Running in single-threaded environment     #define thread_local+  #else // Running in multi-threaded environment+    #if defined(__STDC_VERSION__) // Compiling as C Language+      #if defined(_MSC_VER) // Don't rely on MSVC's C11 support+        #define thread_local __declspec(thread)+      #elif __STDC_VERSION__ < 201112L // If we are on C90/99+        #if defined(__clang__) || defined(__GNUC__) // Clang and GCC+          #define thread_local __thread+        #else // // Otherwise, we ignore the directive (unless user provides their own)+          #define thread_local+        #endif+      #else // C11 and newer define thread_local in threads.h+        #include <threads.h>+      #endif+    #elif defined(__cplusplus) // Compiling as C++ Language+      #if __cplusplus < 201103L // thread_local is a C++11 feature+        #if defined(_MSC_VER)+          #define thread_local __declspec(thread)+        #elif defined(__clang__) || defined(__GNUC__)+          #define thread_local __thread+        #else // // Otherwise, we ignore the directive (unless user provides their own)

This double-comment, too.

namandixit

comment created time in a month

issue commenthigan-emu/libco

How to pass paramter to entry function?

The (freshly converted to Markdown) docs say:

This function does not take any arguments, due to portability issues with passing function arguments. However, arguments can be simulated by the use of global variables, which can be set before the first call to each cothread.

You should be able to do something like:

  • make a global variable named REAL_FUNC containing a function pointer that takes a void * argument
  • make a global variable named REAL_ARGS containing a void *
  • make a wrapper function that takes no arguments, but calls REAL_FUNC(REAL_ARGS)
  • when you want to spawn a function in a thread, assign the function to REAL_FUNC, the argument to REAL_ARGS, and spawn the wrapper function instead
lygstate

comment created time in a month

pull request commenthigan-emu/libco

Made the dependency on stdlib.h and assert.h optional

That's a thumbs-up from me, but I'll wait a day or so to see if any other maintainers have any objections before hitting the button.

namandixit

comment created time in a month

PR opened higan-emu/libco

Convert documentation from HTML to Markdown.

This (counterintuitively) makes it easier to read online.

Fixes #8.

+182 -169

0 comment

5 changed files

pr created time in a month

create barnchScrewtapello/libco

branch : markdown-docs

created branch time in a month

pull request commenthigan-emu/libco

Made the dependency on stdlib.h and assert.h optional

This makes sense to me, but I think the repeated stanza about #if !defined(LIBCO_...) should go into settings.h, where people who want to customise libco might look for settings.

Also, __VA_ARGS__ is apparently C99, while the rest of the codebase is (according to the README) C89. However, I don't know if that's a problem in practice. If you're working on embedded systems, you probably know more about the quirks of niche toolchains than I do.

namandixit

comment created time in a month

pull request commenthigan-emu/libco

Proper cross-platform settings.h

I'm not a super-expert on this stuff, but it looks reasonable to me.

For alignas(), I assume you check for MSC_VER before checking __STDC_VERSION__ because we just assume MSVC will never support modern versions of C, only C++?

namandixit

comment created time in a month

Pull request review commentmawww/kakoune

doc faq: Subsections, more items

 for a given format for instance), but not much can be done about those ambiguous cases. You might consider writing a custom `$HOME/.magic` file if needed. -== Can I disable syntax highlighting completely ?+=== Can I disable syntax highlighting completely ?  Similarly to the indentation hooks, the name format followed by the highlighting hooks is `<lang>-highlight`. You can thus disable syntax highlighting using the following command: `set global disabled_hooks '.+-highlight'` -== Why does a dot `.` in a regex select newline characters ?+== The editing language++=== Why aren't there other scopes similar to `%sh{}` e.g. python ?++Supporting custom scopes would add hard dependencies to the project, which+is too much of a drawback when balanced against the low cost of using+an interpreter in a regular shell scope (e.g. `%sh{ python -c "..." }`).+The shell scope allows users to spawn any interpreter they want, for a minimal+cost in terms of performance, it is therefore the reason why it's the only+one available by default.++=== What shell is used to expand `%sh{}` scopes ?++The server expands shell scopes using the `sh` binary, stored in one of the+directories where all the POSIX standard utilities can be found -this list

found -this should probably be found - this (space before and after the punctuation) or found-this (no space)

lenormf

comment created time in a month

pull request commenthigan-emu/libco

add cmake build script for libco

I don't think we want the Windows fibers change - if an app specifically calls co_derive() rather than co_create(), it's because it explicitly wants to manage the stack itself - perhaps to snapshot and restore the stack, or maybe walk it for garbage-collection purposes. Secretly storing the stack elsewhere would just break things, so it's better for co_derive() to just return 0, and then the app can make an informed decision about what it wants to do.

lygstate

comment created time in a month

issue commentmawww/kakoune

non-default hooks?

but what if I don't have an exhaustive list of filetypes that could be used?

Yeah, Kakoune doesn't have a good, general-purpose system for dealing with "overlaid" file-formats like erb and similar macro pre-processors. In fairness, it's not generally possible to combine two file-formats like that, especially when one of them can dynamically generate the other at runtime, so even a "good" system would still be brittle.

The easiest thing to do would just be to do erb highlighting in erb files, and ignore the content outside the <% %> bits. Easy, but not very satisfying.

A more complex thing would be to have hooks that match .*\.html\.erb and set filetype=html (triggering all the usual HTML config) and then manually adding a bunch of erb stuff on top. That would have to be done per-filetype, but would be pretty easy for end-users to write manually, especially if you provided an add-erb-highlighting helper command.

The most complex thing would be to do something like: when a buffer ending in .*\.erb is created, strip off the .erb extension and create a scratch buffer with the resulting name. After all the filetype-detection logic has run, figure out what that buffer's filetype option is set to, destroy the buffer, then set the original buffer's filetype to that value. After all the highlighting hooks have run, add your erb stuff on top as in the previous approach. The result would be quite complex, probably brittle, and a mess to debug, but it would be automatic.

tmccombs

comment created time in a month

issue openedmawww/kakoune

Numeric (regex group) registers are cleared by buffer changes

Steps <!-- how to reproduce the issue? -->

kak -n -e 'edit -scratch; execute-keys ixax<esc> /(a)<ret> x c x<c-r>1x<esc>'

Written out longhand:

  • Launch Kakoune without any custom configuration
  • Create a new scratch buffer
  • Insert the text xax
  • Search the buffer for a, storing that match into the regex group 1
  • Select the entire line containing the match, then delete it and enter insert mode
  • Type an x, then the contents of regex group 1, then another x

Outcome <!-- what is the result of the above steps? -->

The buffer contains xx; inserting the contents of regex group 1 inserts an empty string, not the text that was matched.

Expected <!-- what should have been the result of the above steps? -->

The buffer contains xax, as it did originally.

Notes

  • This change was introduced by commit 63371da
  • This bug does not manifest if:
    • you just change the match instead of the entire line
    • you modify the selection with l instead of x
    • you use a instead of c
  • That is, the bug seems to require deleting the context of the match, not just the match itself
  • This was originally reported as a bug in my "kakoune-inc-dec" plugin by Charles Gueunet.

created time in a month

pull request commentmawww/kakoune

Implement smarter detection of windowing environments.

I think it's pretty clear that the different windowing modules were intended to be loaded up at once - otherwise they'd each define, say :terminal, instead of each defining their own variant and letting the user set an alias to point to their preferred implementation.

On the other hand, it's not really practical to load more than one at a time:

  • you can't be running inside both Kitty and iTerm2 (since they don't nest)
  • you can't be running inside both iTerm2 and X11 (since iTerm2 is not ported to X11)
  • You can run inside both X11 and tmux, X11 and screen, Kitty and tmux, Kitty and screen, iTerm2 and tmux, or iTerm2 and screen... but they both can detach from the outer terminal, so just because you started with a particular outer terminal doesn't mean it's still around
  • You can run inside both tmux and screen, but (1) why would you want to? and (2) just like X11, the outer terminal might no longer be around

Is there some combination of inner and outer that's practically useful?

sjjf

comment created time in a month

issue commentmawww/kakoune

non-default hooks?

I don't know why the heading says "Default hooks"; as far as I know there's no hooks other than the ones listed.

There's no way to manually trigger a specific hook, but if you just want a buffer to be treated as a specific file type, you can just set-option window filetype html - the Kakoune convention is to do all the file-type setup in a WinSetOption hook, specifically so that it can be triggered when necessary by other code.

tmccombs

comment created time in a month

Pull request review commentmawww/kakoune

doc: add comments for escape sequences in setup/restore terminal

 void TerminalUI::restore_terminal()     fputs("\033[?1004l", stdout);     fputs("\033[?25h", stdout);     fputs("\033>", stdout);+    // reset SGR

Again, we might as well explain all the way:

    // set the terminal output back to default colours and style
Delapouite

comment created time in a month

Pull request review commentmawww/kakoune

doc: add comments for escape sequences in setup/restore terminal

 void TerminalUI::set_resize_pending()  void TerminalUI::setup_terminal() {+    // enable alternative screen buffer     fputs("\033[?1049h", stdout);+    // enable focus notify     fputs("\033[?1004h", stdout);+    // hide cursor     fputs("\033[?25l", stdout);+    // set special keypad mode

This is usually (i.e. in the original DEC terminal documentation) known as "application keypad" mode. If we're being explanatory, we might as well go all the way:

    // set application keypad mode, so the keypad keys send unique codes
Delapouite

comment created time in a month

Pull request review commentmawww/kakoune

Rust highlight

 add-highlighter shared/rust/line_doctest region ^\h*//[!/]\h*```($|should_panic| add-highlighter shared/rust/line_doctest/marker region ```.* $ group add-highlighter shared/rust/line_doctest/marker/fence regex ``` 0:meta add-highlighter shared/rust/line_doctest/marker/keywords regex [\d\w] 0:meta # already matched above, just ignore comma-add-highlighter shared/rust/line_doctest/inner region '^\h*//[!/]\h+#' ' ' group+add-highlighter shared/rust/line_doctest/inner region '^\h*//[!/]( #(?= )|)' ' ' group

A # inside a doctest is used for text that's part of the test but not part of the documentation: https://doc.rust-lang.org/rustdoc/documentation-tests.html#hiding-portions-of-the-example

pickfire

comment created time in a month

issue commentmawww/kakoune

.xyz.kak.3nG8VI files after session quit

No, Kakoune will always try to backup unsaved changes files if it's killed unexpectedly, such as by SIGSEGV, SIGTERM or SIGQUIT.

To avoid this, you have a few alternatives available:

  • save modified buffers, or use :q! to close each running client
  • quit the session with a signal Kakoune can't catch, like SIGKILL
  • modify main.cc to not catch the signals you care about, and recompile
basbebe

comment created time in a month

PR opened jlebon/textern

Add debugging aids

I've been toying with the idea of implementing Textern's native helper executable in Rust, so I can make a single self-contained executable that automatically generates a manifest and installs it in the correct place, etc. Every time my native helper crashes, I have to go into Firefox's Addon Manager, disable Textern and re-enable it, otherwise I get "This text is already being edited" errors and the native helper is not restarted.

With this change, when the native helper crashes, it logs the error to the extension console (instead of silently ignoring it) and clears activeDocs and port so the helper will be automatically restarted next time it's needed.

+9 -0

0 comment

2 changed files

pr created time in a month

create barnchScrewtapello/textern

branch : debugging-aids

created branch time in a month

issue commentmawww/kakoune

Cursor shape doesn't change in insert mode

@tmccombs See https://discuss.kakoune.com/t/changing-the-cursor-colour-in-insert-mode/394 for an example.

sassanh

comment created time in a month

fork Screwtapello/textern

A Firefox add-on for editing text in your favourite external editor!

fork in a month

Pull request review commentmawww/kakoune

Add support for Elvish

+# Elvish+# https://elv.sh++hook global BufCreate '.*\.elv' %{+  set-option buffer filetype elvish+}++hook global WinSetOption filetype=elvish %{+  require-module elvish+  evaluate-commands set-option window static_words %opt{elvish_keywords}+  add-highlighter window/elvish ref elvish+  hook -group elvish window InsertChar '\n' elvish-new-line-inserted+  set-option window extra_word_chars '$' '~' '-'+  hook -always -once window WinSetOption filetype=.* %{+    remove-highlighter window/elvish+    remove-hooks window elvish+  }+}++provide-module elvish %{+  declare-option -hidden str-list elvish_keywords 'all' 'assoc' 'base' 'bool' 'break' 'cd' 'chr' 'constantly' 'continue' 'count' 'dir-history' 'dissoc' 'drop' 'each' 'eawk' 'echo' 'eq' 'esleep' 'eval-symlinks' 'exec' 'exit' 'explode' 'external' 'fail' 'fclose' 'fg' 'float64' 'fopen' 'from-json' 'from-lines' '-gc' 'get-env' 'has-env' 'has-external' 'has-key' 'has-prefix' 'has-suffix' 'has-value' '-ifaddrs' 'is' '-is-dir' 'joins' 'keys' 'kind-of' '-log' 'make-map' 'multi-error' 'nop' 'not' 'not-eq' 'ns' 'one' 'only-bytes' 'only-values' 'ord' 'order' '-override-wcwidth' 'path-abs' 'path-base' 'path-clean' 'path-dir' 'path-ext' 'peach' 'pipe' 'pprint' 'prclose' 'print' 'put' 'pwclose' 'rand' 'randint' 'range' 'read-line' 'read-upto' 'repeat' 'replaces' 'repr' 'resolve' 'return' 'run-parallel' 'search-external' 'set-env' 'slurp' '-source' 'splits' 'src' '-stack' 'styled' 'styled-segment' 'take' 'tilde-abbr' '-time' 'time' 'to-json' 'to-lines' 'to-string' 'unset-env' 'wcswidth'++  add-highlighter shared/elvish regions+  add-highlighter shared/elvish/code default-region group++  # Comments+  # https://elv.sh/ref/language.html#syntax-convention+  add-highlighter shared/elvish/comment region '#' '$' fill comment++  # String+  # https://elv.sh/ref/language.html#string+  add-highlighter shared/elvish/double_string region '"' '(?<!\\)"' regions+  add-highlighter shared/elvish/single_string region -recurse "(?<!')('')+(?!')" "(^|\h)\K'" "'(?!')" regions++  # Variables+  # https://elv.sh/ref/language.html#variable+  add-highlighter shared/elvish/code/variable regex '\$@?(?:[\w-]+:)*[\w-]+' 0:variable++  evaluate-commands %sh{+    # Keywords+    eval "set -- $kak_quoted_opt_elvish_keywords"+    regex="\\b(?:\\Q$1\\E"+    shift+    for keyword do+      regex="$regex|\\Q$keyword\\E"+    done+    regex="$regex)\\b"+    printf 'add-highlighter shared/elvish/code/keywords regex %s 0:keyword\n' "$regex"++    # String+    # https://elv.sh/ref/language.html#string+    for id in double_string single_string; do+      printf "+        add-highlighter shared/elvish/$id/fill default-region fill string+      "+    done+  }++  define-command -hidden elvish-new-line-inserted %{+    # Copy previous line indent+    try %{+      execute-keys -draft 'K<a-&>'+    }+    # Remove empty line indent+    try %{+      execute-keys -draft 'k<a-x>s^\h+$<ret>d'+    }+  }++  define-command -hidden elvish-fetch-keywords %{+    set-register dquote %sh{+      curl \

This is a bit scary to see in a file-handling module, for all the predictable reasons (curl isn't POSIX, we don't want to make network requests at runtime, etc.) so it would be useful to have a comment clearly pointing out that this command is not actually used at runtime, it's just for people maintaining and updating this script in the future. Perhaps the whole function should be commented out, just to make it clear that it's not used at runtime - it's easy enough for somebody who wants to work on this script to uncomment it.

I'm also a little worried that this function is brittle - by the time this file needs maintenance, what are the odds that Elvish has added a new source file, or renamed an old one, or reformatted the source so that the "extract keywords" logic no longer works?

alexherbo2

comment created time in a month

issue commentmawww/kakoune

Output messes up after some arbitrary inputs

These symptoms are pretty typical of $TERM not matching the terminal you're actually using - the terminal expects one thing, and $TERM tricks Kakoune into doing things a different way, and as a result weird things happen.

Inside genuine xterm, use xterm-256color.

Inside st, use st-256color.

Inside tmux, use tmux-256color.

Inside alacritty, use alacritty (apparently it always supports 256-color mode, so it doesn't need a special 256-color variant).

marknikky

comment created time in a month

issue commentmawww/kakoune

Output messes up after some arbitrary inputs

Alacritty and st are both pretty new and unpolished terminal emulators. Can you reproduce the behaviour inside standard xterm, with $TERM set to xterm-256color?

marknikky

comment created time in a month

issue commentmawww/kakoune

Double ESC going missing

Alas one can't just map <a-esc> in the UI as far as I can tell?

Pressing Alt+Esc does indeed send ^[^[, and if I do set -add global debug keys and press Alt-Esc, Kakoune logs:

Client 'client0' got key '<a-�>'

...which I assume means that Kakoune failed to decode the second ^[ byte as <esc> and just assumed it was a printable character. Sure enough, if I type:

:map global normal <a-^V^[> ": echo alt-esc<ret>"

(that is, typing ^V^[ at the prompt to enter a literal ^[, which gets displayed as ) then I can press Alt-Esc and see "alt-esc" displayed in the status line.

So: you can't map <a-esc>, but only because of a bug in Kakoune, not because it's an impossible sequence. It's still a very unlikely sequence, though, so maybe it's worth Kakoune special-casing ^[^[ to be an Esc followed by another sequence, since that's more likely to be useful?

arachsys

comment created time in a month

pull request commentmawww/kakoune

Fix setext-style markdown header highlight

I haven't tested your change yet, but it looks much better!

pickfire

comment created time in a month

issue commentmawww/kakoune

Autowrap does not wrap comment

The autowrap feature invokes whatever tool is named in autowrap_fmtcmd to do the actual wrapping. For portability, this option defaults to the POSIX-standard fold command, which doesn't have any smarts about comment prefixes. Instead (if it's available on your system), you might want to use the fmt command, which accepts a --prefix option to remove a prefix from each line, do the wrapping, then put it back. You might even have access to the par command, which tries to detect repeated prefixes and use them automatically (sometimes it tries too hard).

pickfire

comment created time in a month

pull request commentmawww/kakoune

Fix setext-style markdown header highlight

What happens in a situation like this?

abcdef
ghijkl
------

I think headings require \n\n to ensure there is a blank line before the heading text. I'm not sure why headings need three newlines after a bulleted-list, though.

pickfire

comment created time in a month

delete branch Screwtapello/kakoune

delete branch : restore-termios-before-suspend

delete time in a month

issue commentmawww/kakoune

Insert mode: <a-;> should not be recursive

This kakrc fragment isn't bullet-proof, but I think it should do what you want at least 80% of the time:

define-command \
    -params 0 \
    -docstring "Make <a-;> feel non-recursive, like Vim's <c-o>" \
    nerf-alt-semicolon \
%{
    on-key -mode-name normal %{
        evaluate-commands %sh{
            case "$kak_key" in
                O|o|A|a|I|i|c|<a-c>)
                    echo "exec <esc>$kak_key"
                    ;;
                *)
                    echo "exec <a-semicolon>$kak_key"
                    ;;
            esac
        }
    }
}

map global insert <a-semicolon> "<a-semicolon>: nerf-alt-semicolon<ret>"
vbauerster

comment created time in a month

issue commentmawww/kakoune

Insert mode: <a-;> should not be recursive

Perhaps you could put:

map global insert <a-semicolon> <esc>

...into your kakrc?

vbauerster

comment created time in a month

GollumEvent

issue commentmawww/kakoune

Insert mode: <a-;> should not be recursive

<a-;> is very deliberately recursive, so that people can write hooks, scripts and mappings that do things like <a-;>blahblah<esc> without messing up the user's insert session.

It should be possible to write a custom mapping to create the behaviour you're looking for, but I admit I'm a little confused. What advantage does <a-;>o have over <esc>o or <c-[>o? I looked through a bunch of "vim tips" blog posts and found people discussing using Vim's equivalent (<c-o>) in mappings, and for normal-mode commands that don't switch to insert mode, but I couldn't find anybody talking about using it interactively.

vbauerster

comment created time in a month

issue commentmintty/mintty

mintty env vars or esc seqs to return version or startup command line

Traditionally Ctrl-I and the Tab key both send byte 0x09. The point of this scheme is to distinguish these two keys, so one of them has to be modified to send a CSI u code instead. It's kind of a toss-up which one gets 0x09 and which one gets a CSI u code, but if we assume people hit Tab more frequently than Ctrl-I (Tab is a special, dedicated key!) it seems reasonable for that key to have the traditional 0x09 code.

BrianInglis

comment created time in 2 months

issue commentmintty/mintty

mintty env vars or esc seqs to return version or startup command line

Which terminals support this?

VTE, xterm, urxvt, and QTerminalWidget. PTerm sends FS ^\ for some reason, Terminology sends nothing.

The codes will include a modifier, built using this table:

It might be worth adding Super ("Command" on macOS, "Windows logo" elsewhere) to that table. I can imagine macOS users wanting to bind Super-S to "Save" in a terminal editor, just for consistency.

When multiple forms are specified, any is valid.

Ideally, the spec should have nothing optional in it. Applications already have to support the "Form 2" encodings for use with existing terminal emulators, so they might as well be the official encodings.

modifeir

Typo, should be "modifier".

Optionally, applications may choose to send these codes...

The spirit of the CSI u system seems to be "ASCII control characters should map to the most obvious keystroke that generates them, all the other keystrokes should send CSI u sequences". In that spirit, I'd suggest that apart from Escape, Tab, Backspace, and Enter, all control codes should be sent by pressing the specific key (so RS ^^ would be sent by Ctrl-Shift-6 on US English, and presumably an actual Ctrl-^ on a German keyboard), and all other means of generating those characters should send CSI u codes - so Ctrl-6 should send CSI 54;5 u rather than ^^.

BrianInglis

comment created time in 2 months

issue commentmintty/mintty

mintty env vars or esc seqs to return version or startup command line

It's just come to my attention that Ctrl-backtick is yet another way to type NUL; it should probably be mentioned in the spec/test suite.

Also, I notice that unmodified Enter is reported as 0x0A (NL/LF) by the test program, but traditionally Enter sends 0x0D (CR) which the kernel translates to 0x0A before the application receives it. The spec should also mention that, or the test should explicitly set the terminal to raw mode so it can see what the terminal actually sends.

BrianInglis

comment created time in 2 months

issue commentmawww/kakoune

Cannot map <c-space>

It turns out that, at least on the builtin-terminal-ui branch, NUL is interpreted as <c-`>, and a mapping for that key can be triggered by all the other keypresses that send NUL.

As a matter of predictability, I think NUL should be decoded as <c-space> since that's the easiest way to type it.

Screwtapello

comment created time in 2 months

issue commentmintty/mintty

mintty env vars or esc seqs to return version or startup command line

The specification should probably also talk about how to deal with Ctrl+numbers. In all the terminal emulators I have handy:

<table> <tr><th>Key<th>Control<th>Control+Shift <tr><td>1<td>1<td>! <tr><td>2<td>NUL <code>^@<td>NUL <code>^@ <tr><td>3<td>ESC <code>^[<td># <tr><td>4<td>FS <code>^<td>$ <tr><td>5<td>GS <code>^]<td>% <tr><td>6<td>RS <code>^^<td>RS <code>^^ <tr><td>7<td>US <code>^_<td>& <tr><td>8<td>DEL <code>^?<td>* <tr><td>9<td>9<td>( <tr><td>0<td>0<td><em>Nothing</em> </table>

If the ESC code is reserved for the Escape key, and Ctrl+[ is represented with CSI 91;5 u, then I guess it makes sense that Ctrl+3 be represented with CSI 51;5 u. But given Ctrl+] and Ctrl+5, which one should be sent as GS? If neither of them gets sent as GS, what should applications do when they receive GS?

BrianInglis

comment created time in 2 months

PR opened mawww/kakoune

terminal_ui: restore termios settings before suspending Kakoune.

TerminalUI::suspend() is responsible for undoing all Kakoune's modifications to the terminal state, actually suspending the process, then re-applying all the modifications after Kakoune wakes back up.

Previously, the "undo" and "reapply" steps for termios settings were both after the suspend point, so on some platforms they were incorrect when the user arrived back at the shell prompt.

Now, the termios "undo" step is back before the suspend point, and the undo and reapply steps should be in exactly reversed order.

Fixes #3488.

+1 -1

0 comment

1 changed file

pr created time in 2 months

create barnchScrewtapello/kakoune

branch : restore-termios-before-suspend

created branch time in 2 months

issue commentmawww/kakoune

[builtin-terminal-ui] Suspend with ctrl-Z messes up terminal

Actually, now I look at the code that handles Ctrl-Z, I see it clears and sets up the mouse handling (enable_mouse(false) and enable_mouse(mouse_enabled)), it clears and sets up the custom terminal modes (restore_terminal() and setup_terminal()), it clears and sets up the signal handler, and it even clears and sets up raw mode (tcsetattr(..., &m_original_termios) and set_raw_mode())... but both "clear" and "set up" raw mode happen after Kakoune suspends itself (raise(SIGTSTP)).

Could you try swapping lines 403 and 405 of terminal_ui.cc and rebuilding to see if that helps? Specifically, the code that looks like this:

raise(SIGTSTP); // suspend here

tcsetattr(STDIN_FILENO, TCSAFLUSH, &m_original_termios);

...should look like this:

tcsetattr(STDIN_FILENO, TCSAFLUSH, &m_original_termios);

raise(SIGTSTP); // suspend here

I'm really puzzled why I can't reproduce this, though. I noticed you were using zsh, and I wondered if maybe bash was automatically resetting stty, but I couldn't reproduce in zsh either.

ifreund

comment created time in 2 months

issue commentmawww/kakoune

[builtin-terminal-ui] Suspend with ctrl-Z messes up terminal

It looks like Kakoune isn't re-enabling the kernel's newline-to-CRLF translation on suspend. Is the output of stty different in the "working" and "broken" cases?

ifreund

comment created time in 2 months

issue commentmawww/kakoune

[builtin-terminal-ui] Suspend with ctrl-Z messes up terminal

I can't reproduce this behaviour, using commit 1ce453e and kak -n. Can you reproduce with that version and configuration?

ifreund

comment created time in 2 months

Pull request review commentmawww/kakoune

update FAQ: colorschemes in konsole/st

 This variable should be set by the terminal emulator, and not overridden with an arbitrary value, otherwise it might interfere with general UI rendering on the terminal's window. +Currently, Kakoune relies on "palette switching": redefining the standard+256-color palette for true 24-bit RGB color support.+If you're using a tool that doesn't support "palette switching", colors will+be slightly off: they are being rounded down to values supported by the+regular color palette by Kakoune.++== Why are colors unreadable in `konsole`/`QTermWidget` or `st`?++Even if the `TERM` and `COLORTERM` environment variables are set correctly, most+colorschemes look off. That's because these terminal emulators don't support+"palette switching" (see above).+For further information, see https://github.com/mawww/kakoune/issues/1807[#1807].

The future of Kakoune colour support is almost certainly the builtin-terminal-ui branch, which ignores TERM and assumes it's running inside a modern terminal.

plgruener

comment created time in 2 months

Pull request review commentmawww/kakoune

update FAQ: colorschemes in konsole/st

 This variable should be set by the terminal emulator, and not overridden with an arbitrary value, otherwise it might interfere with general UI rendering on the terminal's window. +Currently, Kakoune relies on "palette switching": redefining the standard+256-color palette for true 24-bit RGB color support.+If you're using a tool that doesn't support "palette switching", colors will+be slightly off: they are being rounded down to values supported by the+regular color palette by Kakoune.++== Why are colors unreadable in `konsole`/`QTermWidget` or `st`?++Even if the `TERM` and `COLORTERM` environment variables are set correctly, most

It's probably not worth mentioning COLORTERM here; I don't know of any applications that actually use it, certainly Kakoune doesn't.

plgruener

comment created time in 2 months

issue commentmawww/kakoune

Ui breaking when used with tmux + ssh

xterm-256color is perhaps not the best TERM for alacritty, but it's probably the best one available, so that's fine.

xterm-256color is definitely the wrong TERM for inside tmux. Try running each of these commands on the remote host:

  • infocmp tmux-256color | grep setaf
  • infocmp screen-256color | grep setaf
  • infocmp tmux | grep setaf
  • infocmp screen | grep setaf

The first one that doesn't say "infocmp: couldn't open terminfo file..." is the best TERM to use inside tmux on that server.

in42

comment created time in 2 months

issue commentmawww/kakoune

Ui breaking when used with tmux + ssh

What terminal are you invoking ssh in?

What is $TERM set to before you launch tmux?

What is $TERM set to inside tmux?

in42

comment created time in 2 months

CommitCommentEvent

issue commentmintty/mintty

mintty env vars or esc seqs to return version or startup command line

Either accept that timing is going to mess up in some cases and continue to use ESC-prefixed notation if that encodes fine, or go whole hog into CSIu and accept that applications will need to deal with it.

The spec says "When the simplest form of these keys are pressed, they should be encoded as previously", presumably so you can still type "reset" and hit Enter if an application crashes without properly turning it off. If ESC were encoded as CSI 27 u, that would eliminate the ambiguity between ESC key presses and control sequences, while still allowing "reset" to work.

BrianInglis

comment created time in 2 months

PR opened mawww/kakoune

Use iTerm2 "synchronised update" sequences around redraws.

In terminals that support it, this sequence causes the terminal to not redraw its output until the application has finished, reducing redraw flickering.

The sequence is defined in:

https://gitlab.com/gnachman/iterm2/-/wikis/synchronized-updates-spec

...and is apparently also supported by kitty and libVTE.

Fixes #3482.

+6 -0

0 comment

1 changed file

pr created time in 2 months

create barnchScrewtapello/kakoune

branch : synchronised-updates

created branch time in 2 months

issue openedmawww/kakoune

[builtin-terminal-ui] Support the iTerm2 "synchronised updates" feature

One of the potential problems with the builtin-terminal-ui branch is that most terminals don't provide a way for the application to signal that it's repainting the display, so there's a good chance that the the terminal will repaint its display halfway through, and then again once the application update has finished, leading to distracting flickering.

The most portable approach to this problem is to just ensure repaints are as concise as possible, but since there's no guaranteed maximum atomic size, and since repaints can be arbitrarily large, this is not a solution.

iTerm2 supports a synchronised update control sequence. The linked specification has more details, but it basically amounts to:

  • send ESC P = 1 s ESC \ when a repaint begins
  • send ESC P = 2 s ESC \ when a repaint ends

Currently, iTerm2 is the only terminal to support this feature, other terminals should ignore it without incident. In that respect, it's like the "enable focus in/out events" sequence Kakoune already uses.

According to tmux's maintainer, tmux only sends these sequences to the outer terminal and does not implement them for the inner terminal, "but I will do that as soon as there are some programs apart from tmux that use it..."

created time in 2 months

issue commentmawww/kakoune

Middle click paste

Personally, I've found I hold down Shift whenever I select or paste text in the terminal, whether I'm in an editor or just at the shell prompt.

pickfire

comment created time in 2 months

issue commentmawww/kakoune

Kakoune bindings outside kakoune

Now that #3394 is fixed, if you know the name of the Kakoune session you're using, you can pipe things to a new kak client of that session, so that the copy/paste register will be shared. For example, if you start a Kakoune session named "foo":

kak -s foo

...you can pipe data into a fresh scratch buffer in the same session:

echo whatever | kak -c foo

For something a bit more polished, a plugin like kakoune-connect sets things up so when you spawn a new terminal from inside Kakoune, any editing you do from inside that terminal will automatically connect back to the Kakoune session that spawned it.

jjzmajic

comment created time in 2 months

issue commentmintty/mintty

mintty env vars or esc seqs to return version or startup command line

In all cases they will expect characters to take up one character cell.

Clearly sometimes they expect characters to take up two character cells, or that wouldn't be an option. I suspect we don't hear about them much because we're all using Latin-alphabet languages, but people who have to work with CJK systems regularly probably have a different experience.

In practice, I imagine most apps will wind up doing something like this:

if (term.utf8_supported == true && term.ambiguous_width == 1) {
    draw_unicode_borders()
} else {
    draw_ascii_borders()
}

I don't think it's worth adding a special case for terminals where ACS is always narrow. Of the terminals I have handy:

  • Terminology, st, QTerminal, urxvt don't seem to offer an ambiguous-width option
  • xterm and VTE can make ambiguous-width characters wide, and ACS characters are wide too
  • PTerm (the POSIX port of PuTTY) does keep ACS characters narrow... but only if I explicitly enable ACS-in-UTF-8 mode, which isn't the default
BrianInglis

comment created time in 2 months

issue commentmintty/mintty

mintty env vars or esc seqs to return version or startup command line

Apps that care can use the DEC Special Character and Line Drawing Set G0, which is already widely supported by terminal emulators.

Widely, but not universally.

According to ncurses(3X)#NCURSES_NO_UTF8_ACS, in a UTF-8 locale the Linux terminal and GNU Screen ignore character-set-switching sequences. Specifically, executing this command:

printf '\e(0nnn\e(B\n'

...on my Linux console prints nnn, but my VTE-based terminal prints ┼┼┼. As an additional data point, luit(1) (which some terminals may invoke to handle the ISO 2022 heavy lifting) will strip character-set-switching codes without interpreting them, when using UTF-8:

$ printf '\e(0nnn\e(B\n' | luit -c -encoding "UTF-8" | hexdump -C
00000000  6e 6e 6e 0a                                       |nnn.|
00000004

When using a non-UTF-8 locale, ACS codes are converted to the corresponding Unicode characters:

$ printf '\e(0nnn\e(B\n' | luit -c -encoding "ISO 8859-1" | hexdump -C
00000000  e2 94 bc e2 94 bc e2 94  bc 0a                    |..........|
0000000a

Even terminals that do support character-set-switching in UTF-8 mode do not always treat ACS characters as narrow. For example, here's the same command run in GNOME Terminal with "Ambiguous-width characters" set to "Narrow" and "Wide":

image

If you run xterm -cjk_width to make it treat ambiguous characters as wide, it still treats them as wide if they're sent via ACS (although it may look weird if the font doesn't provide full-width glyphs):

image

So "Use ACS mode to avoid the problem of ambiguous-width characters" is not reliable advice. Instead, terminals must advertise how they'll render ambiguous-width characters, and applications need to adapt.

BrianInglis

comment created time in 2 months

issue commentmintty/mintty

mintty env vars or esc seqs to return version or startup command line

What's wrong with this statement: If $LANG ends in .UTF-8 then you can expect UTF-8 to work reasonably well, unless TERM=linux.

If $LANG ends in .UTF-8, then UTF-8 works reasonably well even if TERM=linux. That is, multi-byte UTF-8 characters are drawn as single cells, whether or not the active font has a glyph for them.

Also, UTF-8 can still work reasonably well if $LANG does not end in .UTF-8. For example, some people set LANG=C to avoid locale-dependent sorting, but their terminals are still configured to interpret UTF-8. Some platforms support a C.UTF-8 locale for this purpose, but I don't think it's widespread.

Are there still terminals that don't support 256 colors that would conceivably support this spec? I'd like to remove that flag if so.

The only quirk I can think of is that Konsole/QTerminal supports 256 colours, but does not support modifying the palette. That's covered by terminfo (the initc capabilty) but of course everybody sets TERM=xterm-256color and gets frustrated when colour-changing doesn't work. That said, the main reason for changing the palette is to support displaying arbitrary colours, and direct-colour (which QTerminal does support) is a much better way to solve that particular problem.

I recommend: the spec should assume read-only 256-color support, should not assume palette modification support, and recommend people use direct-colour mode instead of palette modification.

BrianInglis

comment created time in 2 months

issue commentmintty/mintty

mintty env vars or esc seqs to return version or startup command line

Is this replying to me?

My apologies, that was directed at @textshell. A basic "parses UTF-8" capability is definitely useful, even without worrying about supported codepoints.

BrianInglis

comment created time in 2 months

issue commentmintty/mintty

mintty env vars or esc seqs to return version or startup command line

Look at it from the other direction: let's say I'm an application author, I have a particular Unicode glyph I want to display, and the terminal does not report EXTENDED_CHARSET; how do I know whether it's safe to use? If the application sends a glyph to the terminal, and the terminal can't display it, which one do I file a bug against?

Can you sync us up on the concrete concerns wrt linedrawing and EA ambiguous widths? That sounds quite problematic.

Unicode was originally intended to allocate a single codepoint to every glyph, independent of how it was drawn in any particular font.

It turns out that Western computers and East Asian computers both happened to support box-drawing characters, because it's a pretty natural thing to add to a character-cell display. Because of the "single codepoint per glyph" thing, Western box-drawing characters and East Asian box-drawing characters share the same codepoints in Unicode.

Unfortunately, Western character cells are generally half as wide as East Asian character cells, so Western computers render box-drawing characters as "half width" like all Western text, while East Asian computers render box-drawing characters as "full width" like all East Asian text. In this modern age when a single computer is expected to handle Western and East Asian text side-by-side, what should a terminal do when it receives U+2500 BOX DRAWINGS LIGHT HORIZONTAL? Should it draw it as half-width or full-width?

Most terminals provide a setting in the UI to switch between modes, but since few people actually interact with both Western and East Asian apps on a regular basis, messing with this option tends to just break things in a really confusing way.

I'm not sure why drawing borders in ACS mode always draws them as half-width; possibly the user's terminal happened to special-case ACS as "always draw manually, don't depend on the font".

Why not change the model from TERM-based capability broadcast to pure introspection

Because negotiating with terminals is really, really slow, and has some really annoying failure modes (like terminal responses being typed as shell commands). Browsers don't have this problem because browsers have a dedicated, delimited communications channel between the app and the browser (JavaScript) that's separate from the channel between the app and the user (HTML).

BrianInglis

comment created time in 2 months

more