Dmitry Maluka [Wed, 18 Aug 2021 19:35:49 +0000 (21:35 +0200)]
plugins.md: update link to the internal documentation (#2191)
godoc.org now redirects to pkg.go.dev and it's not obvious how to locate
the internal packages documentation at https://pkg.go.dev/github.com/zyedidia/micro
AAAA [Sat, 7 Aug 2021 00:37:42 +0000 (19:37 -0500)]
Update v.yaml (#1925)
Improvements:
- Use proper scope names for better colorization
- Better regex to detect binary, octal, decimal and hexadecimal numbers
- Extend some definitions based on the Vlang docs
* match literal dots instead of any char (match rc.conf but not rcXconf)
* match special filenames exactly (match PKGBUILD but not myPKGBUILD.something)
Run build-all to update internal/config/runtime.go
Highlight character literals started with a single quote (').
Importantly this ensures correct highlighting for the character literal '"'.
Limitation: rust char literals contain exactly one character, however this isn't checked by the highlighter.
Dmitry Maluka [Wed, 9 Jun 2021 21:04:11 +0000 (23:04 +0200)]
find: select prefilled text (#2127)
The new feature of prefilling the search bar with the selected text (added
in 3d0b5db) has an annoying side effect: if we do have some text selected
but we want to search for some other pattern, not the selected text,
then we have to manually delete the prefilled text before we can start
entering our wanted search pattern.
A simple solution is to select the prefilled text, so that we can replace it
with our pattern right away just by typing, without any additional keystrokes.
BufView returns not only the buffer's width and height but also its
x,y position. It may be useful e.g. for checking if a mouse click was
on the actual buffer or ourside it, e.g. on the gutter.
Dmitry Maluka [Wed, 17 Mar 2021 22:25:15 +0000 (23:25 +0100)]
Don't highlight padding spaces in word wrapping
Don't highlight space characters at the right edge which are used just
for padding after line break in word wrapping, i.e. don't correspond to
any real characters in the buffer.
This makes it look nicer e.g. when selecting word-wrapped text.
Dmitry Maluka [Sat, 6 Mar 2021 22:43:36 +0000 (23:43 +0100)]
Implement moving cursor up/down within a wrapped line
Modified behavior of CursorUp, CursorDown, CursorPageUp etc:
if softwrap is enabled, cursor moves by visual lines, not logical lines.
TODO: implement it also for Home and End keys: move cursor to the
visual start or end of a line. I haven't implemented it for now, because
I'm not sure what should be the behavior of StartOfTextToggle then
(considering that Home key is bound to StartOfTextToggle by default).
Dmitry Maluka [Wed, 17 Mar 2021 20:16:52 +0000 (21:16 +0100)]
Add VLoc, VLocFromLoc and LocFromVLoc
VLoc allows any location in the buffer to be represented as a visual
location in the linewrapped buffer. In particular, this is useful
for implementing moving cursor up and down within a wrapped line.
Dmitry Maluka [Sat, 27 Feb 2021 16:37:15 +0000 (17:37 +0100)]
Add BufWidth and BufHeight
Fixes issue with the usage of a slightly incorrect buffer height value
(v.Height should be v.Height-1 if statusline is displayed).
Also, to avoid too many duplications, the code reorganized a little:
buffer display params (width, height, gutter offset and others) are
calculated in a single place.
Softwrap implementation enhanced to fix various issues with scrolling,
centering, relocating etc.
The main idea is simple: work not with simple line numbers but
with (Line, Row) pairs, where Line is a line number in the buffer
and Row is a visual line (a row) number within this line.
The logic remains mostly the same, but simple arithmetic operations
on line numbers are replaced with corresponding operations on
(Line, Row) pairs.
Dmitry Maluka [Wed, 6 Jan 2021 00:37:49 +0000 (01:37 +0100)]
Fix non-working TryBindKey and UnbindKey (#1970)
Fixed regression: since merging keybindings branch, TryBindKey and
UnbindKey and accordingly "bind" and "unbind" commands don't work
(fail to unmarshal bindings.json).
This is just a quick fixup to make TryBindKey and UnbindKey work again.
They still work with "buffer" bindings only.
worldmaker [Sun, 27 Dec 2020 23:38:16 +0000 (07:38 +0800)]
fix the missing break in JumpToMatchingBrace (#1960)
In JumpToMatchingBrace, the loop should stop immediately after finding the matching bracket.
It causes multiple jumps in certain situations:
`(I [ ]{ }) => ( I[ ]{ })`
Fix the regression after 3b34a02: setting readonly option to true
in onBufferOpen lua callback doesn't work, since it is automatically
reset to false if write permission is not denied.