Problem: When an info popup spans into the cmdline area and ESC is
pressed, some content remains visible on screen (yu3s)
Solution: Add popup_overlays_cmdline() check in screen_fill() to prevent
prematurely clearing the clear_cmdline flag (glepnir).
fixes: #15627closes: #16765
Signed-off-by: glepnir <glephunter@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Highlight groups PopupSelected/PopupNotification/
MessageWindow are supposed to fall back to default highlight
groups if they are not defined. However, once a colorscheme
has defined them, switching to another colorscheme that
doesn't do so will leave behind a cleared colorscheme, which
causes the fallback to fail.
Solution: Set up default links to the relevant fallback highlight
groups, which makes sure a `:hi clear` command will reset the
state properly (Yee Cheng Chin).
closes: #16676
Signed-off-by: Yee Cheng Chin <ychin.git@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: popups inconsistently shifted to the left
Solution: always shift non-fixed popups to the left when the
text would be truncated
(no matter whether 'wrap' is set or not)
(Boris Staletic)
fixes: #16231closes: #16247
Signed-off-by: Boris Staletic <boris.staletic@protonmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: when a popup window covers the command line,
the command line is not completely cleared on popup_hide()
(yu3s)
Solution: Check if the popup window covers the command line and if it
does, set the clear_cmdline flag.
fixes: #15608closes: #15610
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: popup_filter during Press Enter prompt seems to hang
Solution: Return early, when need_wait_return is set
(Ernie Rael)
fixes: #15300closes: #15301
Signed-off-by: Ernie Rael <errael@raelity.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: not possible to assign priority when defining a sign
(Mathias Fußenegger)
Solution: Add the priority argument for the :sign-define ex command and
the sign_define() function (LemonBoy)
Use the specified value instead of the default one (SIGN_DEF_PRIO) when
no priority is explicitly specified in sign_place or :sign place.
fixes: #8334closes: #15124
Signed-off-by: LemonBoy <thatlemon@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: cannot switch buffer in a popup
(Yggdroot)
Solution: add popup_setbuf() function
fixes: #15006closes: #15026
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: Calculating line height for unnecessary amount of lines with
half-page scrolling (zhscn, after 9.1.0280)
Solution: Replace "limit_winheight" argument with higher resolution
"max" argument to which to limit the calculated line height
in plines_m_win() to (Luuk van Baal)
fixes: #14650closes: #14652
Signed-off-by: Luuk van Baal <luukvbaal@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: plines_m_win() does not take into account it's "limit_winheight"
argument for filler lines below the last line of the buffer.
(after v9.1.0280)
Solution: Check window height when "limit_winheight" is TRUE.
(Luuk van Baal)
closes: #14449
Signed-off-by: Luuk van Baal <luukvbaal@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: When undoing with 'spell', redrawWinline() is called after
changed_lines(), while later win_update() sets redraw type to
UPD_NOT_VALID, even though w_redraw_top and w_redraw_bot are
still valid.
Solution: Only set redraw type to UPD_NOT_VALID when inserting/deleting
lines after parts of window has pending redraw, i.e., when
changed_lines() is called after redrawWinline().
(zeertzjq)
closes: #14019
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: crash when callback function aborts because of recursiveness
Solution: correctly initialize rettv
Initialize rettv in invoke_popup_callback()
Since v9.0.2030, call_callback may exit early when the callback recurses
too much. This meant that call_func, which would set rettv->v_type =
VAR_UNKNOWN, was not being called.
Without rettv->v_type being explicitly set, it still contained whatever
garbage was used to initialize the stack value in invoke_popup_callback.
This would lead to possible crashes when calling clear_tv(&rettv).
Rather than rely on action at a distance, explicitly initialize rettv's
type to VAR_UNKNOWN so clear_tv can tell nothing needs to be done.
closes: #13495closes: #13545
Signed-off-by: James McCoy <jamessan@jamessan.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: cannot complete option values
Solution: Add completion functions for several options
Add cmdline tab-completion for setting string options
Add tab-completion for setting string options on the cmdline using
`:set=` (along with `:set+=` and `:set-=`).
The existing tab completion for setting options currently only works
when nothing is typed yet, and it only fills in with the existing value,
e.g. when the user does `:set diffopt=<Tab>` it will be completed to
`set diffopt=internal,filler,closeoff` and nothing else. This isn't too
useful as a user usually wants auto-complete to suggest all the possible
values, such as 'iblank', or 'algorithm:patience'.
For set= and set+=, this adds a new optional callback function for each
option that can be invoked when doing completion. This allows for each
option to have control over how completion works. For example, in
'diffopt', it will suggest the default enumeration, but if `algorithm:`
is selected, it will further suggest different algorithm types like
'meyers' and 'patience'. When using set=, the existing option value will
be filled in as the first choice to preserve the existing behavior. When
using set+= this won't happen as it doesn't make sense.
For flag list options (e.g. 'mouse' and 'guioptions'), completion will
take into account existing typed values (and in the case of set+=, the
existing option value) to make sure it doesn't suggest duplicates.
For set-=, there is a new `ExpandSettingSubtract` function which will
handle flag list and comma-separated options smartly, by only suggesting
values that currently exist in the option.
Note that Vim has some existing code that adds special handling for
'filetype', 'syntax', and misc dir options like 'backupdir'. This change
preserves them as they already work, instead of converting to the new
callback API for each option.
closes: #13182
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
Problem: screenpos() wrong result with w_skipcol and cpoptions+=n
Solution: Use adjust_plines_for_skipcol() instead of subtracting
w_skipcol.
closes: #12625
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Problem: Cannot wrap around in popup_filter_menu()
Solution: Allow to wrap around by default
Currently, it is not possible, to wrap around at the end of the list
using e.g. down (and go back to the top) or up at the beginning of the
list and go directly to the last item. This is not consistent behaviour
with e.g. how the pum-menu currently works, so let's just allow this.
Also adjust tests about it.
closes: #12689closes: #12693
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: popup_create() not aborting on errors
Solution: check for errors in arguments given and abort if an error
occurred
closes: #12711
Signed-off-by: Christian Brabandt <cb@256bit.org>
Problem: "clear" macros are not always used.
Solution: Use ALLOC_ONE, VIM_CLEAR, CLEAR_POINTER and CLEAR_FIELD in more
places. (Yegappan Lakshmanan, closes#12104)
Problem: FOR_ALL_ macros are defined in an unexpected file.
Solution: Move FOR_ALL_ macros to macros.h. Add FOR_ALL_HASHTAB_ITEMS.
(Yegappan Lakshmanan, closes#12109)
Problem: Callback name argument is changed by setqflist().
Solution: Use the expanded function name for the callback, do not store it
in the argument. (closes#11653)
Problem: Using :echowin while at the hit-enter prompt causes problems.
Solution: Do not prompt for :echowin. Postpone showing the message window.
Start the timer when the window is displayed.
Problem: When updating the whole screen a popup may not be redrawn.
Solution: Mark the screen and windows for redraw also when not clearing.
Also mark popup windows for redraw.
Problem: Message in popup is shortened unnecessary.
Solution: Do not use 'showcmd' and 'ruler' for a message in the popup.
Set the timer when unhiding the message popup.
Problem: Crash when 'cmdheight' is 0 and popup_clear() used.
Solution: Reset "message_win" when the message popup is cleared. Close the
popup when 'cmdheight' is non-zero. Add a screendump test.
Problem: A finished terminal in a popup window does not show a scrollbar.
Solution: Show the scrollbar if the terminal job is finished. (closes
#10497)