Skip to content

Exiting insert mode with Ctrl+c leaves ghost text of suggestion #495

@maze88

Description

@maze88

When exiting insert mode, without yet accepting the suggested text (with Tab) using different methods - sometimes an undesired outcome occurs, leaving the suggested text displayed (and not selectable[!], albiet not save-able).

Vim version: VIM - Vi IMproved 9.0

Reproduction/test instructions

Let me describe how to reproduce, and then branch into three cases that are part of my workflow...

Start (all cases) by:

  1. Set mapping (for case 1): :inoremap jj <Esc> (bind jj in insert mode to return to normal mode).
  2. Enter insert mode i.
  3. Start typing def fizzbuzz(number):
  4. Await appearance of text suggestion.
  5. Proceed to one of the following case scenarios...

Case 1 - Vanilla:

  1. Exit insert mode by pressing Esc.
  2. Result: suggested text disappears after a second (this expected behavior). ✅

Case 2 - Mapping:

  1. Exit insert mode by pressing jj.
  2. Result: suggested text disappears after a second (this expected behavior). ✅

Case 3 - Ctrl+c:

  1. Exit insert mode by pressing Ctrl+c.
  2. Result:
    • suggested text remains displayed (unexpected behavior!). ❌
    • cannot navigate suggested text with cursor (arrow keys or hjkl). ❌
    • saving the file will not store the suggested text (this is a good thing). ✅
    • next time insert mode is entered (anywhere in the file), the suggested text will finally disappear - but until then there is an offset to line navigation, proportional to the amount of suggested lines. ✅

Conclusion

  • This issue has a minor impact, however if a simple fix could be found for it - then it'd be nice.
  • I am not certain of how many users "like" using Ctrl+c in Vim to exit insert mode sometimes.
  • This StackOverflow thread may be a good place to start, regarding understanding differences between Esc and Ctrl+c when exiting insert mode.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions