Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vim-patch:8.1.{27,32,36,69,70,71,91,92} #10433

Merged
merged 9 commits into from
Feb 12, 2020
Merged

vim-patch:8.1.{27,32,36,69,70,71,91,92} #10433

merged 9 commits into from
Feb 12, 2020

Conversation

erw7
Copy link
Contributor

@erw7 erw7 commented Jul 6, 2019

vim-patch:8.1.0027: difficult to make a plugin that feeds a line to a job
Problem: Difficult to make a plugin that feeds a line to a job.
Solution: Add the nitial code for the "prompt" buftype.
vim/vim@f273245

vim-patch:8.1.0032: BS in prompt buffer starts new line
Problem: BS in prompt buffer starts new line.
Solution: Do not allows BS over the prompt. Make term_sendkeys() handle special keys. Add a test.
vim/vim@6b810d9

vim-patch:8.1.0035: not easy to switch between prompt buffer and other windows
Problem: Not easy to switch between prompt buffer and other windows.
Solution: Accept CTRL-W commands in Insert mode. Start and stop Insert mode as one would expect.
vim/vim@6d41c78

vim-patch:8.1.0036: not restoring Insert mode if leaving prompt buffer with mouse
Problem: Not restoring Insert mode if leaving a prompt buffer by using a mouse click.
Solution: Set b_prompt_insert appropriately. Also correct cursor position when moving cursor to last line.
vim/vim@891e1fd

vim-patch:8.1.0042: if omni completion opens a window Insert mode is stopped
Problem: If omni completion opens a window Insert mode is stopped. (Hirohito Higashi)
Solution: Only set stop_insert_mode in a prompt buffer window.
vim/vim@f98b845

vim-patch:8.1.0064: typing CTRL-W in a prompt buffer shows mode "-- --"
Problem: Typing CTRL-W in a prompt buffer shows mode "-- --".
Solution: Set restart_edit to 'A' and check for it.
vim/vim@942b454

vim-patch:8.1.0069: cannot handle pressing CTRL-C in a prompt buffer
Problem: Cannot handle pressing CTRL-C in a prompt buffer.
Solution: Add prompt_setinterrupt().
vim/vim@0e5979a

vim-patch:8.1.0070: missing part of the changes for prompt_setinterrupt()
Problem: Missing part of the changes for prompt_setinterrupt().
Solution: Add the missing changes.
vim/vim@222cd20

vim-patch:8.1.0071: terminal debugger only works with the terminal feature
Problem: Terminal debugger only works with the terminal feature.
Solution: Make it also work with a prompt buffer. Makes it possible to use on MS-Windows. Various other improvements. (closes vim/vim#3012)
vim/vim@b3307b5

vim-patch:8.1.0091: MS-Windows: Cannot interrupt gdb when program is running
Problem: MS-Windows: Cannot interrupt gdb when program is running.
Solution: Add debugbreak() and use it in the terminal debugger. Respect 'modified' in a prompt buffer.
vim/vim@4551c0a

vim-patch:8.1.0092: prompt buffer test fails
Problem: Prompt buffer test fails.
Solution: Set 'nomodified' before closing the window. (Ozaki Kiichi, closes vim/vim#3051)
vim/vim@71ef1ba

@erw7 erw7 changed the title [WIP] Vim 8.1.{27,32,35,42,64,69,70,71,91,92} [RFC] Vim 8.1.{27,32,35,42,64,69,70,71,91,92} Jul 6, 2019
@marvim marvim added the RFC label Jul 6, 2019
src/nvim/channel.c Outdated Show resolved Hide resolved
src/nvim/channel.c Outdated Show resolved Hide resolved
@erw7 erw7 changed the title [RFC] Vim 8.1.{27,32,35,42,64,69,70,71,91,92} [RFC] vim-patch:8.1.{27,32,35,42,64,69,70,71,91,92} Jul 7, 2019
@marvim marvim added the vim-patch See https://neovim.io/doc/user/dev_vimpatch.html label Jul 7, 2019
@jpfeiffer16

This comment has been minimized.

*termdebug-prompt*
When on MS-Windows, gdb will run in a buffer with 'buftype' set to "prompt".
This works slightly differently:
- The gdb window will be in Insert mode while typing commands. Go to Normal
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why does it need to be different on Windows?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Communicating with gdb requires a pty, but Windows can not get a pty. Therefore, Windows needs prompt buffer.

Copy link
Member

@justinmk justinmk Jul 28, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought that winpty could be used for that. jobstart(...,{'pty':v:true}) works on Windows AFAIK.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought that winpty could be used for that.

If winpty provides a named pipe connected to a hidden console to pass to gdb, there is possibility to work. However, the current winpty does not provide such a pipe. Therefore, I think that does not work with the current winpty.

src/nvim/edit.c Outdated Show resolved Hide resolved
src/nvim/eval.c Outdated Show resolved Hide resolved
@erw7 erw7 changed the title [RFC] vim-patch:8.1.{27,32,35,42,64,69,70,71,91,92} [RFC] vim-patch:8.1.{27,32,36,69,70,71,91,92} Jul 29, 2019
@erw7
Copy link
Contributor Author

erw7 commented Jul 29, 2019

In this PR, vim-8.1.0036 is only partially applied. If we import vim-8.1.0035 in the future, we will also need to import the rest of vim-8.1.0036.

@justinmk
Copy link
Member

justinmk commented Sep 6, 2019

Scheduled for 0.5. @erw7 please leave a comment if this sits around for too long.

@justinmk justinmk added this to the 0.5 milestone Sep 6, 2019
@erw7 erw7 changed the title [RFC] vim-patch:8.1.{27,32,36,69,70,71,91,92} [RDY] vim-patch:8.1.{27,32,36,69,70,71,91,92} Sep 11, 2019
@marvim marvim added RDY and removed RFC labels Sep 11, 2019
@doronbehar
Copy link
Contributor

Hey,

Just wanted to point out that a very popular and useful Vim only plugin vimspector can't work in Neovim because of these patches not merged. A PR is waiting.

@blueyed
Copy link
Contributor

blueyed commented Sep 22, 2019

@doronbehar
Have you tried if it works with this branch/PR then?

@doronbehar
Copy link
Contributor

On NixOS, the build failed with:

[100%] Building C object src/nvim/CMakeFiles/nvim.dir/terminal.c.o
/build/source/src/nvim/terminal.c: In function 'terminal_init':
/build/source/src/nvim/terminal.c:178:12: error: 'VTermColor' {aka 'union <anonymous>'} has no member named 'red'
       color.red = 0;
            ^
/build/source/src/nvim/terminal.c:179:12: error: 'VTermColor' {aka 'union <anonymous>'} has no member named 'green'
       color.green = 0;
            ^
/build/source/src/nvim/terminal.c:180:12: error: 'VTermColor' {aka 'union <anonymous>'} has no member named 'blue'
       color.blue = (uint8_t)(color_index + 1);
            ^
In file included from /build/source/src/nvim/func_attr.h:44,
                 from /build/source/build/include/log.h.generated.h:4,
                 from /build/source/src/nvim/log.h:72,
                 from /build/source/src/nvim/terminal.c:46:
/build/source/src/nvim/terminal.c:185:33: error: 'VTermColor' {aka 'union <anonymous>'} has no member named 'red'
                       RGB_(color.red, color.green, color.blue),
                                 ^
/build/source/src/nvim/macros.h:154:25: note: in definition of macro 'RGB_'
 #define RGB_(r, g, b) ((r << 16) | (g << 8) | b)
                         ^
/build/source/src/nvim/terminal.c:185:44: error: 'VTermColor' {aka 'union <anonymous>'} has no member named 'green'
                       RGB_(color.red, color.green, color.blue),
                                            ^
/build/source/src/nvim/macros.h:154:37: note: in definition of macro 'RGB_'
 #define RGB_(r, g, b) ((r << 16) | (g << 8) | b)
                                     ^
/build/source/src/nvim/terminal.c:185:57: error: 'VTermColor' {aka 'union <anonymous>'} has no member named 'blue'
                       RGB_(color.red, color.green, color.blue),
                                                         ^
/build/source/src/nvim/macros.h:154:47: note: in definition of macro 'RGB_'
 #define RGB_(r, g, b) ((r << 16) | (g << 8) | b)
                                               ^
/build/source/src/nvim/terminal.c:191:26: error: 'VTermColor' {aka 'union <anonymous>'} has no member named 'red'
   default_vt_fg = RGB_(fg.red, fg.green, fg.blue);
                          ^
/build/source/src/nvim/macros.h:154:25: note: in definition of macro 'RGB_'
 #define RGB_(r, g, b) ((r << 16) | (g << 8) | b)
                         ^
/build/source/src/nvim/terminal.c:191:34: error: 'VTermColor' {aka 'union <anonymous>'} has no member named 'green'
   default_vt_fg = RGB_(fg.red, fg.green, fg.blue);
                                  ^
/build/source/src/nvim/macros.h:154:37: note: in definition of macro 'RGB_'
 #define RGB_(r, g, b) ((r << 16) | (g << 8) | b)
                                     ^
/build/source/src/nvim/terminal.c:191:44: error: 'VTermColor' {aka 'union <anonymous>'} has no member named 'blue'
   default_vt_fg = RGB_(fg.red, fg.green, fg.blue);
                                            ^
/build/source/src/nvim/macros.h:154:47: note: in definition of macro 'RGB_'
 #define RGB_(r, g, b) ((r << 16) | (g << 8) | b)
                                               ^
/build/source/src/nvim/terminal.c:192:26: error: 'VTermColor' {aka 'union <anonymous>'} has no member named 'red'
   default_vt_bg = RGB_(bg.red, bg.green, bg.blue);
                          ^
/build/source/src/nvim/macros.h:154:25: note: in definition of macro 'RGB_'
 #define RGB_(r, g, b) ((r << 16) | (g << 8) | b)
                         ^
/build/source/src/nvim/terminal.c:192:34: error: 'VTermColor' {aka 'union <anonymous>'} has no member named 'green'
   default_vt_bg = RGB_(bg.red, bg.green, bg.blue);
                                  ^
/build/source/src/nvim/macros.h:154:37: note: in definition of macro 'RGB_'
 #define RGB_(r, g, b) ((r << 16) | (g << 8) | b)
                                     ^
/build/source/src/nvim/terminal.c:192:44: error: 'VTermColor' {aka 'union <anonymous>'} has no member named 'blue'
   default_vt_bg = RGB_(bg.red, bg.green, bg.blue);
                                            ^
/build/source/src/nvim/macros.h:154:47: note: in definition of macro 'RGB_'
 #define RGB_(r, g, b) ((r << 16) | (g << 8) | b)
                                               ^
/build/source/src/nvim/terminal.c: In function 'terminal_open':
/build/source/src/nvim/terminal.c:263:12: error: 'VTermColor' {aka 'union <anonymous>'} has no member named 'red'
       color.red = 0;
            ^
/build/source/src/nvim/terminal.c:264:12: error: 'VTermColor' {aka 'union <anonymous>'} has no member named 'green'
       color.green = 0;
            ^
/build/source/src/nvim/terminal.c:265:12: error: 'VTermColor' {aka 'union <anonymous>'} has no member named 'blue'
       color.blue = (uint8_t)(i + 1);
            ^
/build/source/src/nvim/terminal.c:289:14: error: 'VTermColor' {aka 'union <anonymous>'} has no member named 'red'
         color.red = (uint8_t)((color_val >> 16) & 0xFF);
              ^
/build/source/src/nvim/terminal.c:290:14: error: 'VTermColor' {aka 'union <anonymous>'} has no member named 'green'
         color.green = (uint8_t)((color_val >> 8) & 0xFF);
              ^
/build/source/src/nvim/terminal.c:291:14: error: 'VTermColor' {aka 'union <anonymous>'} has no member named 'blue'
         color.blue = (uint8_t)((color_val >> 0) & 0xFF);
              ^
In file included from /build/source/src/nvim/func_attr.h:44,
                 from /build/source/build/include/log.h.generated.h:4,
                 from /build/source/src/nvim/log.h:72,
                 from /build/source/src/nvim/terminal.c:46:
/build/source/src/nvim/terminal.c: In function 'terminal_get_line_attributes':
/build/source/src/nvim/terminal.c:633:29: error: 'VTermColor' {aka 'union <anonymous>'} has no member named 'red'
     int vt_fg = RGB_(cell.fg.red, cell.fg.green, cell.fg.blue);
                             ^
/build/source/src/nvim/macros.h:154:25: note: in definition of macro 'RGB_'
 #define RGB_(r, g, b) ((r << 16) | (g << 8) | b)
                         ^
/build/source/src/nvim/terminal.c:633:42: error: 'VTermColor' {aka 'union <anonymous>'} has no member named 'green'
     int vt_fg = RGB_(cell.fg.red, cell.fg.green, cell.fg.blue);
                                          ^
/build/source/src/nvim/macros.h:154:37: note: in definition of macro 'RGB_'
 #define RGB_(r, g, b) ((r << 16) | (g << 8) | b)
                                     ^
/build/source/src/nvim/terminal.c:633:57: error: 'VTermColor' {aka 'union <anonymous>'} has no member named 'blue'
     int vt_fg = RGB_(cell.fg.red, cell.fg.green, cell.fg.blue);
                                                         ^
/build/source/src/nvim/macros.h:154:47: note: in definition of macro 'RGB_'
 #define RGB_(r, g, b) ((r << 16) | (g << 8) | b)
                                               ^
/build/source/src/nvim/terminal.c:634:29: error: 'VTermColor' {aka 'union <anonymous>'} has no member named 'red'
     int vt_bg = RGB_(cell.bg.red, cell.bg.green, cell.bg.blue);
                             ^
/build/source/src/nvim/macros.h:154:25: note: in definition of macro 'RGB_'
 #define RGB_(r, g, b) ((r << 16) | (g << 8) | b)
                         ^
/build/source/src/nvim/terminal.c:634:42: error: 'VTermColor' {aka 'union <anonymous>'} has no member named 'green'
     int vt_bg = RGB_(cell.bg.red, cell.bg.green, cell.bg.blue);
                                          ^
/build/source/src/nvim/macros.h:154:37: note: in definition of macro 'RGB_'
 #define RGB_(r, g, b) ((r << 16) | (g << 8) | b)
                                     ^
/build/source/src/nvim/terminal.c:634:57: error: 'VTermColor' {aka 'union <anonymous>'} has no member named 'blue'
     int vt_bg = RGB_(cell.bg.red, cell.bg.green, cell.bg.blue);
                                                         ^
/build/source/src/nvim/macros.h:154:47: note: in definition of macro 'RGB_'
 #define RGB_(r, g, b) ((r << 16) | (g << 8) | b)
                                               ^
make[2]: *** [src/nvim/CMakeFiles/nvim.dir/build.make:2741: src/nvim/CMakeFiles/nvim.dir/terminal.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:3314: src/nvim/CMakeFiles/nvim.dir/all] Error 2
make: *** [Makefile:152: all] Error 2

@blueyed
Copy link
Contributor

blueyed commented Sep 25, 2019

@doronbehar

On NixOS, the build failed with:

Not related to this PR/patch, is it?
Looks like a mismatch with the libvterm version.. 0.1 is required with Neovim 0.4 - CMake sure warn you about it. Please create a new issue / provide more info if that's not the case with how you're building / and/or if this can be improved then.

@blueyed
Copy link
Contributor

blueyed commented Sep 25, 2019

@erw7
Rebased this on master (testing cannot hurt since it is old already), and it helps with #11099 (comment). /cc @doronbehar

@doronbehar
Copy link
Contributor

@doronbehar
Have you tried if it works with this branch/PR then?

@blueyed I'm afraid not, that vimspector PR is not ready yet but I've notified it's author about my attempt to try it along with this PR merged.

I hope that never the less the maintainers will consider merging this sooner then in 0.5.0.

@eyalk5
Copy link

eyalk5 commented Nov 12, 2019

Just a friendly reminder

@tbodt
Copy link

tbodt commented Jan 8, 2020

Ping, this seems to be the main blocker for Neovim support in Vimspector

@Billy4195
Copy link
Contributor

@erw7 @blueyed
Because this PR has stuck for a while, I have already solved the conflicting files, and push to my own repository@pr10433. Would you like to use my branch to update your branch to make this PR be merged or I should create a new PR.

@erw7
Copy link
Contributor Author

erw7 commented Jan 19, 2020

@Billy4195 Thanks. I have updated this branch with your branch.

… job

Problem:    Difficult to make a plugin that feeds a line to a job.
Solution:   Add the nitial code for the "prompt" buftype.
vim/vim@f273245
Problem:    BS in prompt buffer starts new line.
Solution:   Do not allows BS over the prompt.  Make term_sendkeys() handle
            special keys. Add a test.
vim/vim@6b810d9
…r with mouse

Problem:    Not restoring Insert mode if leaving a prompt buffer by using a
            mouse click.
Solution:   Set b_prompt_insert appropriately. Also correct cursor position
            when moving cursor to last line.
vim/vim@891e1fd
Problem:    Cannot handle pressing CTRL-C in a prompt buffer.
Solution:   Add prompt_setinterrupt().
vim/vim@0e5979a
…pt()

Problem:    Missing part of the changes for prompt_setinterrupt().
Solution:   Add the missing changes.
vim/vim@222cd20
…ature

Problem:    Terminal debugger only works with the terminal feature.
Solution:   Make it also work with a prompt buffer.  Makes it possible to use
            on MS-Windows. Various other improvements. (closes vim/vim#3012)
vim/vim@b3307b5
…running

Problem:    MS-Windows: Cannot interrupt gdb when program is running.
Solution:   Add debugbreak() and use it in the terminal debugger.
            Respect 'modified' in a prompt buffer.
vim/vim@4551c0a
Problem:    Prompt buffer test fails.
Solution:   Set 'nomodified' before closing the window. (Ozaki Kiichi,
            closes vim/vim#3051
vim/vim@71ef1ba
Import necessary part of vim-patch:8.1.1575.
vim/vim@75a1a94
@justinmk
Copy link
Member

Merging this since it includes various useful changes (e.g. the op_is_change semantics is useful, and Termdebug changes), though I am not in favor of some of the surface changes:

  • Introducing another special-case buffer (buftype=prompt) is questionable. Ideally, plugin authors would instead have better control over normal buffers.
  • debugbreak() is over-specific, why not something like chansignal() instead?

Thanks @erw7 and @Billy4195

@justinmk justinmk merged commit 68de6b1 into neovim:master Feb 12, 2020
@justinmk justinmk changed the title [RDY] vim-patch:8.1.{27,32,36,69,70,71,91,92} vim-patch:8.1.{27,32,36,69,70,71,91,92} Feb 12, 2020
@erw7 erw7 deleted the vim-8.1.0027 branch February 13, 2020 05:45
@tbodt tbodt mentioned this pull request Jul 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
vim-patch See https://neovim.io/doc/user/dev_vimpatch.html
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add global function to send commands to GDB buffer
10 participants