| Age | Commit message (Collapse) | Author | Files | Lines |
|
|
|
Previously this was done implicitly through the primary cursor
which was always adjusted when a new cursor is being created.
However, this is no longer the case and we do not want to iterate
through all cursors when creating a new one.
In the longterm we might want to store cursors in a contiguous
memory location (i.e. an array) instead of chaising pointers
all over the place.
|
|
We currently have the invariant that the primary cursor is always
placed within the visisble viewport.
Previously view_cursors_new would automatically make the new cursor
primary. This in turn causes the viewport to be adjusted triggering
lots of unnecessary redraws. As a result commands creating many new
selections might become unbearably slow.
Instead the caller has to explicitly make the new cursor primary.
|
|
Can be NULL if no cursor is associated with the given selection (this is
currently never the case).
Avoids a loop through all cursors when clearing selections.
|
|
<Enter> at the end of the file now inserts two newlines, unless there is
already one in place. This ensures that in 'normal' operation the file
is always new line terminated (as mandated by POSIX). It also means that
there is no problem displaying the right amount of ~ symbols at the end
of the file.
Unlike in vim the cell beyond the end of the file remains adressable
even in normal mode. This means something like the following (starting
from an empty file) might be a little confusing:
o<Escape><Left>dd
Because the starting position is beyond the last newline of the file,
nothing will be deleted.
For now we prefer to avoid the additional complexity, and difference
in behavior between normal and insert mode, needed to fix this slight
inconsistency.
Fix #294
|
|
|
|
Previously repeatedly pressing <Ctrl-j> at the start of the file
would keep creating cursors.
|
|
A cursor does not necessarily have to be at a selection boundary
(e.g. in visual line mode) but it has to be within the selection.
|
|
At least one cursor (referred to as primary or main cursor) has always
to exist. In the sam command language implementation we might want to
dispose a cursor even if it is the primary one before later commands
will create different ones (e.g. `:x/pattern/ { i/>>>/ a/<<</ }`).
This commit introduces view_cursors_dispose_force. If called on
the last remaining cursor, its selection is cleared and it is marked for
destruction as soon as a new cursor is created. view_cursor_disposed
returns the cursor marked for deletion (if any) and clears the descruction
flag.
|
|
The idea might be good, but it was almost unused.
|
|
Reject invalid cursor positions.
|
|
Make sure that the view_cursors_scroll_to function does not enter
an infinite loop.
|
|
While the replacement symbols are still not run-time configurable,
the new defaults should hopefully please more people.
Close #401
|
|
Make cursor placement after scrolling (half) pages up/down less arbitrary.
Close #390, fix #391
|
|
Previously the cursor would be placed in the middle of
the screen thus causing a distracting jump. Instead try
to scroll the view port by only 1 line when the cursor
is moved out of the visible area.
The current implementation might be quite a bit slower
than before, use page-wise scrolling to skip large
regions.
At some point we should optimize motions like 1000j.
Close #301
|
|
If a cursor is not currently visible it has no associated screen line.
Fallback to the corresponding logical line based variant. For example
`gj` is interpreted as `j`.
Fixes #354
|
|
This is a not yet successful attempt to reduce terminal flickering
when resizing windows as is for example the case when entering
command mode.
UI related debug output can be enabled with:
$ make CFLAGS=-DDEBUG_UI=1
$ ./vis > log
|
|
Make window status bar content configurable via Lua.
|
|
|
|
|
|
|
|
|
|
A cursor is a mark, if the text containing the mark is removed the
cursor is lost. In this case we try to fall back to the previously
known cursor position/mark. This should improve undo operations
for filter commands.
|
|
As a consequence the general cursor placement code takes effect and
always places the cursor in the middle of the window when moving out
of the viewable range.
Whether this behavior is desirable remains to be seen.
|
|
|
|
This changes which viewport is being displayed after the primary
cursor moves out of the currently viewable area.
Close #164, #274, #278
|
|
Close #216
|
|
This should fix inconsistency in the Lua API.
|
|
Can be used to specify the number of bytes before the visible area
to consider for syntax highlighting.
Defaults to 32K for now, whereas before it was 16K.
|
|
|
|
|
|
|
|
To create a cursor even if there already exists one at the same
position. Should only be used if all but one of the cursors will
later be removed.
|
|
If there exist multiple cursors, [n/m] is added to the status bar.
Meaning the n-th cursor out of the existing m cursors is currently
the primary one.
|
|
Do not crash if for some reason view->{start,end} have outdated values.
|
|
indicating whether cursor could be removed
|
|
|
|
We place the end mark inside the selection as opposted to on the character
immediately following it. This is better when selections are touching each
other. Previously for two seletions [a][b] the end mark for selection
a would be at the same location as the start mark of selection b. Thus
when for example the content of selection b is deleted it would also
destroy selection a, because the end mark would no longer be valid.
|
|
|
|
Fail if there is already a cursor located at the requested position.
|
|
The number of columns i.e. maximal number of cursors located on the
same line can be obtained by view_cursors_column_count.
Column addressing is zero based, valid indexes are [0, max-1].
Assuming there is a cursor on every letter:
a
b c
d e f
g h
i
max column would be 3, and the following would iterate over the
cursors forming the second column [c, e, h]:
for (Cursor *c = view_cursors_column(view, 1); c; c = view_cursors_column_next(c, 1))
...
|
|
This is currently only enforced upon creation i.e. we assume
that after creation a cursor can not change its relative ordering
with respect to its neighbors.
The existing code assumes that when iterating through cursors with:
for (Cursor *c = view_cursors(view); c; c = view_cursors_next(c))
...
new cursors created with view_cursors_new do not show up.
This assumption is preserved under the following conditions:
* it only holds for the most recent view_cursors call
As a consequence when doing nested iterations new cursors
will be yielded once the inner view_cursors call was performed.
* view_cursors_primary_get is not called
|
|
|
|
|
|
|
|
|
|
This for example affects the default background color and cursor
related settings.
|
|
|
|
|
|
The currently visible display port is always adjusted
in a way that the primary cursor is visible.
|