2942 Commits

Author SHA1 Message Date
Mitchell Hashimoto
f9962a04ef recomment line 2023-09-29 20:01:26 -07:00
Mitchell Hashimoto
ecb1d19890 input: fix regression with ascii mapping to a keypad key 2023-09-29 20:00:50 -07:00
Mitchell Hashimoto
d90aba20fe Merge pull request #592 from mitchellh/gtk-desktop
apprt/gtk: default working-directory to home if launched from desktop
2023-09-29 16:03:20 -07:00
Mitchell Hashimoto
d03083c7f5 apprt/gtk: default working-directory to home if launched from desktop
Fixes #573
2023-09-29 15:52:45 -07:00
Mitchell Hashimoto
e12cc5f831 Merge pull request #591 from nfisher1226/desktop_categories
Add Categories entry to .desktop file so Linux desktops have a better
2023-09-29 15:30:28 -07:00
Nathan Fisher
865b43cd4d Add Categories entry to .desktop file so Linux desktops have a better
chance of placing the menu entry into an appropriate category
2023-09-29 18:24:48 -04:00
Mitchell Hashimoto
53a31da4a3 Merge pull request #589 from moderation/main
vendor: update harfbuzz
2023-09-29 15:20:58 -07:00
Mitchell Hashimoto
4de658aa2d Merge pull request #590 from rockorager/clear-sel
selection: only clear when keypress has utf8
2023-09-29 15:17:48 -07:00
Tim Culverhouse
488e6670c2 selection: only clear when keypress has utf8
Currently, the selection on a surface is cleared on any keypress that
generates a control sequence. For applications that enable kitty, this
can mean that every keypress clears the current selection thereby making
it impossible to copy text, since it will be cleared as soon as Control
is pressed. This can be very confusing to terminal users: some
applications I can shift+highlight and copy+paste, some I can't - and
unless I know the implementation of the application I won't know
why...very frustrating.

Only clear the selection when there is printable text, otherwise retain
the selection. From my testing, this makes text selection feel the same
between applications using kitty keyboard and applications that don't.
2023-09-29 16:07:21 -05:00
moderation
0df2d78093 vendor: update harfbuzz.
Signed-off-by: moderation <michael@sooper.org>
2023-09-29 14:05:42 -07:00
Mitchell Hashimoto
3bfcb010ef Merge pull request #588 from mitchellh/corrupt-lang
os: we need to copy the old lang pointer before we unsetenv
2023-09-29 13:20:31 -07:00
Mitchell Hashimoto
d878d16779 os: unset lang completely setlocale fails 2023-09-29 13:11:07 -07:00
Mitchell Hashimoto
38a7c2270b os: we need to copy the old lang pointer before we unsetenv 2023-09-29 12:56:43 -07:00
Mitchell Hashimoto
071a53bb33 Merge pull request #585 from mikdusan/fullscreen
macos: adjust fullscreen frame height for notch
2023-09-29 12:06:52 -07:00
Mitchell Hashimoto
f386f12e8a macos: safeAreaInsets.top includes menu 2023-09-29 12:05:24 -07:00
Michael Dusan
1f30e4e2ed macos: adjust fullscreen frame height for notch
The macOS desktop menu-bar grows in total height by adding extra padding
to deal with the physical notch found on various MacBook displays.

When config `macos-non-native-fullscreen = visible-menu` we apply
`safeAreaInsets.top` to reduce frame height.
2023-09-29 12:00:11 -07:00
Mitchell Hashimoto
1f5518cd83 Merge pull request #587 from mitchellh/patrickf/document-font-config
Improve docs on font configuration
2023-09-29 11:57:44 -07:00
Mitchell Hashimoto
7bbe669641 Merge pull request #578 from rockorager/dev
Kitty keyboard improvements
2023-09-29 11:56:34 -07:00
Mitchell Hashimoto
a2e2889f2b input: make Key ascii functions comptime-generated 2023-09-29 11:54:05 -07:00
Patrick Fong
741606a7ab fix grammar 2023-09-29 11:44:32 -07:00
Patrick Fong
d832507644 improve docs on font config 2023-09-29 11:42:49 -07:00
Mitchell Hashimoto
12f355ebe0 Merge branch 'esc-utf8' 2023-09-29 08:39:01 -07:00
Mitchell Hashimoto
a8aef28a02 Merge pull request #581 from mitchellh/curtbushko/initial-windows-build
Inital windows CI support
2023-09-29 08:37:48 -07:00
Tim Culverhouse
11cb6824cd input: don't ESC prefix non-ascii characters
User input withe Alt modifier is typically ESC prefixed. Escape
prefixing a non-ascii character can cause bugs in some applications. For
example in bash, emitting an Alt+ф allows the user to backspace one
character into the prompt. This can be repeated multiple times.

When a character is outside the ASCII range (exclusive of 0x7F, this is
handled as a control sequence), print the character as is, with no
prefix.
2023-09-29 08:35:21 -07:00
Curt Bushko
71d14f5dff create script and dump logs 2023-09-29 10:41:28 -04:00
Tim Culverhouse
fb649e689d input(kitty): fix reporting of alternate keys
Fix reporting of alternate keys when using the kitty protocol. Alternate
keyboard layouts were failing to report the "base layout" key. This
implementation now matches kitty's output 1:1, and has some added unit
tests for cyrillic characters.

This also fixes a bug where a caps_lock modified key would report the
shifted key as well. The protocol explicitly requires that shifted keys
are only reported if the shift modifier is true.
2023-09-29 06:37:08 -05:00
Tim Culverhouse
4f2d67d8f3 gtk(input): fix value used for lowercase lower_unicode
When converting keyval to the unshifted version, gdk_keyval_to_lower
returns a keyval type, not a unicode value. Convert this to unicode
before assigning to keyval_unicode_unshifted.

This fixes a bug where the incorrect keycode is sent in alternate
layouts with kitty keyboard on linux.
2023-09-29 06:36:03 -05:00
Mitchell Hashimoto
3ef67fe025 Merge pull request #580 from mitchellh/scroll-offset-mess
terminal: scroll region scroll up copied the wrong length of data under the right circumstance
2023-09-28 21:54:28 -07:00
Curt Bushko
54bbcd875a run prettier 2023-09-29 00:54:19 -04:00
Curt Bushko
837afab98f inital windows build support 2023-09-29 00:43:01 -04:00
Mitchell Hashimoto
6fd082ed63 terminal: scroll region scroll up copied the wrong length of data
Fixes #315

This function has various cases that can be hit depending on the state
of the underlying circular buffer. It is a very well tested function but
this particular branch wasn't tested and unsurprisingly turns out there
is a bug in it.

Consider the following circular buffer state representing a terminal
screen with 1 column, 5 rows. Assume the circular buffer representing
this screen is such that `head == tail` and `head = 4` (zero-indexed,
full buffer size is 5). The head and tail are shown with an arrow below.

┌───────────────────────────────────────────────────────────────┐
│                               B                               │
├───────────────────────────────────────────────────────────────┤
│                               C                               │
├───────────────────────────────────────────────────────────────┤
│                               D                               │
├───────────────────────────────────────────────────────────────┤
│                               E                               │
├───────────────────────────────────────────────────────────────┤ ◀───  Head
│                               A                               │       Tail
└───────────────────────────────────────────────────────────────┘

The screen contents are "A B C D E" with each character on a new line.

Next, we set a scroll region from y=0 to y=3 (len=4). The scroll region
contents are "A B C D". Next, we issue a "delete lines" command with
n=2 (`CSI 2 M`) while the cursor is at the top-left corner. The delete
lines command deletes the given number of lines (n=2 in this case) and
shifts the remaining lines up. It does this only within the context
of the scroll region. Therefore, for `CSI 2 M` we would expect our
screen to become "C D _ _ E" (A, B are deleted, C, D shift up, and
E is untouched because its outside of the scroll region).

When executing this operation, we request the memory regions containing
the scroll region. This results in two pointers and lengths. For our
circular buffer state, we get the following:

┌───────────────────────────────────────────────────────────────┐ ◀──── ptr0
│                               A                               │
└───────────────────────────────────────────────────────────────┘

┌───────────────────────────────────────────────────────────────┐ ◀──── ptr1
│                               B                               │
├───────────────────────────────────────────────────────────────┤
│                               C                               │
├───────────────────────────────────────────────────────────────┤
│                               D                               │
└───────────────────────────────────────────────────────────────┘

We get two pointers because our circular buffer wraps around the bottom.
The diagram above shows them in top/bottom order not in memory order
(The value of `ptr0 > ptr1` but it doesn't matter for the bug).

The way the math works is as follows:

  1. We calculate the number of lines we need to shift up. That
     value is `height - n`. Our height is 4 (scroll region height) and
     our n is 2 (`CSI 2 M`), so we know we're shifting up 2 lines.
     Let's call this `shift_lines`.

  2. Our start copy offset is `n` because the lines we are retaining
     are exactly after the `n` we're deleting (i.e. we're deleting 2
     lines so the start of the lines we're shifting up is the 3rd line).
     Let's call this `start_offset`.

  3. We realize that our start offset is greater than the size of ptr0,
     so we must be copy from ptr1 into ptr0. Further, we know our start
     offset into ptr1 must be `start_offset - ptr0.len`.
     Let's call this `start_offset_ptr1 = 1`.

  4. Copy `ptr1[start_offset_ptr1]` to `ptr0`. We copy up to
     `shift_lines` amount. `shift_lines` is 2 but `ptr0.len` is only
     `1`. So, we actually copy `@min(shift_lines, ptr0.len)` and have
     `1` line remaining.
     Let's call that `remaining = 1`.

  5. Copy `remaining` from `ptr1[ptr0.len]` to `ptr1`.

  6. Next we need to zero our remaining lines. Our slices only contain
     our scroll region so we know we can zero the memory from
     `ptr1[remaining]` to the end of `ptr1`. We know this because step 5
     only copied `remaining` bytes.

The end result looks like this:

┌───────────────────────────────────────────────────────────────┐ ◀──── ptr[0]
│                               C                               │
└───────────────────────────────────────────────────────────────┘

┌───────────────────────────────────────────────────────────────┐ ◀──── ptr[1]
│                               D                               │
├───────────────────────────────────────────────────────────────┤
│                                                               │
├───────────────────────────────────────────────────────────────┤
│                                                               │
└───────────────────────────────────────────────────────────────┘

The bug was in step 6. We were incorrectly zeroing from `start_offset_ptr1`
instead of `remaining`. This was just a simple typo. The results are
devastating, but only under the exactly correct circumstances (those
in this commit message). In that scenario, the bug produced the
following:

┌───────────────────────────────────────────────────────────────┐ ◀────────── ptr[0]
│                               C                               │
└───────────────────────────────────────────────────────────────┘

┌───────────────────────────────────────────────────────────────┐ ◀────────── ptr[1]
│                               D                               │
├───────────────────────────────────────────────────────────────┤
│                               C                               │
├───────────────────────────────────────────────────────────────┤
│                                                               │
└───────────────────────────────────────────────────────────────┘

Notice the incorrect "C" that remains and is not zeroed.

This example showed a scenario with 1 column and leaving only 1 line out
of the scroll region. The real bug in #315 would often mistakingly leave
multiple lines in the scroll region. The effect was that scrolling
produced garbage lines because you'd "scroll" and part of what should've
scrolled would remain.

This garbage state was only in the terminal screen state, so it didn't
impact actual programs running or their data (i.e. vim). But, it made
the program unusable.
2023-09-28 21:10:37 -07:00
Mitchell Hashimoto
7c440dea5e update zig 2023-09-28 15:30:51 -07:00
Nathan Youngman
73331887fe fabs builtin was renamed
https://github.com/ziglang/zig/pull/17248

I just tried installing from source and ran into the error:

> error: invalid builtin function: '@fabs'
2023-09-28 15:29:08 -07:00
Mitchell Hashimoto
145017915e Merge pull request #579 from mitchellh/prettier-nix
nix: install prettier, also ignore zig-cache/out
2023-09-28 15:23:29 -07:00
Mitchell Hashimoto
779611c04b nix: install prettier, also ignore zig-cache/out 2023-09-28 15:16:12 -07:00
Mitchell Hashimoto
a0a8901d8b Merge pull request #577 from mitchellh/patrickf/lint-markdown
Introduce Prettier and lint entire repo
2023-09-28 15:04:03 -07:00
Patrick Fong
caf134401f don't lint macos/, undo macos/ changes 2023-09-28 11:53:31 -07:00
Patrick Fong
8eb042968c undo changes to vendor 2023-09-28 11:22:28 -07:00
Patrick Fong
4f6401e815 update linting doc 2023-09-28 11:20:48 -07:00
Patrick Fong
6bceea898b update linting doc 2023-09-28 11:18:58 -07:00
Patrick Fong
3c44c08ffd add linting doc 2023-09-28 11:14:31 -07:00
Patrick Fong
09bafd753a ignore some other stuff 2023-09-28 11:06:04 -07:00
Patrick Fong
c2ec3f75ad lint JSON and Typescript as well 2023-09-28 11:05:54 -07:00
Patrick Fong
1cb6b50331 add Prettier step to check formatting 2023-09-28 10:56:53 -07:00
Patrick Fong
9d2a85d9cd lint all Yaml files 2023-09-28 10:42:38 -07:00
Patrick Fong
8be80558c7 lint all Md files 2023-09-28 10:27:15 -07:00
Mitchell Hashimoto
28b7782bbe core: do not scroll viewport if mouse reporting is requested
Fixes #570
2023-09-28 09:50:44 -07:00
Mitchell Hashimoto
c987ce785b Merge pull request #576 from mitchellh/gtk-wide
apprt/gtk: make wide-style gtk tabs configurable
2023-09-28 08:56:11 -07:00
Mitchell Hashimoto
685495c896 apprt/gtk: make wide-style gtk tabs configurable 2023-09-28 08:54:15 -07:00
Mitchell Hashimoto
16f5af8b32 macos: relable tabs when config is reloaded 2023-09-28 08:36:02 -07:00