gogongxt
56f276580f
Fix hints kitten breaking multi-byte UTF-8 characters when overlaying hint labels
...
In highlight_mark(), mark_text was sliced using byte-based indexing
(mark_text[:len(hint)] and mark_text[len(hint):]). Since len(hint)
equals the rune count (hint is always ASCII), but len(mark_text) is a
byte count, this could slice in the middle of a multi-byte UTF-8
sequence (e.g. CJK characters), producing an invalid byte sequence
rendered as the Unicode replacement character (�).
Fix by converting mark_text to []rune first, then slicing at rune
boundaries. The hint is ASCII so len(hint) == rune count, requiring
no conversion on the hint side.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-13 17:09:42 +08:00
Kevin Lui
be7a010b9c
hints: Fix trailing punctuation being included in detected URLs
2026-04-07 22:57:36 -07:00
Jack Duvall
c48111d92c
Highlight full extent of hint matches, not just the prefix label
...
Add --hints-text-background-color option (default: auto) that can apply
a background color to the matched text after the hint label. This makes
it more clear exactly which text each hint covers.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 11:23:30 -04:00
Carl Lei
505a0e15cd
kitten/hints/marks support for IPv6 addresses ending in ::
...
IPv6 addresses can end in zeros, and for example ifconfig.me is at
2600:1901:0:b2bd::.
2025-11-27 09:34:12 +08:00
Kovid Goyal
37da04aad6
choose files: Add default mappings to choose a file and insert it into the terminal
2025-11-23 11:41:21 +05:30
Kovid Goyal
6f588a0c29
run modernize
2025-11-11 17:09:37 +05:30
alex-huff
a1e63ee87c
hints: make default regex ignore trailing whitespace
2025-09-28 11:54:44 -05:00
Kovid Goyal
7ff25fd77c
Add an extra linenum-action so that the callback can use remote control without needing to turn it on globally
2025-08-29 17:13:56 +05:30
Kovid Goyal
5faa7bda5d
hints kitten: Preserve line breaks when the hint is over a line break
...
Fixes #8674
2025-05-24 14:09:27 +05:30
Kovid Goyal
8e720cc1da
...
2025-05-24 13:25:22 +05:30
Kovid Goyal
54395da696
...
2025-05-24 09:23:05 +05:30
Kovid Goyal
c861259e3b
Rename go module from kitty -> github.com/kovidgoyal/kitty
...
Makes the code more easily re-useable in other projects
2025-05-16 08:43:39 +05:30
Kovid Goyal
d548a6fcf4
rename typing module to avoid conflicts with stdlib typing
2025-04-28 09:20:10 +05:30
Kovid Goyal
96d5c9c7c6
A new option to clear selections when they no longer reflect the contents of the clipboard
2025-03-12 11:41:27 +05:30
Kovid Goyal
da1626090a
Update codebase to Python 3.10 using pyupgrade
2025-02-03 10:56:50 +05:30
Kovid Goyal
8931062a70
hints kitten: Workaround for some broken light color themes that make the hints text color too low contrast to read
...
Fixes #7330
2025-01-17 20:22:10 +05:30
Kovid Goyal
2d02ff1c5f
Implement using effective kitty config options for kittens
...
Also centralise reading of kitty options
2025-01-05 20:16:43 +05:30
Kovid Goyal
9d48fa9126
hints/unicode_input kittens: Do not lose keypresses that are sent very rapidly via an automation tool immediately after the kitten is launched
...
We now buffer the key events until the kitten tells us it is ready.
Without this the key presses are delivered to the underlying window
as the kitten's overlay window was not being focused until the kitten
set the ready message.
Fixes #7089
2024-12-12 13:11:12 +05:30
Kovid Goyal
405f5ce148
Use stdlib maps/slices
2024-06-24 07:54:13 +05:30
Kovid Goyal
8c1e365eb5
hints kitten: Allow clicking on matched text to select it in addition to typing the hint
2024-05-14 15:22:03 +05:30
Kovid Goyal
5e125c35d1
hints kitten: Report the pattern used when no matches are found
2024-04-20 05:14:03 +05:30
Kovid Goyal
c3c99113c7
hints kitten: Use default editor rather than hardcoding vim to open file at specific line
...
Fixes #7186
2024-03-04 21:49:06 +05:30
Kovid Goyal
a5f3142514
hints kitten: The option to set the text color for hints now allows arbitrary colors
...
Fixes #7150
2024-02-25 10:02:38 +05:30
Kovid Goyal
bc3c9ce2fa
Fix #7100
2024-02-05 20:48:49 +05:30
Kovid Goyal
9bea8bb5bc
remove no longer needed code
2024-02-05 13:54:22 +05:30
Kovid Goyal
8cc2cad4d9
Use list of legal chars in URL from the WHATWG standard
...
Notably this excludes some ASCII chars: <>{}[]`|
See https://url.spec.whatwg.org/#url-code-points
Fixes #7095
2024-02-05 13:27:22 +05:30
Kovid Goyal
77292a16d6
Make shebangs consistent
...
Follow PEP 0394 and use /usr/bin/env python so that the python in the
users venv is respected. Not that the kitty python files are meant to be
executed standalone anyway, but, whatever.
Fixes #6810
2023-11-11 08:32:05 +05:30
Kovid Goyal
dc6edf9191
Improve the docs for how to match multi-line hints
...
See #6692
2023-10-17 15:23:58 +05:30
Kovid Goyal
70a588cb36
...
2023-10-17 15:23:43 +05:30
Kovid Goyal
0a2f164062
Change kitty +kitten -> kitten in docs
...
All kittens except for the broadcast and panel kittens have now been
ported to Go and so can be run with just kitten rather than kitty
+kitten. So update the docs to use this canonical form for launching
kittens
2023-09-21 12:25:02 +05:30
Kovid Goyal
4f72bb9894
Replace utils.Once with stdlib sync.OnceValue
2023-08-09 12:08:42 +05:30
Kovid Goyal
49ea26968c
Bump go version to 1.21
...
Allows us to use the much faster builtin min/max functions
for two variable min/max
2023-08-09 11:58:16 +05:30
Kovid Goyal
8670ede032
DRYer
2023-06-29 07:39:42 +05:30
Kovid Goyal
da1276d84a
Correct the naming of the window arg to call_remote_control
2023-06-10 09:47:37 +05:30
Kovid Goyal
0873e3ea09
...
2023-05-31 07:22:49 +05:30
Kovid Goyal
9bbb2a9ef4
Fix #6315
2023-05-31 07:08:55 +05:30
Kovid Goyal
e59e42a6c2
simplify API of utils.Once
2023-05-26 22:42:07 +05:30
Kovid Goyal
c101a6acb0
Implement a dedicated function for word matching rather than relying on a regex and being at the mercy of the vagaries of regex implementations
2023-05-12 15:43:56 +05:30
Kovid Goyal
65f8bb7397
hints kitten: Switch to using a regex engine that supports lookaround
...
Note that we loose unicode char matching for --type=word because of
https://github.com/dlclark/regexp2/issues/65 and of course user regexps
cant use \p{N} escapes any more. Hopefully regexp2 will add support for
these soon-ish. IMO lookaround is more important than \p.
Fixes #6265
2023-05-12 12:24:59 +05:30
Kovid Goyal
1fc4e53bea
hints kitten: Fix a regression in 0.28.0 that broke using sub-groups in regexp captures
...
Fixes #6228
2023-04-30 21:16:24 +05:30
Kovid Goyal
7b6d11fd1e
Fix rendering of :doc: links with explicit titles in help text in the terminal
2023-04-26 16:46:20 +05:30
Kovid Goyal
bb33c66570
Fix #6213
2023-04-26 16:38:25 +05:30
Kovid Goyal
e095a2ab43
Fix #6142
2023-03-28 21:06:39 +05:30
Kovid Goyal
ff55121094
Move the kittens Go code into the kittens folder
2023-03-27 13:06:02 +05:30
Kovid Goyal
e4611d0c81
...
2023-03-17 09:02:58 +05:30
Kovid Goyal
b76b0c61ed
Port custom processor for hints
2023-03-10 10:45:37 +05:30
Kovid Goyal
69916ca4e8
Remove python implementation of hints
2023-03-10 07:16:25 +05:30
Kovid Goyal
5b3f5dd02d
Port all remaining hints matching tests
2023-03-09 20:53:46 +05:30
Kovid Goyal
0e5ed29d83
Fix generation of url regex for Go
2023-03-09 19:00:56 +05:30
Kovid Goyal
09ceb3c0be
Start work on porting hints kitten to Go
2023-03-09 19:00:56 +05:30