onivim / libvim

libvim: The core Vim editing engine as a minimal C library
https://v2.onivim.io
MIT License
691 stars 34 forks source link

fix(commandline): Crash in vimCommandLineGetCompletions #216

Closed bryphe closed 4 years ago

bryphe commented 4 years ago

Issue: vimCommandLineGetCompletions could crash if the cursor was in the middle of a string.

Defect: The expand_T and ccline had different views of the buffer, causing a stack-overflow.

FIx: Synchronize the expand_T context prior to getting completions.

In addition to the crash, there were also bugs around the cursor movement - there'd be cases where the arrow keys would stop moving the cursor. This was due to the 'screen position' of the command line being out of sync - but for Onivim / libvim, we don't need to worry about the screen position - so the cmdspos and related functions were removed.

Related: https://github.com/onivim/oni2/issues/2162